diff options
Diffstat (limited to 'gl/sha256.h')
-rw-r--r-- | gl/sha256.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gl/sha256.h b/gl/sha256.h index 2879477..a9d7abb 100644 --- a/gl/sha256.h +++ b/gl/sha256.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Declarations of functions and data types used for SHA256 and SHA224 sum | 1 | /* Declarations of functions and data types used for SHA256 and SHA224 sum |
2 | library functions. | 2 | library functions. |
3 | Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,6 +18,11 @@ | |||
18 | #ifndef SHA256_H | 18 | #ifndef SHA256_H |
19 | # define SHA256_H 1 | 19 | # define SHA256_H 1 |
20 | 20 | ||
21 | /* This file uses HAVE_OPENSSL_SHA256. */ | ||
22 | # if !_GL_CONFIG_H_INCLUDED | ||
23 | # error "Please include config.h first." | ||
24 | # endif | ||
25 | |||
21 | # include <stdio.h> | 26 | # include <stdio.h> |
22 | # include <stdint.h> | 27 | # include <stdint.h> |
23 | 28 | ||
@@ -25,7 +30,21 @@ | |||
25 | # ifndef OPENSSL_API_COMPAT | 30 | # ifndef OPENSSL_API_COMPAT |
26 | # define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */ | 31 | # define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API. */ |
27 | # endif | 32 | # endif |
28 | # include <openssl/sha.h> | 33 | /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL. */ |
34 | # include <openssl/opensslv.h> | ||
35 | # if OPENSSL_VERSION_MAJOR >= 3 | ||
36 | # include <openssl/configuration.h> | ||
37 | # if (OPENSSL_CONFIGURED_API \ | ||
38 | < (OPENSSL_API_COMPAT < 0x900000L ? OPENSSL_API_COMPAT : \ | ||
39 | ((OPENSSL_API_COMPAT >> 28) & 0xF) * 10000 \ | ||
40 | + ((OPENSSL_API_COMPAT >> 20) & 0xFF) * 100 \ | ||
41 | + ((OPENSSL_API_COMPAT >> 12) & 0xFF))) | ||
42 | # undef HAVE_OPENSSL_SHA256 | ||
43 | # endif | ||
44 | # endif | ||
45 | # if HAVE_OPENSSL_SHA256 | ||
46 | # include <openssl/sha.h> | ||
47 | # endif | ||
29 | # endif | 48 | # endif |
30 | 49 | ||
31 | # ifdef __cplusplus | 50 | # ifdef __cplusplus |