From 9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 2 Mar 2024 11:28:46 +0000 Subject: Remove a bunch of CRYPTO memory API This was neutered early on in the fork and has been rotting ever since. Some parts of the API are still used, but it's easier to clean up when most of the mess is gone. ok jsing --- src/lib/libcrypto/malloc-wrapper.c | 150 +------------------------------------ 1 file changed, 1 insertion(+), 149 deletions(-) (limited to 'src/lib/libcrypto/malloc-wrapper.c') diff --git a/src/lib/libcrypto/malloc-wrapper.c b/src/lib/libcrypto/malloc-wrapper.c index 4d57f00b23..e13cc23373 100644 --- a/src/lib/libcrypto/malloc-wrapper.c +++ b/src/lib/libcrypto/malloc-wrapper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc-wrapper.c,v 1.8 2023/07/08 08:28:23 beck Exp $ */ +/* $OpenBSD: malloc-wrapper.c,v 1.9 2024/03/02 11:28:46 tb Exp $ */ /* * Copyright (c) 2014 Bob Beck * @@ -36,111 +36,6 @@ CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), } LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); -int -CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *)) -{ - return 0; -} -LCRYPTO_ALIAS(CRYPTO_set_locked_mem_functions); - -int -CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), - void (*f)(void *)) -{ - return 0; -} -LCRYPTO_ALIAS(CRYPTO_set_locked_mem_ex_functions); - -int -CRYPTO_set_mem_debug_functions(void (*m)(void *, int, const char *, int, int), - void (*r)(void *, void *, int, const char *, int, int), - void (*f)(void *, int), void (*so)(long), long (*go)(void)) -{ - return 0; -} -LCRYPTO_ALIAS(CRYPTO_set_mem_debug_functions); - - -void -CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), - void (**f)(void *)) -{ - if (m != NULL) - *m = malloc; - if (r != NULL) - *r = realloc; - if (f != NULL) - *f = free; -} -LCRYPTO_ALIAS(CRYPTO_get_mem_functions); - -void -CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), - void *(**r)(void *, size_t, const char *, int), void (**f)(void *)) -{ - if (m != NULL) - *m = NULL; - if (r != NULL) - *r = NULL; - if (f != NULL) - *f = free; -} -LCRYPTO_ALIAS(CRYPTO_get_mem_ex_functions); - -void -CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)) -{ - if (m != NULL) - *m = malloc; - if (f != NULL) - *f = free; -} -LCRYPTO_ALIAS(CRYPTO_get_locked_mem_functions); - -void -CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), - void (**f)(void *)) -{ - if (m != NULL) - *m = NULL; - if (f != NULL) - *f = free; -} -LCRYPTO_ALIAS(CRYPTO_get_locked_mem_ex_functions); - -void -CRYPTO_get_mem_debug_functions(void (**m)(void *, int, const char *, int, int), - void (**r)(void *, void *, int, const char *, int, int), - void (**f)(void *, int), void (**so)(long), long (**go)(void)) -{ - if (m != NULL) - *m = NULL; - if (r != NULL) - *r = NULL; - if (f != NULL) - *f = NULL; - if (so != NULL) - *so = NULL; - if (go != NULL) - *go = NULL; -} -LCRYPTO_ALIAS(CRYPTO_get_mem_debug_functions); - - -void * -CRYPTO_malloc_locked(int num, const char *file, int line) -{ - if (num <= 0) - return NULL; - return malloc(num); -} - -void -CRYPTO_free_locked(void *ptr) -{ - free(ptr); -} - void * CRYPTO_malloc(int num, const char *file, int line) { @@ -155,51 +50,8 @@ CRYPTO_strdup(const char *str, const char *file, int line) return strdup(str); } -void * -CRYPTO_realloc(void *ptr, int num, const char *file, int line) -{ - if (num <= 0) - return NULL; - return realloc(ptr, num); -} - -void * -CRYPTO_realloc_clean(void *ptr, int old_len, int num, const char *file, - int line) -{ - if (num <= 0) - return NULL; - /* Original does not support shrinking. */ - if (num < old_len) - return NULL; - return recallocarray(ptr, old_len, num, 1); -} -LCRYPTO_ALIAS(CRYPTO_realloc_clean); - void CRYPTO_free(void *ptr) { free(ptr); } - -void * -CRYPTO_remalloc(void *a, int num, const char *file, int line) -{ - free(a); - return malloc(num); -} -LCRYPTO_ALIAS(CRYPTO_remalloc); - -void -CRYPTO_set_mem_debug_options(long bits) -{ - return; -} -LCRYPTO_ALIAS(CRYPTO_set_mem_debug_options); - -long -CRYPTO_get_mem_debug_options(void) -{ - return 0; -} -LCRYPTO_ALIAS(CRYPTO_get_mem_debug_options); -- cgit v1.2.3-55-g6feb