On Mon, Sep 02, 2024 at 03:41:28PM +0200, Patrick Steinhardt wrote: > > +endif > > +endif > > +endif > > +endif > > + > > What a cascade of `endif`s :) Heh, indeed. These are copy/pasted from the hunk below this one, so nothing new here. > Do we also want to wire up support in config.mak.uname such that the > fast variants are default-enabled? Or is there a good reason to not do > that? I thought that I might consider doing that in a separate series, if at all. I would like have users opt-in to the new behavior rather than imposing any change on them in this series. > > diff --git a/hash.h b/hash.h > > index f255e5c1e8a..450e579b405 100644 > > --- a/hash.h > > +++ b/hash.h > > @@ -15,6 +15,31 @@ > > #include "block-sha1/sha1.h" > > #endif > > > > +#if defined(SHA1_APPLE_FAST) > > +#include <CommonCrypto/CommonDigest.h> > > +#define platform_SHA_CTX_fast CC_SHA1_CTX > > +#define platform_SHA1_Init_fast CC_SHA1_Init > > +#define platform_SHA1_Update_fast CC_SHA1_Update > > +#define platform_SHA1_Final_fast CC_SHA1_Final > > +#elif defined(SHA1_OPENSSL_FAST) > > +# include <openssl/sha.h> > > +# if defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL >= 3 > > +# define SHA1_NEEDS_CLONE_HELPER_FAST > > +# include "sha1/openssl.h" > > +# endif > > +# define platform_SHA_CTX_fast openssl_SHA1_CTX > > +# define platform_SHA1_Init_fast openssl_SHA1_Init > > +# define platform_SHA1_Clone_fast openssl_SHA1_Clone > > +# define platform_SHA1_Update_fast openssl_SHA1_Update > > +# define platform_SHA1_Final_fast openssl_SHA1_Final > > +#elif defined(SHA1_BLK_FAST) > > +#include "block-sha1/sha1.h" > > +#define platform_SHA_CTX_fast blk_SHA_CTX > > +#define platform_SHA1_Init_fast blk_SHA1_Init > > +#define platform_SHA1_Update_fast blk_SHA1_Update > > +#define platform_SHA1_Final_fast blk_SHA1_Final > > +#endif > > + > > #if defined(SHA256_NETTLE) > > #include "sha256/nettle.h" > > #elif defined(SHA256_GCRYPT) > > Curiously, some of the nested statements here are indented whereas > others aren't. We should aim to make that consistent. Sure, this one was also copy/pasted from the block above, but I'll adjust the new one accordingly. Thanks, Taylor