Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Apr 2024 16:58:53 GMT
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 42ce242e3530 - main - OpenSSL: use the upstream provided version.map files for the fips/legacy providers
Message-ID:  <202404211658.43LGwr5o006862@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ngie:

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

commit 42ce242e353065dfbaa248955f6657005a395a95
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2024-04-20 19:12:50 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2024-04-21 16:35:19 +0000

    OpenSSL: use the upstream provided version.map files for the fips/legacy providers
    
    This change introduces a static copy of the fips and legacy linker version maps
    generated by the OpenSSL 3.0.13 build process.
    
    This unbreaks the fips and legacy providers by not exposing unnecessary
    symbols from the fips/legacy provider shared objects shared with other
    providers (base, default) and libcrypto.
    
    More discussion:
    
    Prior to this change, loading the fips provider indirectly from a
    FreeBSD 14.0-CURRENT and 15.0-CURRENT host would result in a
    process-wide deadlock when invoking select OpenSSL APIs
    (CONF_modules_load* in this particular example).
    
    Speaking with the upstream maintainers [1], it became obvious that
    the FreeBSD base system was incorrectly building/linking the fips
    provider, resulting in a symbol collision at runtime, and thus a
    process-wide deadlock in specific circumstances. The fips provider
    would deadlock when trying to acquire a write lock on internal
    structures which should have only been available to the base and
    default providers, as certain preprocessor ifdefs only allow specific
    internal calls to be made with the base and default providers.
    
    1. https://github.com/openssl/openssl/issues/24202
    
    Differential Revision:  https://reviews.freebsd.org/D44892
---
 crypto/openssl/providers/fips.ld             | 5 +++++
 crypto/openssl/providers/legacy.ld           | 5 +++++
 secure/lib/libcrypto/modules/fips/Makefile   | 2 ++
 secure/lib/libcrypto/modules/legacy/Makefile | 2 ++
 4 files changed, 14 insertions(+)

diff --git a/crypto/openssl/providers/fips.ld b/crypto/openssl/providers/fips.ld
new file mode 100644
index 000000000000..1debaaa7ff65
--- /dev/null
+++ b/crypto/openssl/providers/fips.ld
@@ -0,0 +1,5 @@
+{
+    global:
+        OSSL_provider_init;
+    local: *;
+};
diff --git a/crypto/openssl/providers/legacy.ld b/crypto/openssl/providers/legacy.ld
new file mode 100644
index 000000000000..1debaaa7ff65
--- /dev/null
+++ b/crypto/openssl/providers/legacy.ld
@@ -0,0 +1,5 @@
+{
+    global:
+        OSSL_provider_init;
+    local: *;
+};
diff --git a/secure/lib/libcrypto/modules/fips/Makefile b/secure/lib/libcrypto/modules/fips/Makefile
index 8843cb9717c9..ceaa57ab066e 100644
--- a/secure/lib/libcrypto/modules/fips/Makefile
+++ b/secure/lib/libcrypto/modules/fips/Makefile
@@ -1,6 +1,8 @@
 
 SHLIB_NAME?=	fips.so
 
+VERSION_MAP=	${SRCTOP}/crypto/openssl/providers/fips.ld
+
 CFLAGS+=	-DFIPS_MODULE
 
 SRCS+=	fips_entry.c fipsprov.c self_test.c self_test_kats.c
diff --git a/secure/lib/libcrypto/modules/legacy/Makefile b/secure/lib/libcrypto/modules/legacy/Makefile
index a285d0b1148b..e435c5aa2c41 100644
--- a/secure/lib/libcrypto/modules/legacy/Makefile
+++ b/secure/lib/libcrypto/modules/legacy/Makefile
@@ -2,6 +2,8 @@
 SHLIB_NAME?=	legacy.so
 LIBADD=		crypto
 
+VERSION_MAP=	${SRCTOP}/crypto/openssl/providers/legacy.ld
+
 SRCS+=	legacyprov.c prov_running.c
 
 # ciphers



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404211658.43LGwr5o006862>