summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/evp/evp_enc.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2004-04-08 08:03:11 +0000
committermarkus <markus@openbsd.org>2004-04-08 08:03:11 +0000
commit6278d0304dd1b39e46a509fa3953ad2d0b67fb9d (patch)
treedbc442beb7920ec3d30578fe90f92fb8264f34e9 /lib/libcrypto/evp/evp_enc.c
parent-l can overwrite the path to the leases file, noticed by millert (diff)
downloadwireguard-openbsd-6278d0304dd1b39e46a509fa3953ad2d0b67fb9d.tar.xz
wireguard-openbsd-6278d0304dd1b39e46a509fa3953ad2d0b67fb9d.zip
merge 0.9.7d
Diffstat (limited to 'lib/libcrypto/evp/evp_enc.c')
-rw-r--r--lib/libcrypto/evp/evp_enc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libcrypto/evp/evp_enc.c b/lib/libcrypto/evp/evp_enc.c
index be0758a8796..8ea5aa935dd 100644
--- a/lib/libcrypto/evp/evp_enc.c
+++ b/lib/libcrypto/evp/evp_enc.c
@@ -148,7 +148,19 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp
#endif
ctx->cipher=cipher;
- ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
+ if (ctx->cipher->ctx_size)
+ {
+ ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
+ if (!ctx->cipher_data)
+ {
+ EVPerr(EVP_F_EVP_CIPHERINIT, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+ else
+ {
+ ctx->cipher_data = NULL;
+ }
ctx->key_len = cipher->key_len;
ctx->flags = 0;
if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)