+++ /dev/null
-From eace72dfda7e6452dc82b884f0385a78a9d65d10 Mon Sep 17 00:00:00 2001
-From: Paul Swartz <paul@paulswartz.net>
-Date: Sun, 31 Dec 2023 13:12:02 -0500
-Subject: [PATCH 1/3] fix: rename `openssl/md5.h` to avoid include conflicts
- with OpenSSL
-
-Ref: #7987
----
- erts/emulator/openssl/README | 2 +-
- erts/emulator/openssl/crypto/md5/md5_local.h | 2 +-
- erts/emulator/openssl/include/erl_md5.h | 2 +-
- .../emulator/openssl/include/{openssl => openssl_local}/md5.h | 0
- erts/emulator/openssl/openssl.diff | 4 ++--
- erts/emulator/openssl/openssl.mk | 2 +-
- lib/erl_interface/src/openssl/README | 2 +-
- lib/erl_interface/src/openssl/crypto/md5/md5_local.h | 2 +-
- lib/erl_interface/src/openssl/include/erl_md5.h | 2 +-
- .../src/openssl/include/{openssl => openssl_local}/md5.h | 0
- lib/erl_interface/src/openssl/openssl.diff | 4 ++--
- 11 files changed, 11 insertions(+), 11 deletions(-)
- rename erts/emulator/openssl/include/{openssl => openssl_local}/md5.h (100%)
- rename lib/erl_interface/src/openssl/include/{openssl => openssl_local}/md5.h (100%)
-
---- a/erts/emulator/openssl/README
-+++ b/erts/emulator/openssl/README
-@@ -7,7 +7,7 @@ The files that has been taken from the 3
- ./crypto/md5/md5_local.h
- ./crypto/md5/md5_dgst.c
- ./include/crypto/md32_common.h
--./include/openssl/md5.h
-+./include/openssl_local/md5.h (renamed from include/openssl/md5.h)
-
- The openssl.diff file contains the diff between the original files and the ones
- included in OTP.
---- a/erts/emulator/openssl/crypto/md5/md5_local.h
-+++ b/erts/emulator/openssl/crypto/md5/md5_local.h
-@@ -10,7 +10,7 @@
- #include <stdlib.h>
- #include <string.h>
- #if defined(ERLANG_OPENSSL_INTEGRATION)
--#include "openssl/md5.h"
-+#include "openssl_local/md5.h"
- #define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
- #undef MD5_ASM
- #else
---- a/erts/emulator/openssl/include/erl_md5.h
-+++ b/erts/emulator/openssl/include/erl_md5.h
-@@ -30,6 +30,6 @@
- #define MD5_TRANSFORM_FUNCTION_NAME MD5Transform
- #define MD5_BLOCK_DATA_ORDER_FUNCTION_NAME MD5BlockDataOrder
-
--#include "openssl/md5.h"
-+#include "openssl_local/md5.h"
-
- #endif
---- a/erts/emulator/openssl/openssl.diff
-+++ b/erts/emulator/openssl/openssl.diff
-@@ -46,7 +46,7 @@ diff -u original/crypto/md5/md5_local.h
- #include <stdlib.h>
- #include <string.h>
- +#if defined(ERLANG_OPENSSL_INTEGRATION)
--+#include "openssl/md5.h"
-++#include "openssl_local/md5.h"
- +#define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
- +#undef MD5_ASM
- +#else
-@@ -116,7 +116,7 @@ diff -u original/include/crypto/md32_com
- # error "HASH_MAKE_STRING must be defined!"
- diff -u original/include/openssl/md5.h include/openssl/md5.h
- --- original/include/openssl/md5.h 2023-11-24 15:58:28.610171865 +0100
--+++ include/openssl/md5.h 2023-11-24 23:10:52.570854593 +0100
-++++ include/openssl_local/md5.h 2023-11-24 23:10:52.570854593 +0100
- @@ -11,6 +11,15 @@
- # define OPENSSL_MD5_H
- # pragma once
---- a/erts/emulator/openssl/openssl.mk
-+++ b/erts/emulator/openssl/openssl.mk
-@@ -50,4 +50,4 @@ $(OPENSSL_OBJDIR)/%.o: $(OPENSSL_DIR)/cr
- $(OPENSSL_OBJDIR)/md5_dgst.o: $(OPENSSL_DIR)/crypto/md5/md5_dgst.c \
- $(OPENSSL_DIR)/crypto/md5/md5_local.h \
- $(OPENSSL_DIR)/include/crypto/md32_common.h \
-- $(OPENSSL_DIR)/include/openssl/md5.h
-+ $(OPENSSL_DIR)/include/openssl_local/md5.h
---- a/erts/lib_src/common/erl_misc_utils.c
-+++ b/erts/lib_src/common/erl_misc_utils.c
-@@ -42,7 +42,7 @@
- # include <sys/select.h>
- # endif
- # include <time.h>
--# if HAVE_SYS_TIME_H
-+# ifdef HAVE_SYS_TIME_H
- # include <sys/time.h>
- # endif
- # include <string.h>
---- a/lib/erl_interface/src/openssl/crypto/md5/md5_local.h
-+++ b/lib/erl_interface/src/openssl/crypto/md5/md5_local.h
-@@ -10,7 +10,7 @@
- #include <stdlib.h>
- #include <string.h>
- #if defined(ERLANG_OPENSSL_INTEGRATION)
--#include "openssl/md5.h"
-+#include "openssl_local/md5.h"
- #define md5_block_data_order MD5_BLOCK_DATA_ORDER_FUNCTION_NAME
- #undef MD5_ASM
- #else
---- a/lib/erl_interface/src/openssl/include/erl_md5.h
-+++ b/lib/erl_interface/src/openssl/include/erl_md5.h
-@@ -30,6 +30,6 @@
- #define MD5_TRANSFORM_FUNCTION_NAME ei_MD5Transform
- #define MD5_BLOCK_DATA_ORDER_FUNCTION_NAME ei_MD5BlockDataOrder
-
--#include "openssl/md5.h"
-+#include "openssl_local/md5.h"
-
- #endif
---- a/erts/emulator/openssl/include/openssl/md5.h
-+++ /dev/null
-@@ -1,82 +0,0 @@
--/*
-- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
-- *
-- * Licensed under the Apache License 2.0 (the "License"). You may not use
-- * this file except in compliance with the License. You can obtain a copy
-- * in the file LICENSE in the source distribution or at
-- * https://www.openssl.org/source/license.html
-- */
--
--#ifndef OPENSSL_MD5_H
--# define OPENSSL_MD5_H
--# pragma once
--
--#if defined(ERLANG_OPENSSL_INTEGRATION)
--
--#include "erl_md5.h"
--
--#undef OPENSSL_NO_MD5
--#undef OPENSSL_NO_DEPRECATED_3_0
--
--#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--
--# include <openssl/macros.h>
--# ifndef OPENSSL_NO_DEPRECATED_3_0
--# define HEADER_MD5_H
--# endif
--
--# include <openssl/opensslconf.h>
--
--#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--
--# ifndef OPENSSL_NO_MD5
--#if !defined(ERLANG_OPENSSL_INTEGRATION)
--# include <openssl/e_os2.h>
--#endif
--# include <stddef.h>
--# ifdef __cplusplus
--extern "C" {
--# endif
--
--# define MD5_DIGEST_LENGTH 16
--
--# if !defined(OPENSSL_NO_DEPRECATED_3_0)
--/*
-- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- * ! MD5_LONG has to be at least 32 bits wide. !
-- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- */
--# define MD5_LONG unsigned int
--
--# define MD5_CBLOCK 64
--# define MD5_LBLOCK (MD5_CBLOCK/4)
--
--typedef struct MD5state_st {
-- MD5_LONG A, B, C, D;
-- MD5_LONG Nl, Nh;
-- MD5_LONG data[MD5_LBLOCK];
-- unsigned int num;
--} MD5_CTX;
--# endif
--# ifndef OPENSSL_NO_DEPRECATED_3_0
--# if defined(ERLANG_OPENSSL_INTEGRATION)
--int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
--int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
--int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
--void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
--# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
--OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
--OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
--OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
-- unsigned char *md);
--OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
--# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--# endif
--
--# ifdef __cplusplus
--}
--# endif
--# endif
--
--#endif
---- /dev/null
-+++ b/erts/emulator/openssl/include/openssl_local/md5.h
-@@ -0,0 +1,82 @@
-+/*
-+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
-+ *
-+ * Licensed under the Apache License 2.0 (the "License"). You may not use
-+ * this file except in compliance with the License. You can obtain a copy
-+ * in the file LICENSE in the source distribution or at
-+ * https://www.openssl.org/source/license.html
-+ */
-+
-+#ifndef OPENSSL_MD5_H
-+# define OPENSSL_MD5_H
-+# pragma once
-+
-+#if defined(ERLANG_OPENSSL_INTEGRATION)
-+
-+#include "erl_md5.h"
-+
-+#undef OPENSSL_NO_MD5
-+#undef OPENSSL_NO_DEPRECATED_3_0
-+
-+#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+
-+# include <openssl/macros.h>
-+# ifndef OPENSSL_NO_DEPRECATED_3_0
-+# define HEADER_MD5_H
-+# endif
-+
-+# include <openssl/opensslconf.h>
-+
-+#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+
-+# ifndef OPENSSL_NO_MD5
-+#if !defined(ERLANG_OPENSSL_INTEGRATION)
-+# include <openssl/e_os2.h>
-+#endif
-+# include <stddef.h>
-+# ifdef __cplusplus
-+extern "C" {
-+# endif
-+
-+# define MD5_DIGEST_LENGTH 16
-+
-+# if !defined(OPENSSL_NO_DEPRECATED_3_0)
-+/*
-+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-+ * ! MD5_LONG has to be at least 32 bits wide. !
-+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-+ */
-+# define MD5_LONG unsigned int
-+
-+# define MD5_CBLOCK 64
-+# define MD5_LBLOCK (MD5_CBLOCK/4)
-+
-+typedef struct MD5state_st {
-+ MD5_LONG A, B, C, D;
-+ MD5_LONG Nl, Nh;
-+ MD5_LONG data[MD5_LBLOCK];
-+ unsigned int num;
-+} MD5_CTX;
-+# endif
-+# ifndef OPENSSL_NO_DEPRECATED_3_0
-+# if defined(ERLANG_OPENSSL_INTEGRATION)
-+int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
-+int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
-+int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
-+void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
-+# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
-+OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
-+OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
-+OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
-+ unsigned char *md);
-+OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
-+# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+# endif
-+
-+# ifdef __cplusplus
-+}
-+# endif
-+# endif
-+
-+#endif
---- a/lib/erl_interface/src/openssl/include/openssl/md5.h
-+++ /dev/null
-@@ -1,82 +0,0 @@
--/*
-- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
-- *
-- * Licensed under the Apache License 2.0 (the "License"). You may not use
-- * this file except in compliance with the License. You can obtain a copy
-- * in the file LICENSE in the source distribution or at
-- * https://www.openssl.org/source/license.html
-- */
--
--#ifndef OPENSSL_MD5_H
--# define OPENSSL_MD5_H
--# pragma once
--
--#if defined(ERLANG_OPENSSL_INTEGRATION)
--
--#include "erl_md5.h"
--
--#undef OPENSSL_NO_MD5
--#undef OPENSSL_NO_DEPRECATED_3_0
--
--#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--
--# include <openssl/macros.h>
--# ifndef OPENSSL_NO_DEPRECATED_3_0
--# define HEADER_MD5_H
--# endif
--
--# include <openssl/opensslconf.h>
--
--#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--
--# ifndef OPENSSL_NO_MD5
--#if !defined(ERLANG_OPENSSL_INTEGRATION)
--# include <openssl/e_os2.h>
--#endif
--# include <stddef.h>
--# ifdef __cplusplus
--extern "C" {
--# endif
--
--# define MD5_DIGEST_LENGTH 16
--
--# if !defined(OPENSSL_NO_DEPRECATED_3_0)
--/*
-- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- * ! MD5_LONG has to be at least 32 bits wide. !
-- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- */
--# define MD5_LONG unsigned int
--
--# define MD5_CBLOCK 64
--# define MD5_LBLOCK (MD5_CBLOCK/4)
--
--typedef struct MD5state_st {
-- MD5_LONG A, B, C, D;
-- MD5_LONG Nl, Nh;
-- MD5_LONG data[MD5_LBLOCK];
-- unsigned int num;
--} MD5_CTX;
--# endif
--# ifndef OPENSSL_NO_DEPRECATED_3_0
--# if defined(ERLANG_OPENSSL_INTEGRATION)
--int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
--int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
--int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
--void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
--# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
--OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
--OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
--OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
-- unsigned char *md);
--OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
--# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
--# endif
--
--# ifdef __cplusplus
--}
--# endif
--# endif
--
--#endif
---- /dev/null
-+++ b/lib/erl_interface/src/openssl/include/openssl_local/md5.h
-@@ -0,0 +1,82 @@
-+/*
-+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
-+ *
-+ * Licensed under the Apache License 2.0 (the "License"). You may not use
-+ * this file except in compliance with the License. You can obtain a copy
-+ * in the file LICENSE in the source distribution or at
-+ * https://www.openssl.org/source/license.html
-+ */
-+
-+#ifndef OPENSSL_MD5_H
-+# define OPENSSL_MD5_H
-+# pragma once
-+
-+#if defined(ERLANG_OPENSSL_INTEGRATION)
-+
-+#include "erl_md5.h"
-+
-+#undef OPENSSL_NO_MD5
-+#undef OPENSSL_NO_DEPRECATED_3_0
-+
-+#else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+
-+# include <openssl/macros.h>
-+# ifndef OPENSSL_NO_DEPRECATED_3_0
-+# define HEADER_MD5_H
-+# endif
-+
-+# include <openssl/opensslconf.h>
-+
-+#endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+
-+# ifndef OPENSSL_NO_MD5
-+#if !defined(ERLANG_OPENSSL_INTEGRATION)
-+# include <openssl/e_os2.h>
-+#endif
-+# include <stddef.h>
-+# ifdef __cplusplus
-+extern "C" {
-+# endif
-+
-+# define MD5_DIGEST_LENGTH 16
-+
-+# if !defined(OPENSSL_NO_DEPRECATED_3_0)
-+/*
-+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-+ * ! MD5_LONG has to be at least 32 bits wide. !
-+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-+ */
-+# define MD5_LONG unsigned int
-+
-+# define MD5_CBLOCK 64
-+# define MD5_LBLOCK (MD5_CBLOCK/4)
-+
-+typedef struct MD5state_st {
-+ MD5_LONG A, B, C, D;
-+ MD5_LONG Nl, Nh;
-+ MD5_LONG data[MD5_LBLOCK];
-+ unsigned int num;
-+} MD5_CTX;
-+# endif
-+# ifndef OPENSSL_NO_DEPRECATED_3_0
-+# if defined(ERLANG_OPENSSL_INTEGRATION)
-+int MD5_INIT_FUNCTION_NAME(MD5_CTX *c);
-+int MD5_UPDATE_FUNCTION_NAME(MD5_CTX *c, const void *data, size_t len);
-+int MD5_FINAL_FUNCTION_NAME(unsigned char *md, MD5_CTX *c);
-+void MD5_TRANSFORM_FUNCTION_NAME(MD5_CTX *c, const unsigned char *b);
-+# else /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
-+OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
-+OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
-+OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
-+ unsigned char *md);
-+OSSL_DEPRECATEDIN_3_0 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
-+# endif /* !defined(ERLANG_OPENSSL_INTEGRATION) */
-+# endif
-+
-+# ifdef __cplusplus
-+}
-+# endif
-+# endif
-+
-+#endif