summaryrefslogtreecommitdiff
path: root/src/usr.bin
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/usr.bin
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/usr.bin')
-rw-r--r--src/usr.bin/openssl/openssl.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index 056912a9ed..b9d63fa43a 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: openssl.c,v 1.41 2026/01/02 00:14:24 kenjiro Exp $ */ 1/* $OpenBSD: openssl.c,v 1.42 2026/08/30 12:19:37 kenjiro Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -360,10 +360,6 @@ openssl_shutdown(void)
360 CONF_modules_unload(1); 360 CONF_modules_unload(1);
361 destroy_ui(); 361 destroy_ui();
362 OBJ_cleanup(); 362 OBJ_cleanup();
363 EVP_cleanup();
364 CRYPTO_cleanup_all_ex_data();
365 ERR_remove_thread_state(NULL);
366 ERR_free_strings();
367} 363}
368 364
369int 365int
@@ -461,6 +457,9 @@ main(int argc, char **argv)
461 BIO_free(bio_err); 457 BIO_free(bio_err);
462 bio_err = NULL; 458 bio_err = NULL;
463 } 459 }
460 ERR_remove_thread_state(NULL);
461 OPENSSL_cleanup();
462
464 return (ret); 463 return (ret);
465} 464}
466 465