The branch master has been updated via ff8428561a4fa89423862f532436a9b109369d53 (commit) from 33eaf4c27e32ae163e1d36e7b4d8df28c2acb4f2 (commit)
- Log ----------------------------------------------------------------- commit ff8428561a4fa89423862f532436a9b109369d53 Author: Richard Levitte <levi...@openssl.org> Date: Thu Dec 17 08:24:26 2015 +0100 Modify the lower level memory allocation routines to take size_t We've been using int for the size for a long time, it's about time... Reviewed-by: Rich Salz <rs...@openssl.org> ----------------------------------------------------------------------- Summary of changes: crypto/mem.c | 28 ++++++++++++++-------------- crypto/mem_dbg.c | 4 ++-- crypto/mem_sec.c | 2 +- include/openssl/crypto.h | 32 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/crypto/mem.c b/crypto/mem.c index a1a75a2..0c8f4e1 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -107,9 +107,9 @@ static void (*free_secure_func)(void *) = free; /* XXX use correct function pointer types */ #ifdef CRYPTO_MDEBUG /* use default functions from mem_dbg.c */ -static void (*malloc_debug_func) (void *, int, const char *, int, int) +static void (*malloc_debug_func) (void *, size_t, const char *, int, int) = CRYPTO_dbg_malloc; -static void (*realloc_debug_func) (void *, void *, int, const char *, int, +static void (*realloc_debug_func) (void *, void *, size_t, const char *, int, int) = CRYPTO_dbg_realloc; static void (*free_debug_func) (void *, int) = CRYPTO_dbg_free; @@ -197,9 +197,9 @@ int CRYPTO_set_secure_mem_ex_functions(void *(*m)(size_t, const char *, int), return 1; } -int CRYPTO_set_mem_debug_functions(void (*m) - (void *, int, const char *, int, int), - void (*r) (void *, void *, int, +int CRYPTO_set_mem_debug_functions(void (*m) (void *, size_t, + const char *, int, int), + void (*r) (void *, void *, size_t, const char *, int, int), void (*f) (void *, int), void (*so) (long), long (*go) (void)) @@ -245,7 +245,7 @@ void CRYPTO_get_secure_mem_functions(void *(**m)(size_t), void (**f)(void *)) malloc_secure_func : 0; if (f != NULL) *f=free_secure_func; - } +} void CRYPTO_get_secure_mem_ex_functions(void *(**m)(size_t,const char *,int), void (**f)(void *)) @@ -257,9 +257,9 @@ void CRYPTO_get_secure_mem_ex_functions(void *(**m)(size_t,const char *,int), *f=free_secure_func; } -void CRYPTO_get_mem_debug_functions(void (**m) - (void *, int, const char *, int, int), - void (**r) (void *, void *, int, +void CRYPTO_get_mem_debug_functions(void (**m) (void *, size_t, + const char *, int, int), + void (**r) (void *, void *, size_t, const char *, int, int), void (**f) (void *, int), void (**so) (long), long (**go) (void)) @@ -276,7 +276,7 @@ void CRYPTO_get_mem_debug_functions(void (**m) *go = get_debug_options_func; } -void *CRYPTO_malloc(int num, const char *file, int line) +void *CRYPTO_malloc(size_t num, const char *file, int line) { void *ret = NULL; @@ -309,7 +309,7 @@ void *CRYPTO_malloc(int num, const char *file, int line) return ret; } -void *CRYPTO_zalloc(int num, const char *file, int line) +void *CRYPTO_zalloc(size_t num, const char *file, int line) { void *ret = CRYPTO_malloc(num, file, line); @@ -318,7 +318,7 @@ void *CRYPTO_zalloc(int num, const char *file, int line) return ret; } -void *CRYPTO_realloc(void *str, int num, const char *file, int line) +void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) { void *ret = NULL; @@ -337,8 +337,8 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line) return ret; } -void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, - int line) +void *CRYPTO_realloc_clean(void *str, size_t old_len, size_t num, + const char *file, int line) { void *ret = NULL; diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 292bf2a..06d3f67 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -451,7 +451,7 @@ int CRYPTO_remove_all_info(void) } static unsigned long break_order_num = 0; -void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, +void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line, int before_p) { MEM *m, *mm; @@ -555,7 +555,7 @@ void CRYPTO_dbg_free(void *addr, int before_p) } } -void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, +void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num, const char *file, int line, int before_p) { MEM m, *mp; diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c index 0b2f1fd..4ef8300 100644 --- a/crypto/mem_sec.c +++ b/crypto/mem_sec.c @@ -89,7 +89,7 @@ int CRYPTO_secure_malloc_initialized() #endif /* IMPLEMENTED */ } -void *CRYPTO_secure_malloc(int num, const char *file, int line) +void *CRYPTO_secure_malloc(size_t num, const char *file, int line) { #ifdef IMPLEMENTED void *ret; diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index e0cea6a..8247f68 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -453,9 +453,9 @@ int CRYPTO_set_mem_functions(void *(*m) (size_t), void *(*r) (void *, size_t), 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_debug_functions(void (*m) - (void *, int, const char *, int, int), - void (*r) (void *, void *, int, +int CRYPTO_set_mem_debug_functions(void (*m) (void *, size_t, + const char *, int, int), + void (*r) (void *, void *, size_t, const char *, int, int), void (*f) (void *, int), void (*so) (long), long (*go) (void)); @@ -465,23 +465,23 @@ void CRYPTO_get_mem_functions(void *(**m) (size_t), void CRYPTO_get_mem_ex_functions(void *(**m) (size_t, const char *, int), void *(**r) (void *, size_t, const char *, int), void (**f) (void *)); -void CRYPTO_get_mem_debug_functions(void (**m) - (void *, int, const char *, int, int), - void (**r) (void *, void *, int, +void CRYPTO_get_mem_debug_functions(void (**m) (void *, size_t, + const char *, int, int), + void (**r) (void *, void *, size_t, const char *, int, int), void (**f) (void *, int), void (**so) (long), long (**go) (void)); -void *CRYPTO_malloc(int num, const char *file, int line); -void *CRYPTO_zalloc(int num, const char *file, int line); +void *CRYPTO_malloc(size_t num, const char *file, int line); +void *CRYPTO_zalloc(size_t num, const char *file, int line); void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line); char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); void CRYPTO_free(void *ptr); void CRYPTO_clear_free(void *ptr, size_t num); -void *CRYPTO_realloc(void *addr, int num, const char *file, int line); -void *CRYPTO_realloc_clean(void *addr, int old_num, int num, const char *file, - int line); +void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); +void *CRYPTO_realloc_clean(void *addr, size_t old_num, size_t num, + const char *file, int line); # define OPENSSL_secure_malloc(num) \ CRYPTO_secure_malloc((int)num,__FILE__,__LINE__) @@ -490,7 +490,7 @@ void *CRYPTO_realloc_clean(void *addr, int old_num, int num, const char *file, int CRYPTO_secure_malloc_init(size_t sz, int minsize); void CRYPTO_secure_malloc_done(void); -void *CRYPTO_secure_malloc(int num, const char *file, int line); +void *CRYPTO_secure_malloc(size_t num, const char *file, int line); void CRYPTO_secure_free(void *ptr); int CRYPTO_secure_allocated(const void *ptr); int CRYPTO_secure_malloc_initialized(void); @@ -523,9 +523,9 @@ int CRYPTO_remove_all_info(void); * 0: called before the actual memory allocation has taken place * 1: called after the actual memory allocation has taken place */ -void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, +void CRYPTO_dbg_malloc(void *addr, size_t num, const char *file, int line, int before_p); -void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, +void CRYPTO_dbg_realloc(void *addr1, void *addr2, size_t num, const char *file, int line, int before_p); void CRYPTO_dbg_free(void *addr, int before_p); /*- @@ -544,8 +544,8 @@ long CRYPTO_dbg_get_options(void); void CRYPTO_mem_leaks_fp(FILE *); # endif void CRYPTO_mem_leaks(struct bio_st *bio); -/* unsigned long order, char *file, int line, int num_bytes, char *addr */ -typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, int, +/* unsigned long order, char *file, int line, size_t num_bytes, char *addr */ +typedef void *CRYPTO_MEM_LEAK_CB (unsigned long, const char *, int, size_t, void *); void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); _____ openssl-commits mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits