Fix CRYPTO_malloc, etc., definitions. In upstream, these functions take file and line number arguments. Update ours to match. Guessing almost no one uses these, or we'd have caught this earlier. Change-Id: Ic09f8d8274065ac02efa78e70c215b87fa765b9f Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49665 Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: Benjamin Brittain <bwb@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/mem.c b/crypto/mem.c index 8988937..639de32 100644 --- a/crypto/mem.c +++ b/crypto/mem.c
@@ -380,3 +380,13 @@ OPENSSL_memcpy(ret, data, size); return ret; } + +void *CRYPTO_malloc(size_t size, const char *file, int line) { + return OPENSSL_malloc(size); +} + +void *CRYPTO_realloc(void *ptr, size_t new_size, const char *file, int line) { + return OPENSSL_realloc(ptr, new_size); +} + +void CRYPTO_free(void *ptr, const char *file, int line) { OPENSSL_free(ptr); }
diff --git a/include/openssl/mem.h b/include/openssl/mem.h index 9906d5b..476299a 100644 --- a/include/openssl/mem.h +++ b/include/openssl/mem.h
@@ -150,9 +150,15 @@ // Deprecated functions. -#define CRYPTO_malloc OPENSSL_malloc -#define CRYPTO_realloc OPENSSL_realloc -#define CRYPTO_free OPENSSL_free +// CRYPTO_malloc calls |OPENSSL_malloc|. |file| and |line| are ignored. +OPENSSL_EXPORT void *CRYPTO_malloc(size_t size, const char *file, int line); + +// CRYPTO_realloc calls |OPENSSL_realloc|. |file| and |line| are ignored. +OPENSSL_EXPORT void *CRYPTO_realloc(void *ptr, size_t new_size, + const char *file, int line); + +// CRYPTO_free calls |OPENSSL_free|. |file| and |line| are ignored. +OPENSSL_EXPORT void CRYPTO_free(void *ptr, const char *file, int line); // OPENSSL_clear_free calls |OPENSSL_free|. BoringSSL automatically clears all // allocations on free, but we define |OPENSSL_clear_free| for compatibility.