Convert OPENSSL_malloc stuff back to intrinsics, a few were missed
authorbeck <beck@openbsd.org>
Thu, 22 May 2014 21:56:02 +0000 (21:56 +0000)
committerbeck <beck@openbsd.org>
Thu, 22 May 2014 21:56:02 +0000 (21:56 +0000)
as new stuff was brought in.
ok miod@

lib/libcrypto/evp/e_aes.c
lib/libcrypto/evp/e_chacha20poly1305.c
lib/libcrypto/rsa/rsa_lib.c
lib/libssl/src/crypto/evp/e_aes.c
lib/libssl/src/crypto/evp/e_chacha20poly1305.c
lib/libssl/src/crypto/rsa/rsa_lib.c

index 4da61b8..2e81495 100644 (file)
@@ -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
index 75ff7f2..7e32668 100644 (file)
@@ -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
index a618d70..1ea5e7b 100644 (file)
@@ -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);
index 4da61b8..2e81495 100644 (file)
@@ -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
index 75ff7f2..7e32668 100644 (file)
@@ -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
index a618d70..1ea5e7b 100644 (file)
@@ -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);