Stub out the OpenSSL secure heap.
OpenSSL added a separate "secure heap" to allocate some data in a different heap. We don't implement this, so just act as if initializing it always fails. Node now expects these functions to be available. Change-Id: I4c57c807c51681b16ec3a60e9674583b193358c4 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/54309 Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com>
This commit is contained in:
committed by
Boringssl LUCI CQ
parent
c990cf1834
commit
8a1542fc41
@@ -81,6 +81,8 @@ BIGNUM *BN_new(void) {
|
||||
return bn;
|
||||
}
|
||||
|
||||
BIGNUM *BN_secure_new(void) { return BN_new(); }
|
||||
|
||||
void BN_init(BIGNUM *bn) {
|
||||
OPENSSL_memset(bn, 0, sizeof(BIGNUM));
|
||||
}
|
||||
|
||||
@@ -243,6 +243,18 @@ void OPENSSL_clear_free(void *ptr, size_t unused) {
|
||||
OPENSSL_free(ptr);
|
||||
}
|
||||
|
||||
int CRYPTO_secure_malloc_init(size_t size, size_t min_size) { return 0; }
|
||||
|
||||
int CRYPTO_secure_malloc_initialized(void) { return 0; }
|
||||
|
||||
size_t CRYPTO_secure_used(void) { return 0; }
|
||||
|
||||
void *OPENSSL_secure_malloc(size_t size) { return OPENSSL_malloc(size); }
|
||||
|
||||
void OPENSSL_secure_clear_free(void *ptr, size_t len) {
|
||||
OPENSSL_clear_free(ptr, len);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -967,6 +967,9 @@ OPENSSL_EXPORT int BN_bn2binpad(const BIGNUM *in, uint8_t *out, int len);
|
||||
// conservative.)
|
||||
#define BN_prime_checks BN_prime_checks_for_validation
|
||||
|
||||
// BN_secure_new calls |BN_new|.
|
||||
OPENSSL_EXPORT BIGNUM *BN_secure_new(void);
|
||||
|
||||
|
||||
// Private functions
|
||||
|
||||
|
||||
@@ -164,6 +164,21 @@ OPENSSL_EXPORT void CRYPTO_free(void *ptr, const char *file, int line);
|
||||
// allocations on free, but we define |OPENSSL_clear_free| for compatibility.
|
||||
OPENSSL_EXPORT void OPENSSL_clear_free(void *ptr, size_t len);
|
||||
|
||||
// CRYPTO_secure_malloc_init returns zero.
|
||||
OPENSSL_EXPORT int CRYPTO_secure_malloc_init(size_t size, size_t min_size);
|
||||
|
||||
// CRYPTO_secure_malloc_initialized returns zero.
|
||||
OPENSSL_EXPORT int CRYPTO_secure_malloc_initialized(void);
|
||||
|
||||
// CRYPTO_secure_used returns zero.
|
||||
OPENSSL_EXPORT size_t CRYPTO_secure_used(void);
|
||||
|
||||
// OPENSSL_secure_malloc calls |OPENSSL_malloc|.
|
||||
OPENSSL_EXPORT void *OPENSSL_secure_malloc(size_t size);
|
||||
|
||||
// OPENSSL_secure_clear_free calls |OPENSSL_clear_free|.
|
||||
OPENSSL_EXPORT void OPENSSL_secure_clear_free(void *ptr, size_t len);
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern C
|
||||
|
||||
Reference in New Issue
Block a user