summaryrefslogtreecommitdiff
path: root/sys-apps/coreutils/files/coreutils-9.4-gnulib-openssl-1.1.patch
blob: 3576c7d0d1eb78c0e84fe3dd4c1b1b4cfbae994d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
https://bugs.gentoo.org/913368
https://debbugs.gnu.org/65674
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=ce20e238f0b4448a098bd7c076c131edbc759764

From ce20e238f0b4448a098bd7c076c131edbc759764 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Fri, 1 Sep 2023 12:55:30 +0200
Subject: crypto/{sha*,md5,sm3}-buffer: Fix --with-openssl (regr. 2023-08-26).

Reported by Agostino Sarubbo via Sam James <sam@gentoo.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00000.html>.

* lib/sha1.h: Test the OpenSSL major version before attempting to
include <openssl/configuration.h>.
* lib/sha256.h: Likewise.
* lib/sha512.h: Likewise.
* lib/md5.h: Likewise.
* lib/sm3.h: Likewise.
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -33,14 +33,18 @@
 #   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
 #  endif
 /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
-#  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_MD5
-#  else
+#  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_MD5
+#   endif
+#  endif
+#  if HAVE_OPENSSL_MD5
 #   include <openssl/md5.h>
 #  endif
 # endif
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -32,14 +32,18 @@
 #   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
 #  endif
 /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
-#  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_SHA1
-#  else
+#  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_SHA1
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SHA1
 #   include <openssl/sha.h>
 #  endif
 # endif
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -31,14 +31,18 @@
 #   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
 #  endif
 /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
-#  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_SHA256
-#  else
+#  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_SHA256
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SHA256
 #   include <openssl/sha.h>
 #  endif
 # endif
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -31,14 +31,18 @@
 #   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
 #  endif
 /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
-#  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
-#  else
+#  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
--- a/lib/sm3.h
+++ b/lib/sm3.h
@@ -40,14 +40,18 @@
 #   define OPENSSL_API_COMPAT 0x10101000L /* FIXME: Use OpenSSL 1.1+ API.  */
 #  endif
 /* If <openssl/macros.h> would give a compile-time error, don't use OpenSSL.  */
-#  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_SM3
-#  else
+#  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_SM3
+#   endif
+#  endif
+#  if HAVE_OPENSSL_SM3
 #   include <openssl/sm3.h>
 #  endif
 # endif
-- 
cgit v1.1