git: c48fe39ad139 - releng/14.0 - kerberos5: Mitigate the possibility of using an old libcrypto

From: Gordon Tetlow <gordon_at_FreeBSD.org>
Date: Thu, 28 Mar 2024 05:06:25 UTC
The branch releng/14.0 has been updated by gordon:

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

commit c48fe39ad13906f9425ec36bf42c2725e8e31979
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-01-18 08:22:20 +0000
Commit:     Gordon Tetlow <gordon@FreeBSD.org>
CommitDate: 2024-03-28 03:15:14 +0000

    kerberos5: Mitigate the possibility of using an old libcrypto
    
    By using the full library name (libcrypto.so.30) we avoid the exposure
    of using an old, possibly vulnerable, library.
    
    Reported by:            jrtc27
    Fixes:                  476d63e091c2
    Approved by:            so
    Security:               FreeBSD-EN-24:08.kerberos
    
    (cherry picked from commit 0990136ed1753ac7837206f9c5f4b83ccff6c405)
    (cherry picked from commit 17e941a0c88cac2d8cd28d6614448adbd65d4b72)
---
 kerberos5/lib/libroken/fbsd_ossl_provider_load.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kerberos5/lib/libroken/fbsd_ossl_provider_load.c b/kerberos5/lib/libroken/fbsd_ossl_provider_load.c
index 497b32124f96..2328041bc166 100644
--- a/kerberos5/lib/libroken/fbsd_ossl_provider_load.c
+++ b/kerberos5/lib/libroken/fbsd_ossl_provider_load.c
@@ -5,6 +5,7 @@
 #include <openssl/provider.h>
 
 #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
+#define CRYPTO_LIBRARY "/lib/libcrypto.so.30"
 static void fbsd_ossl_provider_unload(void);
 static void print_dlerror(char *);
 static OSSL_PROVIDER *legacy;
@@ -46,7 +47,7 @@ fbsd_ossl_provider_load(void)
 {
 #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
 	if (crypto_lib_handle == NULL) {
-		if (!(crypto_lib_handle = dlopen("/usr/lib/libcrypto.so",
+		if (!(crypto_lib_handle = dlopen(CRYPTO_LIBRARY,
 		    RTLD_LAZY|RTLD_GLOBAL))) {
 			print_dlerror("Unable to load libcrypto.so");
 			return (EINVAL);