From b04c2a1d799fe2ea8751349ab1dc4a8b551ce48d Mon Sep 17 00:00:00 2001 From: tb <> Date: Sun, 9 Mar 2025 15:29:56 +0000 Subject: Align CRYPTO_set_mem*_functions with OpenSSL 1.1 CRYPTO_set_mem_ex_functions() was renamed to CRYPTO_set_mem_functions(), replacing the latter while also correcting the arguments for the free pointer. The backstory is that a commit that was never compiled was fixed the wrong way an hour later (both committed without review, obviously), and here we are, still cleaning up the mess 23 years later. We carry patches in cjose and stunnel for this; dovecot and links+ have autoconf checks and will adapt. Oh, and then there's the mariadb configure time insanity passing wrong function pointers... ok jsing --- src/lib/libcrypto/Symbols.list | 1 - src/lib/libcrypto/crypto.h | 10 ++++------ src/lib/libcrypto/crypto_memory.c | 15 ++++----------- src/lib/libcrypto/hidden/openssl/crypto.h | 3 +-- 4 files changed, 9 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index faf4fb135f..cae2ac924d 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list @@ -665,7 +665,6 @@ CRYPTO_set_dynlock_lock_callback CRYPTO_set_ex_data CRYPTO_set_id_callback CRYPTO_set_locking_callback -CRYPTO_set_mem_ex_functions CRYPTO_set_mem_functions CRYPTO_strdup CRYPTO_thread_id diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 6ddcaff338..b4230f1b28 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.78 2025/03/09 15:12:18 tb Exp $ */ +/* $OpenBSD: crypto.h,v 1.79 2025/03/09 15:29:56 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -349,11 +349,9 @@ struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const c void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line); void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file, int line); -/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- - * call the latter last if you need different functions */ -int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *)); -int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), - void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); +int CRYPTO_set_mem_functions(void *(*m)(size_t, const char *, int), + void *(*r)(void *, size_t, const char *, int), + void (*f)(void *, const char *, int)); void *CRYPTO_malloc(size_t num, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line); diff --git a/src/lib/libcrypto/crypto_memory.c b/src/lib/libcrypto/crypto_memory.c index 773927b831..8c7bb5fe16 100644 --- a/src/lib/libcrypto/crypto_memory.c +++ b/src/lib/libcrypto/crypto_memory.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_memory.c,v 1.3 2024/11/06 04:18:42 tb Exp $ */ +/* $OpenBSD: crypto_memory.c,v 1.4 2025/03/09 15:29:56 tb Exp $ */ /* * Copyright (c) 2014 Bob Beck * @@ -29,21 +29,14 @@ OPENSSL_cleanse(void *ptr, size_t len) LCRYPTO_ALIAS(OPENSSL_cleanse); int -CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), - void (*f)(void *)) +CRYPTO_set_mem_functions(void *(*m)(size_t, const char *, int), + void *(*r)(void *, size_t, const char *, int), + void (*f)(void *, const char *, int)) { return 0; } LCRYPTO_ALIAS(CRYPTO_set_mem_functions); -int -CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), - void *(*r)(void *, size_t, const char *, int), void (*f)(void *)) -{ - return 0; -} -LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); - void * CRYPTO_malloc(size_t num, const char *file, int line) { diff --git a/src/lib/libcrypto/hidden/openssl/crypto.h b/src/lib/libcrypto/hidden/openssl/crypto.h index 1b2d8cbbe7..fcaea05d48 100644 --- a/src/lib/libcrypto/hidden/openssl/crypto.h +++ b/src/lib/libcrypto/hidden/openssl/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.8 2024/07/09 07:16:44 beck Exp $ */ +/* $OpenBSD: crypto.h,v 1.9 2025/03/09 15:29:56 tb Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -39,7 +39,6 @@ LCRYPTO_USED(CRYPTO_cleanup_all_ex_data); LCRYPTO_USED(CRYPTO_lock); LCRYPTO_USED(CRYPTO_add_lock); LCRYPTO_USED(CRYPTO_set_mem_functions); -LCRYPTO_USED(CRYPTO_set_mem_ex_functions); LCRYPTO_USED(OpenSSLDie); LCRYPTO_USED(OPENSSL_cpu_caps); LCRYPTO_USED(OPENSSL_init_crypto); -- cgit v1.2.3-55-g6feb