1 From eace72dfda7e6452dc82b884f0385a78a9d65d10 Mon Sep 17 00:00:00 2001
2 From: Paul Swartz <paul@paulswartz.net>
3 Date: Sun, 31 Dec 2023 13:12:02 -0500
4 Subject: [PATCH 1/3] fix: rename `openssl/md5.h` to avoid include conflicts
9 erts/emulator/openssl/README | 2 +-
10 erts/emulator/openssl/crypto/md5/md5_local.h | 2 +-
11 erts/emulator/openssl/include/erl_md5.h | 2 +-
12 .../emulator/openssl/include/{openssl => openssl_local}/md5.h | 0
13 erts/emulator/openssl/openssl.diff | 4 ++--
14 erts/emulator/openssl/openssl.mk | 2 +-
15 lib/erl_interface/src/openssl/README | 2 +-
16 lib/erl_interface/src/openssl/crypto/md5/md5_local.h | 2 +-
17 lib/erl_interface/src/openssl/include/erl_md5.h | 2 +-
18 .../src/openssl/include/{openssl => openssl_local}/md5.h | 0
19 lib/erl_interface/src/openssl/openssl.diff | 4 ++--
20 11 files changed, 11 insertions(+), 11 deletions(-)
21 rename erts/emulator/openssl/include/{openssl => openssl_local}/md5.h (100%)
22 rename lib/erl_interface/src/openssl/include/{openssl => openssl_local}/md5.h (100%)
24 --- a/erts/emulator/openssl/README
25 +++ b/erts/emulator/openssl/README
26 @@ -7,7 +7,7 @@ The files that has been taken from the 3
27 ./crypto/md5/md5_local.h
28 ./crypto/md5/md5_dgst.c
29 ./include/crypto/md32_common.h
30 -./include/openssl/md5.h
31 +./include/openssl_local/md5.h (renamed from include/openssl/md5.h)
33 The openssl.diff file contains the diff between the original files and the ones
35 --- a/erts/emulator/openssl/crypto/md5/md5_local.h
36 +++ b/erts/emulator/openssl/crypto/md5/md5_local.h
40 #if defined(ERLANG_OPENSSL_INTEGRATION)
41 -#include "openssl/md5.h"
42 +#include "openssl_local/md5.h"
43 #define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
46 --- a/erts/emulator/openssl/include/erl_md5.h
47 +++ b/erts/emulator/openssl/include/erl_md5.h
49 #define MD5_TRANSFORM_FUNCTION_NAME MD5Transform
50 #define MD5_BLOCK_DATA_ORDER_FUNCTION_NAME MD5BlockDataOrder
52 -#include "openssl/md5.h"
53 +#include "openssl_local/md5.h"
56 --- a/erts/emulator/openssl/openssl.diff
57 +++ b/erts/emulator/openssl/openssl.diff
58 @@ -46,7 +46,7 @@ diff -u original/crypto/md5/md5_local.h
61 +#if defined(ERLANG_OPENSSL_INTEGRATION)
62 -+#include "openssl/md5.h"
63 ++#include "openssl_local/md5.h"
64 +#define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
67 @@ -116,7 +116,7 @@ diff -u original/include/crypto/md32_com
68 # error "HASH_MAKE_STRING must be defined!"
69 diff -u original/include/openssl/md5.h include/openssl/md5.h
70 --- original/include/openssl/md5.h 2023-11-24 15:58:28.610171865 +0100
71 -+++ include/openssl/md5.h 2023-11-24 23:10:52.570854593 +0100
72 ++++ include/openssl_local/md5.h 2023-11-24 23:10:52.570854593 +0100
74 # define OPENSSL_MD5_H
76 --- a/erts/emulator/openssl/openssl.mk
77 +++ b/erts/emulator/openssl/openssl.mk
78 @@ -50,4 +50,4 @@ $(OPENSSL_OBJDIR)/%.o: $(OPENSSL_DIR)/cr
79 $(OPENSSL_OBJDIR)/md5_dgst.o: $(OPENSSL_DIR)/crypto/md5/md5_dgst.c \
80 $(OPENSSL_DIR)/crypto/md5/md5_local.h \
81 $(OPENSSL_DIR)/include/crypto/md32_common.h \
82 - $(OPENSSL_DIR)/include/openssl/md5.h
83 + $(OPENSSL_DIR)/include/openssl_local/md5.h
84 --- a/erts/lib_src/common/erl_misc_utils.c
85 +++ b/erts/lib_src/common/erl_misc_utils.c
87 # include <sys/select.h>
91 +# ifdef HAVE_SYS_TIME_H
92 # include <sys/time.h>
95 --- a/lib/erl_interface/src/openssl/crypto/md5/md5_local.h
96 +++ b/lib/erl_interface/src/openssl/crypto/md5/md5_local.h
100 #if defined(ERLANG_OPENSSL_INTEGRATION)
101 -#include "openssl/md5.h"
102 +#include "openssl_local/md5.h"
103 #define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
106 --- a/lib/erl_interface/src/openssl/include/erl_md5.h
107 +++ b/lib/erl_interface/src/openssl/include/erl_md5.h
109 #define MD5_TRANSFORM_FUNCTION_NAME ei_MD5Transform
110 #define MD5_BLOCK_DATA_ORDER_FUNCTION_NAME ei_MD5BlockDataOrder
112 -#include "openssl/md5.h"
113 +#include "openssl_local/md5.h"
116 --- a/erts/emulator/openssl/include/openssl/md5.h
120 - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
122 - * Licensed under the Apache License 2.0 (the "License"). You may not use
123 - * this file except in compliance with the License. You can obtain a copy
124 - * in the file LICENSE in the source distribution or at
125 - * https://www.openssl.org/source/license.html
128 -#ifndef OPENSSL_MD5_H
129 -# define OPENSSL_MD5_H
132 -#if defined(ERLANG_OPENSSL_INTEGRATION)
134 -#include "erl_md5.h"
136 -#undef OPENSSL_NO_MD5
137 -#undef OPENSSL_NO_DEPRECATED_3_0
139 -#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
141 -# include <openssl/macros.h>
142 -# ifndef OPENSSL_NO_DEPRECATED_3_0
143 -# define HEADER_MD5_H
146 -# include <openssl/opensslconf.h>
148 -#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
150 -# ifndef OPENSSL_NO_MD5
151 -#if !defined(ERLANG_OPENSSL_INTEGRATION)
152 -# include <openssl/e_os2.h>
154 -# include <stddef.h>
159 -# define MD5_DIGEST_LENGTH 16
161 -# if !defined(OPENSSL_NO_DEPRECATED_3_0)
163 - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
164 - * ! MD5_LONG has to be at least 32 bits wide. !
165 - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
167 -# define MD5_LONG unsigned int
169 -# define MD5_CBLOCK 64
170 -# define MD5_LBLOCK (MD5_CBLOCK/4)
172 -typedef struct MD5state_st {
173 - MD5_LONG A, B, C, D;
175 - MD5_LONG data[MD5_LBLOCK];
179 -# ifndef OPENSSL_NO_DEPRECATED_3_0
180 -# if defined(ERLANG_OPENSSL_INTEGRATION)
181 -int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
182 -int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
183 -int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
184 -void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
185 -# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
186 -OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
187 -OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
188 -OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
189 -OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
190 - unsigned char *md);
191 -OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
192 -# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
202 +++ b/erts/emulator/openssl/include/openssl_local/md5.h
205 + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
207 + * Licensed under the Apache License 2.0 (the "License"). You may not use
208 + * this file except in compliance with the License. You can obtain a copy
209 + * in the file LICENSE in the source distribution or at
210 + * https://www.openssl.org/source/license.html
213 +#ifndef OPENSSL_MD5_H
214 +# define OPENSSL_MD5_H
217 +#if defined(ERLANG_OPENSSL_INTEGRATION)
219 +#include "erl_md5.h"
221 +#undef OPENSSL_NO_MD5
222 +#undef OPENSSL_NO_DEPRECATED_3_0
224 +#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
226 +# include <openssl/macros.h>
227 +# ifndef OPENSSL_NO_DEPRECATED_3_0
228 +# define HEADER_MD5_H
231 +# include <openssl/opensslconf.h>
233 +#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
235 +# ifndef OPENSSL_NO_MD5
236 +#if !defined(ERLANG_OPENSSL_INTEGRATION)
237 +# include <openssl/e_os2.h>
239 +# include <stddef.h>
244 +# define MD5_DIGEST_LENGTH 16
246 +# if !defined(OPENSSL_NO_DEPRECATED_3_0)
248 + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
249 + * ! MD5_LONG has to be at least 32 bits wide. !
250 + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
252 +# define MD5_LONG unsigned int
254 +# define MD5_CBLOCK 64
255 +# define MD5_LBLOCK (MD5_CBLOCK/4)
257 +typedef struct MD5state_st {
258 + MD5_LONG A, B, C, D;
260 + MD5_LONG data[MD5_LBLOCK];
264 +# ifndef OPENSSL_NO_DEPRECATED_3_0
265 +# if defined(ERLANG_OPENSSL_INTEGRATION)
266 +int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
267 +int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
268 +int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
269 +void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
270 +# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
271 +OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
272 +OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
273 +OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
274 +OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
275 + unsigned char *md);
276 +OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
277 +# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
286 --- a/lib/erl_interface/src/openssl/include/openssl/md5.h
290 - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
292 - * Licensed under the Apache License 2.0 (the "License"). You may not use
293 - * this file except in compliance with the License. You can obtain a copy
294 - * in the file LICENSE in the source distribution or at
295 - * https://www.openssl.org/source/license.html
298 -#ifndef OPENSSL_MD5_H
299 -# define OPENSSL_MD5_H
302 -#if defined(ERLANG_OPENSSL_INTEGRATION)
304 -#include "erl_md5.h"
306 -#undef OPENSSL_NO_MD5
307 -#undef OPENSSL_NO_DEPRECATED_3_0
309 -#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
311 -# include <openssl/macros.h>
312 -# ifndef OPENSSL_NO_DEPRECATED_3_0
313 -# define HEADER_MD5_H
316 -# include <openssl/opensslconf.h>
318 -#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
320 -# ifndef OPENSSL_NO_MD5
321 -#if !defined(ERLANG_OPENSSL_INTEGRATION)
322 -# include <openssl/e_os2.h>
324 -# include <stddef.h>
329 -# define MD5_DIGEST_LENGTH 16
331 -# if !defined(OPENSSL_NO_DEPRECATED_3_0)
333 - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
334 - * ! MD5_LONG has to be at least 32 bits wide. !
335 - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
337 -# define MD5_LONG unsigned int
339 -# define MD5_CBLOCK 64
340 -# define MD5_LBLOCK (MD5_CBLOCK/4)
342 -typedef struct MD5state_st {
343 - MD5_LONG A, B, C, D;
345 - MD5_LONG data[MD5_LBLOCK];
349 -# ifndef OPENSSL_NO_DEPRECATED_3_0
350 -# if defined(ERLANG_OPENSSL_INTEGRATION)
351 -int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
352 -int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
353 -int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
354 -void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
355 -# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
356 -OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
357 -OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
358 -OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
359 -OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
360 - unsigned char *md);
361 -OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
362 -# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
372 +++ b/lib/erl_interface/src/openssl/include/openssl_local/md5.h
375 + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
377 + * Licensed under the Apache License 2.0 (the "License"). You may not use
378 + * this file except in compliance with the License. You can obtain a copy
379 + * in the file LICENSE in the source distribution or at
380 + * https://www.openssl.org/source/license.html
383 +#ifndef OPENSSL_MD5_H
384 +# define OPENSSL_MD5_H
387 +#if defined(ERLANG_OPENSSL_INTEGRATION)
389 +#include "erl_md5.h"
391 +#undef OPENSSL_NO_MD5
392 +#undef OPENSSL_NO_DEPRECATED_3_0
394 +#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
396 +# include <openssl/macros.h>
397 +# ifndef OPENSSL_NO_DEPRECATED_3_0
398 +# define HEADER_MD5_H
401 +# include <openssl/opensslconf.h>
403 +#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
405 +# ifndef OPENSSL_NO_MD5
406 +#if !defined(ERLANG_OPENSSL_INTEGRATION)
407 +# include <openssl/e_os2.h>
409 +# include <stddef.h>
414 +# define MD5_DIGEST_LENGTH 16
416 +# if !defined(OPENSSL_NO_DEPRECATED_3_0)
418 + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
419 + * ! MD5_LONG has to be at least 32 bits wide. !
420 + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
422 +# define MD5_LONG unsigned int
424 +# define MD5_CBLOCK 64
425 +# define MD5_LBLOCK (MD5_CBLOCK/4)
427 +typedef struct MD5state_st {
428 + MD5_LONG A, B, C, D;
430 + MD5_LONG data[MD5_LBLOCK];
434 +# ifndef OPENSSL_NO_DEPRECATED_3_0
435 +# if defined(ERLANG_OPENSSL_INTEGRATION)
436 +int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
437 +int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
438 +int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
439 +void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
440 +# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
441 +OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
442 +OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
443 +OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
444 +OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
445 + unsigned char *md);
446 +OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
447 +# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */