silence unused variable warnings when using OPENSSL_clear_free e.g. here: https://github.com/nodejs/node/blob/adbe3b837e8a2285238ec0fcba89c20882eb4cdb/src/node_crypto.cc#L3439 Change-Id: I2d43a3439d6a56c8eee3636b3c1f5ba615b233ba Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35144 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/mem.c b/crypto/mem.c index a06061b..6af532e 100644 --- a/crypto/mem.c +++ b/crypto/mem.c
@@ -153,6 +153,10 @@ #endif // !OPENSSL_NO_ASM } +void OPENSSL_clear_free(void *ptr, size_t unused) { + OPENSSL_free(ptr); +} + int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) { const uint8_t *a = in_a; const uint8_t *b = in_b;
diff --git a/include/openssl/mem.h b/include/openssl/mem.h index 4e1c2ca..2e25f52 100644 --- a/include/openssl/mem.h +++ b/include/openssl/mem.h
@@ -138,7 +138,7 @@ // OPENSSL_clear_free calls |OPENSSL_free|. BoringSSL automatically clears all // allocations on free, but we define |OPENSSL_clear_free| for compatibility. -#define OPENSSL_clear_free(ptr, len) OPENSSL_free(ptr) +OPENSSL_EXPORT void OPENSSL_clear_free(void *ptr, size_t len); #if defined(__cplusplus)