From e0e62b2e065bdc8ccb465a3173a73de7631526e9 Mon Sep 17 00:00:00 2001 From: beck Date: Thu, 22 May 2014 21:56:02 +0000 Subject: [PATCH] Convert OPENSSL_malloc stuff back to intrinsics, a few were missed as new stuff was brought in. ok miod@ --- lib/libcrypto/evp/e_aes.c | 4 ++-- lib/libcrypto/evp/e_chacha20poly1305.c | 4 ++-- lib/libcrypto/rsa/rsa_lib.c | 4 ++-- lib/libssl/src/crypto/evp/e_aes.c | 4 ++-- lib/libssl/src/crypto/evp/e_chacha20poly1305.c | 4 ++-- lib/libssl/src/crypto/rsa/rsa_lib.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/libcrypto/evp/e_aes.c b/lib/libcrypto/evp/e_aes.c index 4da61b8f626..2e81495e5f4 100644 --- a/lib/libcrypto/evp/e_aes.c +++ b/lib/libcrypto/evp/e_aes.c @@ -1294,7 +1294,7 @@ aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const unsigned char *key, size_t key_len, return 0; } - gcm_ctx = OPENSSL_malloc(sizeof(struct aead_aes_gcm_ctx)); + gcm_ctx = malloc(sizeof(struct aead_aes_gcm_ctx)); if (gcm_ctx == NULL) return 0; @@ -1321,7 +1321,7 @@ aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx) { struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; - OPENSSL_free(gcm_ctx); + free(gcm_ctx); } static ssize_t diff --git a/lib/libcrypto/evp/e_chacha20poly1305.c b/lib/libcrypto/evp/e_chacha20poly1305.c index 75ff7f209cc..7e32668b7fc 100644 --- a/lib/libcrypto/evp/e_chacha20poly1305.c +++ b/lib/libcrypto/evp/e_chacha20poly1305.c @@ -85,7 +85,7 @@ aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const unsigned char *key, if (key_len != sizeof(c20_ctx->key)) return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ - c20_ctx = OPENSSL_malloc(sizeof(struct aead_chacha20_poly1305_ctx)); + c20_ctx = malloc(sizeof(struct aead_chacha20_poly1305_ctx)); if (c20_ctx == NULL) return 0; @@ -101,7 +101,7 @@ aead_chacha20_poly1305_cleanup(EVP_AEAD_CTX *ctx) { struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); - OPENSSL_free(c20_ctx); + free(c20_ctx); } static void diff --git a/lib/libcrypto/rsa/rsa_lib.c b/lib/libcrypto/rsa/rsa_lib.c index a618d70f92c..1ea5e7bc64e 100644 --- a/lib/libcrypto/rsa/rsa_lib.c +++ b/lib/libcrypto/rsa/rsa_lib.c @@ -229,7 +229,7 @@ void RSA_free(RSA *r) if (r->iqmp != NULL) BN_clear_free(r->iqmp); if (r->blinding != NULL) BN_BLINDING_free(r->blinding); if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); - if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); + free(r->bignum_data); free(r); } @@ -275,7 +275,7 @@ int RSA_memory_lock(RSA *r) j=1; for (i=0; i<6; i++) j+= (*t[i])->top; - if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) + if ((p=reallocarray(NULL, (off+j), sizeof(BN_ULONG))) == NULL) { RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); return(0); diff --git a/lib/libssl/src/crypto/evp/e_aes.c b/lib/libssl/src/crypto/evp/e_aes.c index 4da61b8f626..2e81495e5f4 100644 --- a/lib/libssl/src/crypto/evp/e_aes.c +++ b/lib/libssl/src/crypto/evp/e_aes.c @@ -1294,7 +1294,7 @@ aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const unsigned char *key, size_t key_len, return 0; } - gcm_ctx = OPENSSL_malloc(sizeof(struct aead_aes_gcm_ctx)); + gcm_ctx = malloc(sizeof(struct aead_aes_gcm_ctx)); if (gcm_ctx == NULL) return 0; @@ -1321,7 +1321,7 @@ aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx) { struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; - OPENSSL_free(gcm_ctx); + free(gcm_ctx); } static ssize_t diff --git a/lib/libssl/src/crypto/evp/e_chacha20poly1305.c b/lib/libssl/src/crypto/evp/e_chacha20poly1305.c index 75ff7f209cc..7e32668b7fc 100644 --- a/lib/libssl/src/crypto/evp/e_chacha20poly1305.c +++ b/lib/libssl/src/crypto/evp/e_chacha20poly1305.c @@ -85,7 +85,7 @@ aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const unsigned char *key, if (key_len != sizeof(c20_ctx->key)) return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ - c20_ctx = OPENSSL_malloc(sizeof(struct aead_chacha20_poly1305_ctx)); + c20_ctx = malloc(sizeof(struct aead_chacha20_poly1305_ctx)); if (c20_ctx == NULL) return 0; @@ -101,7 +101,7 @@ aead_chacha20_poly1305_cleanup(EVP_AEAD_CTX *ctx) { struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); - OPENSSL_free(c20_ctx); + free(c20_ctx); } static void diff --git a/lib/libssl/src/crypto/rsa/rsa_lib.c b/lib/libssl/src/crypto/rsa/rsa_lib.c index a618d70f92c..1ea5e7bc64e 100644 --- a/lib/libssl/src/crypto/rsa/rsa_lib.c +++ b/lib/libssl/src/crypto/rsa/rsa_lib.c @@ -229,7 +229,7 @@ void RSA_free(RSA *r) if (r->iqmp != NULL) BN_clear_free(r->iqmp); if (r->blinding != NULL) BN_BLINDING_free(r->blinding); if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); - if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); + free(r->bignum_data); free(r); } @@ -275,7 +275,7 @@ int RSA_memory_lock(RSA *r) j=1; for (i=0; i<6; i++) j+= (*t[i])->top; - if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) + if ((p=reallocarray(NULL, (off+j), sizeof(BN_ULONG))) == NULL) { RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); return(0); -- 2.20.1