diff options
author | beck <> | 2014-05-22 21:56:02 +0000 |
---|---|---|
committer | beck <> | 2014-05-22 21:56:02 +0000 |
commit | ffb0c4aec230128ccb49ed44ab8bbaa5558018a0 (patch) | |
tree | ad01380ef0f2b2de9b4b3d5c76c4e3dcd7fdccdd /src | |
parent | c34fac2dfaf2da90889ed845a5139c916868eea2 (diff) | |
download | openbsd-ffb0c4aec230128ccb49ed44ab8bbaa5558018a0.tar.gz openbsd-ffb0c4aec230128ccb49ed44ab8bbaa5558018a0.tar.bz2 openbsd-ffb0c4aec230128ccb49ed44ab8bbaa5558018a0.zip |
Convert OPENSSL_malloc stuff back to intrinsics, a few were missed
as new stuff was brought in.
ok miod@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/e_chacha20poly1305.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/e_aes.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa_lib.c | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 4da61b8f62..2e81495e5f 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/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, | |||
1294 | return 0; | 1294 | return 0; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | gcm_ctx = OPENSSL_malloc(sizeof(struct aead_aes_gcm_ctx)); | 1297 | gcm_ctx = malloc(sizeof(struct aead_aes_gcm_ctx)); |
1298 | if (gcm_ctx == NULL) | 1298 | if (gcm_ctx == NULL) |
1299 | return 0; | 1299 | return 0; |
1300 | 1300 | ||
@@ -1321,7 +1321,7 @@ aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx) | |||
1321 | { | 1321 | { |
1322 | struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; | 1322 | struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; |
1323 | 1323 | ||
1324 | OPENSSL_free(gcm_ctx); | 1324 | free(gcm_ctx); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | static ssize_t | 1327 | static ssize_t |
diff --git a/src/lib/libcrypto/evp/e_chacha20poly1305.c b/src/lib/libcrypto/evp/e_chacha20poly1305.c index 75ff7f209c..7e32668b7f 100644 --- a/src/lib/libcrypto/evp/e_chacha20poly1305.c +++ b/src/lib/libcrypto/evp/e_chacha20poly1305.c | |||
@@ -85,7 +85,7 @@ aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const unsigned char *key, | |||
85 | if (key_len != sizeof(c20_ctx->key)) | 85 | if (key_len != sizeof(c20_ctx->key)) |
86 | return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ | 86 | return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ |
87 | 87 | ||
88 | c20_ctx = OPENSSL_malloc(sizeof(struct aead_chacha20_poly1305_ctx)); | 88 | c20_ctx = malloc(sizeof(struct aead_chacha20_poly1305_ctx)); |
89 | if (c20_ctx == NULL) | 89 | if (c20_ctx == NULL) |
90 | return 0; | 90 | return 0; |
91 | 91 | ||
@@ -101,7 +101,7 @@ aead_chacha20_poly1305_cleanup(EVP_AEAD_CTX *ctx) | |||
101 | { | 101 | { |
102 | struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; | 102 | struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; |
103 | OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); | 103 | OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); |
104 | OPENSSL_free(c20_ctx); | 104 | free(c20_ctx); |
105 | } | 105 | } |
106 | 106 | ||
107 | static void | 107 | static void |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index a618d70f92..1ea5e7bc64 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -229,7 +229,7 @@ void RSA_free(RSA *r) | |||
229 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); | 229 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); |
230 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | 230 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); |
231 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | 231 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); |
232 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | 232 | free(r->bignum_data); |
233 | free(r); | 233 | free(r); |
234 | } | 234 | } |
235 | 235 | ||
@@ -275,7 +275,7 @@ int RSA_memory_lock(RSA *r) | |||
275 | j=1; | 275 | j=1; |
276 | for (i=0; i<6; i++) | 276 | for (i=0; i<6; i++) |
277 | j+= (*t[i])->top; | 277 | j+= (*t[i])->top; |
278 | if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) | 278 | if ((p=reallocarray(NULL, (off+j), sizeof(BN_ULONG))) == NULL) |
279 | { | 279 | { |
280 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); | 280 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); |
281 | return(0); | 281 | return(0); |
diff --git a/src/lib/libssl/src/crypto/evp/e_aes.c b/src/lib/libssl/src/crypto/evp/e_aes.c index 4da61b8f62..2e81495e5f 100644 --- a/src/lib/libssl/src/crypto/evp/e_aes.c +++ b/src/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, | |||
1294 | return 0; | 1294 | return 0; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | gcm_ctx = OPENSSL_malloc(sizeof(struct aead_aes_gcm_ctx)); | 1297 | gcm_ctx = malloc(sizeof(struct aead_aes_gcm_ctx)); |
1298 | if (gcm_ctx == NULL) | 1298 | if (gcm_ctx == NULL) |
1299 | return 0; | 1299 | return 0; |
1300 | 1300 | ||
@@ -1321,7 +1321,7 @@ aead_aes_gcm_cleanup(EVP_AEAD_CTX *ctx) | |||
1321 | { | 1321 | { |
1322 | struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; | 1322 | struct aead_aes_gcm_ctx *gcm_ctx = ctx->aead_state; |
1323 | 1323 | ||
1324 | OPENSSL_free(gcm_ctx); | 1324 | free(gcm_ctx); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | static ssize_t | 1327 | static ssize_t |
diff --git a/src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c b/src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c index 75ff7f209c..7e32668b7f 100644 --- a/src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c +++ b/src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c | |||
@@ -85,7 +85,7 @@ aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const unsigned char *key, | |||
85 | if (key_len != sizeof(c20_ctx->key)) | 85 | if (key_len != sizeof(c20_ctx->key)) |
86 | return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ | 86 | return 0; /* internal error - EVP_AEAD_CTX_init should catch this. */ |
87 | 87 | ||
88 | c20_ctx = OPENSSL_malloc(sizeof(struct aead_chacha20_poly1305_ctx)); | 88 | c20_ctx = malloc(sizeof(struct aead_chacha20_poly1305_ctx)); |
89 | if (c20_ctx == NULL) | 89 | if (c20_ctx == NULL) |
90 | return 0; | 90 | return 0; |
91 | 91 | ||
@@ -101,7 +101,7 @@ aead_chacha20_poly1305_cleanup(EVP_AEAD_CTX *ctx) | |||
101 | { | 101 | { |
102 | struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; | 102 | struct aead_chacha20_poly1305_ctx *c20_ctx = ctx->aead_state; |
103 | OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); | 103 | OPENSSL_cleanse(c20_ctx->key, sizeof(c20_ctx->key)); |
104 | OPENSSL_free(c20_ctx); | 104 | free(c20_ctx); |
105 | } | 105 | } |
106 | 106 | ||
107 | static void | 107 | static void |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_lib.c b/src/lib/libssl/src/crypto/rsa/rsa_lib.c index a618d70f92..1ea5e7bc64 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_lib.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_lib.c | |||
@@ -229,7 +229,7 @@ void RSA_free(RSA *r) | |||
229 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); | 229 | if (r->iqmp != NULL) BN_clear_free(r->iqmp); |
230 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); | 230 | if (r->blinding != NULL) BN_BLINDING_free(r->blinding); |
231 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); | 231 | if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding); |
232 | if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data); | 232 | free(r->bignum_data); |
233 | free(r); | 233 | free(r); |
234 | } | 234 | } |
235 | 235 | ||
@@ -275,7 +275,7 @@ int RSA_memory_lock(RSA *r) | |||
275 | j=1; | 275 | j=1; |
276 | for (i=0; i<6; i++) | 276 | for (i=0; i<6; i++) |
277 | j+= (*t[i])->top; | 277 | j+= (*t[i])->top; |
278 | if ((p=OPENSSL_malloc_locked((off+j)*sizeof(BN_ULONG))) == NULL) | 278 | if ((p=reallocarray(NULL, (off+j), sizeof(BN_ULONG))) == NULL) |
279 | { | 279 | { |
280 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); | 280 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); |
281 | return(0); | 281 | return(0); |