summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto_init.c
diff options
context:
space:
mode:
authorkenjiro <>2026-08-30 12:19:37 +0000
committerkenjiro <>2026-08-30 12:19:37 +0000
commit5931045c664b500427fb54c31fab4de3e92bb159 (patch)
tree6bcb237ddd3233dde465de629eee51c4c1a0ed2c /src/lib/libcrypto/crypto_init.c
parent6b13eef79d2dc54c1b0203f967b3fc8b8971df78 (diff)
downloadopenbsd-5931045c664b500427fb54c31fab4de3e92bb159.tar.gz
openbsd-5931045c664b500427fb54c31fab4de3e92bb159.tar.bz2
openbsd-5931045c664b500427fb54c31fab4de3e92bb159.zip
Make CRYPTO_cleanup_all_ex_data() a compatibility no-op
The ex_data callback registry is process-wide, but this API could free it while other threads were still using libcrypto, resulting in a use-after-free. Retain the public symbol as a compatibility no-op and mark it deprecated. Move the actual cleanup to an internal function called by OPENSSL_cleanup(). Replace the in-tree callers with OPENSSL_cleanup() at final shutdown to preserve cleanup behavior and coverage. Document both APIs and the requirement that OPENSSL_cleanup() only be called after all threads and components have stopped using libcrypto. ok tb
Diffstat (limited to 'src/lib/libcrypto/crypto_init.c')
-rw-r--r--src/lib/libcrypto/crypto_init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c
index ae4914e358..5b7ce3d4fa 100644
--- a/src/lib/libcrypto/crypto_init.c
+++ b/src/lib/libcrypto/crypto_init.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_init.c,v 1.26 2025/06/11 07:41:12 tb Exp $ */ 1/* $OpenBSD: crypto_init.c,v 1.27 2026/08/30 12:19:37 kenjiro Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -107,7 +107,7 @@ OPENSSL_cleanup(void)
107 /* This currently calls init... */ 107 /* This currently calls init... */
108 ERR_free_strings(); 108 ERR_free_strings();
109 109
110 CRYPTO_cleanup_all_ex_data(); 110 crypto_ex_data_cleanup();
111 EVP_cleanup(); 111 EVP_cleanup();
112 112
113 X509_VERIFY_PARAM_table_cleanup(); 113 X509_VERIFY_PARAM_table_cleanup();