"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
portable: the hash mess
To:
gameoftrees@openbsd.org
Date:
Fri, 26 Apr 2024 21:51:46 +0200

Download raw body.

Thread
Our handling of SHA1/2 in -portable is a mess.  Every platform has
its own flavor of slightly different functions and slightly different
header files in some library.  We have a haphazard mix of autoconf
and ad-hoc fragments that produces results like on FreeBSD, where
we incoherently use SHA1*() from the native libmd and SHA2*() from
the included sha2.c.  Good examples for dealing with this are rare.
I've considered extracting a subset of libarchive's comprehensive
solution, but it's annoyingly complex.

Yesterday I had a lightbulb moment.  Since we now depend on libtls,
there is necessarily some flavor of OpenSSL/LibreSSL around, so we
could simply grab the hash functions from there.  Unless we want
to keep the libtls dependency limited/optional?

In fact, we could also do this on OpenBSD.  LibreSSL provides
arch/CPU-optimized implementations on some architectures as opposed
to the plain C code implementation in libc.  I don't know if SHA1/2
performance is a bottleneck anywhere in Got, though.

Thoughts before I start making patches?

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de