diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 14875310ad..25e69f9ae7 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_aes.c,v 1.36 2019/04/14 17:26:27 jsing Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.37 2019/04/14 17:27:42 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -829,11 +829,10 @@ aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | |||
829 | EVP_CIPHER_CTX *out = ptr; | 829 | EVP_CIPHER_CTX *out = ptr; |
830 | EVP_AES_GCM_CTX *gctx_out = out->cipher_data; | 830 | EVP_AES_GCM_CTX *gctx_out = out->cipher_data; |
831 | 831 | ||
832 | if (gctx->iv == c->iv) | 832 | if (gctx->iv == c->iv) { |
833 | gctx_out->iv = out->iv; | 833 | gctx_out->iv = out->iv; |
834 | else { | 834 | } else { |
835 | gctx_out->iv = malloc(gctx->ivlen); | 835 | if ((gctx_out->iv = calloc(1, gctx->ivlen)) == NULL) |
836 | if (!gctx_out->iv) | ||
837 | return 0; | 836 | return 0; |
838 | memcpy(gctx_out->iv, gctx->iv, gctx->ivlen); | 837 | memcpy(gctx_out->iv, gctx->iv, gctx->ivlen); |
839 | } | 838 | } |
@@ -1381,8 +1380,7 @@ aead_aes_gcm_init(EVP_AEAD_CTX *ctx, const unsigned char *key, size_t key_len, | |||
1381 | return 0; | 1380 | return 0; |
1382 | } | 1381 | } |
1383 | 1382 | ||
1384 | gcm_ctx = malloc(sizeof(struct aead_aes_gcm_ctx)); | 1383 | if ((gcm_ctx = calloc(1, sizeof(struct aead_aes_gcm_ctx))) == NULL) |
1385 | if (gcm_ctx == NULL) | ||
1386 | return 0; | 1384 | return 0; |
1387 | 1385 | ||
1388 | #ifdef AESNI_CAPABLE | 1386 | #ifdef AESNI_CAPABLE |