From 4fb5c4b21a8052f87e02c941c6e7a0e6f0d9384c Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 6 Mar 2024 19:17:17 +0100
Subject: [PATCH 13/59] RH: version aliasing

Patch-name: 0116-version-aliasing.patch
Patch-id: 116
Patch-status: |
    # Add version aliasing due to
    # https://github.com/openssl/openssl/issues/23534
From-dist-git-commit: 4334bc837fbc64d14890fdc51679a80770d498ce
---
 crypto/evp/digest.c                    | 7 ++++++-
 crypto/evp/evp_enc.c                   | 7 ++++++-
 test/recipes/01-test_symbol_presence.t | 1 +
 util/libcrypto.num                     | 2 ++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 6fc201bcfe..3c80b9dfe1 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -572,7 +572,12 @@ int EVP_DigestSqueeze(EVP_MD_CTX *ctx, unsigned char *md, size_t size)
     return ctx->digest->dsqueeze(ctx->algctx, md, &size, size);
 }
 
-EVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in)
+EVP_MD_CTX
+#if !defined(FIPS_MODULE)
+__attribute__ ((symver ("EVP_MD_CTX_dup@@OPENSSL_3.1.0"),
+                    symver ("EVP_MD_CTX_dup@OPENSSL_3.2.0")))
+#endif
+*EVP_MD_CTX_dup(const EVP_MD_CTX *in)
 {
     EVP_MD_CTX *out = EVP_MD_CTX_new();
 
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index eee00a0780..7c51786515 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -1762,7 +1762,12 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)
 #endif /* FIPS_MODULE */
 }
 
-EVP_CIPHER_CTX *EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in)
+EVP_CIPHER_CTX
+#if !defined(FIPS_MODULE)
+__attribute__ ((symver ("EVP_CIPHER_CTX_dup@@OPENSSL_3.1.0"),
+                    symver ("EVP_CIPHER_CTX_dup@OPENSSL_3.2.0")))
+#endif
+*EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in)
 {
     EVP_CIPHER_CTX *out = EVP_CIPHER_CTX_new();
 
diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t
index 7e2f65cccb..cc947d4821 100644
--- a/test/recipes/01-test_symbol_presence.t
+++ b/test/recipes/01-test_symbol_presence.t
@@ -131,6 +131,7 @@ foreach (sort keys %stlibname) {
                   s| .*||;
                   # Drop OpenSSL dynamic version information if there is any
                   s|\@\@.+$||;
+                  s|\@.+$||;
                   # Return the result
                   $_
               }
diff --git a/util/libcrypto.num b/util/libcrypto.num
index ceb4948839..eab3987a6b 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -5435,7 +5435,9 @@ X509_PUBKEY_set0_public_key             5562	3_2_0	EXIST::FUNCTION:
 OSSL_STACK_OF_X509_free                 5563	3_2_0	EXIST::FUNCTION:
 OSSL_trace_string                       5564	3_2_0	EXIST::FUNCTION:
 EVP_MD_CTX_dup                          5565	3_2_0	EXIST::FUNCTION:
+EVP_MD_CTX_dup                          ?	    3_1_0	EXIST::FUNCTION:
 EVP_CIPHER_CTX_dup                      5566	3_2_0	EXIST::FUNCTION:
+EVP_CIPHER_CTX_dup                      ?    	3_1_0	EXIST::FUNCTION:
 BN_signed_bin2bn                        5567	3_2_0	EXIST::FUNCTION:
 BN_signed_bn2bin                        5568	3_2_0	EXIST::FUNCTION:
 BN_signed_lebin2bn                      5569	3_2_0	EXIST::FUNCTION:
-- 
2.51.0

