summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp_enc.c')
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index 71ed70a215..bb49e28267 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_enc.c,v 1.42 2019/04/14 16:46:26 jsing Exp $ */ 1/* $OpenBSD: evp_enc.c,v 1.43 2019/04/14 17:16:57 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -144,8 +144,8 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
144 144
145 ctx->cipher = cipher; 145 ctx->cipher = cipher;
146 if (ctx->cipher->ctx_size) { 146 if (ctx->cipher->ctx_size) {
147 ctx->cipher_data = malloc(ctx->cipher->ctx_size); 147 ctx->cipher_data = calloc(1, ctx->cipher->ctx_size);
148 if (!ctx->cipher_data) { 148 if (ctx->cipher_data == NULL) {
149 EVPerror(ERR_R_MALLOC_FAILURE); 149 EVPerror(ERR_R_MALLOC_FAILURE);
150 return 0; 150 return 0;
151 } 151 }
@@ -667,8 +667,8 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
667 memcpy(out, in, sizeof *out); 667 memcpy(out, in, sizeof *out);
668 668
669 if (in->cipher_data && in->cipher->ctx_size) { 669 if (in->cipher_data && in->cipher->ctx_size) {
670 out->cipher_data = malloc(in->cipher->ctx_size); 670 out->cipher_data = calloc(1, in->cipher->ctx_size);
671 if (!out->cipher_data) { 671 if (out->cipher_data == NULL) {
672 EVPerror(ERR_R_MALLOC_FAILURE); 672 EVPerror(ERR_R_MALLOC_FAILURE);
673 return 0; 673 return 0;
674 } 674 }