git: c02bc0aa0b22 - main - libmd: re-apply masking of _Transform names

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 30 Sep 2024 19:59:42 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=c02bc0aa0b22009e4bc209efae99c877167e1161

commit c02bc0aa0b22009e4bc209efae99c877167e1161
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-09-30 19:54:42 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-09-30 19:59:31 +0000

    libmd: re-apply masking of _Transform names
    
    Visibility can get complicated when, e.g., ifuncs are involved.  In
    particular, SHA256/SHA512 on aarch64 use ifuncs for their _Transform
    implementations, which then exposes global symbols of the same name that
    break things trying to statically link both libcrypto and libmd.
    
    Revert this part of the _Transform removal to fix the pkg-static build
    on aarch64.
    
    Fixes:  81de655acd2 ("libmd: stop exporting Transform() symbols")
---
 lib/libmd/ripemd.h        | 3 +++
 lib/libmd/sha.h           | 3 +++
 sys/crypto/sha2/sha256.h  | 3 +++
 sys/crypto/sha2/sha512.h  | 3 +++
 sys/crypto/sha2/sha512t.h | 6 ++++++
 5 files changed, 18 insertions(+)

diff --git a/lib/libmd/ripemd.h b/lib/libmd/ripemd.h
index 07293dad0e5f..252483be0a17 100644
--- a/lib/libmd/ripemd.h
+++ b/lib/libmd/ripemd.h
@@ -109,6 +109,9 @@ __BEGIN_DECLS
 #ifndef RIPEMD160_Data
 #define RIPEMD160_Data		_libmd_RIPEMD160_Data
 #endif
+#ifndef RIPEMD160_Transform
+#define RIPEMD160_Transform		_libmd_RIPEMD160_Transform
+#endif
 
 #ifndef ripemd160_block
 #define ripemd160_block		_libmd_ripemd160_block
diff --git a/lib/libmd/sha.h b/lib/libmd/sha.h
index cd4a899bee49..3d1cd8da3ae2 100644
--- a/lib/libmd/sha.h
+++ b/lib/libmd/sha.h
@@ -138,6 +138,9 @@ __BEGIN_DECLS
 #ifndef SHA1_Data
 #define SHA1_Data	_libmd_SHA1_Data
 #endif
+#ifndef SHA1_Transform
+#define SHA1_Transform	_libmd_SHA1_Transform
+#endif
 
 #ifndef sha1_block
 #define sha1_block	_libmd_sha1_block
diff --git a/sys/crypto/sha2/sha256.h b/sys/crypto/sha2/sha256.h
index 77237c466bd9..150f1b63b9c2 100644
--- a/sys/crypto/sha2/sha256.h
+++ b/sys/crypto/sha2/sha256.h
@@ -72,6 +72,9 @@ __BEGIN_DECLS
 #ifndef SHA256_Data
 #define SHA256_Data		_libmd_SHA256_Data
 #endif
+#ifndef SHA256_Transform
+#define SHA256_Transform		_libmd_SHA256_Transform
+#endif
 
 void	SHA256_Init(SHA256_CTX *);
 void	SHA256_Update(SHA256_CTX *, const void *, size_t);
diff --git a/sys/crypto/sha2/sha512.h b/sys/crypto/sha2/sha512.h
index b78fde7dc22f..206b7e63dc34 100644
--- a/sys/crypto/sha2/sha512.h
+++ b/sys/crypto/sha2/sha512.h
@@ -71,6 +71,9 @@ __BEGIN_DECLS
 #ifndef SHA512_Data
 #define SHA512_Data		_libmd_SHA512_Data
 #endif
+#ifndef SHA512_Transform
+#define SHA512_Transform		_libmd_SHA512_Transform
+#endif
 
 void	SHA512_Init(SHA512_CTX *);
 void	SHA512_Update(SHA512_CTX *, const void *, size_t);
diff --git a/sys/crypto/sha2/sha512t.h b/sys/crypto/sha2/sha512t.h
index dc8025e4a74f..26a6909cbbac 100644
--- a/sys/crypto/sha2/sha512t.h
+++ b/sys/crypto/sha2/sha512t.h
@@ -68,6 +68,9 @@ __BEGIN_DECLS
 #ifndef SHA512_224_Data
 #define SHA512_224_Data		_libmd_SHA512_224_Data
 #endif
+#ifndef SHA512_224_Transform
+#define SHA512_224_Transform		_libmd_SHA512_224_Transform
+#endif
 
 #ifndef SHA512_256_Init
 #define SHA512_256_Init		_libmd_SHA512_256_Init
@@ -96,6 +99,9 @@ __BEGIN_DECLS
 #ifndef SHA512_256_Data
 #define SHA512_256_Data		_libmd_SHA512_256_Data
 #endif
+#ifndef SHA512_256_Transform
+#define SHA512_256_Transform		_libmd_SHA512_256_Transform
+#endif
 
 void	SHA512_224_Init(SHA512_CTX *);
 void	SHA512_224_Update(SHA512_CTX *, const void *, size_t);