diff options
Diffstat (limited to 'lib/sha512.h')
-rw-r--r-- | lib/sha512.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/sha512.h b/lib/sha512.h index 9c688cc3d71..f6bac85488e 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -18,6 +18,11 @@ #ifndef SHA512_H # define SHA512_H 1 +/* This file uses HAVE_OPENSSL_SHA512. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include <stdio.h> # include "u64.h" @@ -25,7 +30,21 @@ # ifndef OPENSSL_API_COMPAT # define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */ # endif -# include <openssl/sha.h> +/* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL. */ +# include <openssl/opensslv.h> +# if OPENSSL_VERSION_MAJOR >= 3 +# include <openssl/configuration.h> +# if (OPENSSL_CONFIGURED_API \ + < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \ + ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \ + + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \ + + ((OPENSSL_API_COMPAT >> 12) & 0xFF))) +# undef HAVE_OPENSSL_SHA512 +# endif +# endif +# if HAVE_OPENSSL_SHA512 +# include <openssl/sha.h> +# endif # endif # ifdef __cplusplus |