diff options
-rw-r--r-- | src/lib/libcrypto/crypto.h | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/malloc-wrapper.c | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 67c5820500..382d40a350 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crypto.h,v 1.67 2024/03/02 11:32:31 tb Exp $ */ | 1 | /* $OpenBSD: crypto.h,v 1.68 2024/03/02 11:35:09 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -273,9 +273,9 @@ DECLARE_STACK_OF(void) | |||
273 | 273 | ||
274 | int CRYPTO_mem_ctrl(int mode); | 274 | int CRYPTO_mem_ctrl(int mode); |
275 | 275 | ||
276 | #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0) | 276 | #define OPENSSL_malloc(num) CRYPTO_malloc((num),NULL,0) |
277 | #define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0) | 277 | #define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0) |
278 | #define OPENSSL_free(addr) CRYPTO_free(addr) | 278 | #define OPENSSL_free(addr) CRYPTO_free((addr),NULL,0) |
279 | #endif | 279 | #endif |
280 | 280 | ||
281 | const char *OpenSSL_version(int type); | 281 | const char *OpenSSL_version(int type); |
@@ -364,9 +364,9 @@ int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), | |||
364 | void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); | 364 | void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); |
365 | 365 | ||
366 | #ifndef LIBRESSL_INTERNAL | 366 | #ifndef LIBRESSL_INTERNAL |
367 | void *CRYPTO_malloc(int num, const char *file, int line); | 367 | void *CRYPTO_malloc(size_t num, const char *file, int line); |
368 | char *CRYPTO_strdup(const char *str, const char *file, int line); | 368 | char *CRYPTO_strdup(const char *str, const char *file, int line); |
369 | void CRYPTO_free(void *ptr); | 369 | void CRYPTO_free(void *ptr, const char *file, int line); |
370 | #endif | 370 | #endif |
371 | 371 | ||
372 | #ifndef LIBRESSL_INTERNAL | 372 | #ifndef LIBRESSL_INTERNAL |
diff --git a/src/lib/libcrypto/malloc-wrapper.c b/src/lib/libcrypto/malloc-wrapper.c index e13cc23373..fb42169b2f 100644 --- a/src/lib/libcrypto/malloc-wrapper.c +++ b/src/lib/libcrypto/malloc-wrapper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc-wrapper.c,v 1.9 2024/03/02 11:28:46 tb Exp $ */ | 1 | /* $OpenBSD: malloc-wrapper.c,v 1.10 2024/03/02 11:35:09 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Bob Beck | 3 | * Copyright (c) 2014 Bob Beck |
4 | * | 4 | * |
@@ -37,10 +37,8 @@ CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), | |||
37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); | 37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); |
38 | 38 | ||
39 | void * | 39 | void * |
40 | CRYPTO_malloc(int num, const char *file, int line) | 40 | CRYPTO_malloc(size_t num, const char *file, int line) |
41 | { | 41 | { |
42 | if (num <= 0) | ||
43 | return NULL; | ||
44 | return malloc(num); | 42 | return malloc(num); |
45 | } | 43 | } |
46 | 44 | ||
@@ -51,7 +49,7 @@ CRYPTO_strdup(const char *str, const char *file, int line) | |||
51 | } | 49 | } |
52 | 50 | ||
53 | void | 51 | void |
54 | CRYPTO_free(void *ptr) | 52 | CRYPTO_free(void *ptr, const char *file, int line) |
55 | { | 53 | { |
56 | free(ptr); | 54 | free(ptr); |
57 | } | 55 | } |