diff options
author | 2016-11-05 13:02:34 +0000 | |
---|---|---|
committer | 2016-11-05 13:02:34 +0000 | |
commit | f90f52ab893a27d8233f0d27c07b228af6f82f0f (patch) | |
tree | ab975d6dc7ea107b704468231524d9aecdf7ec18 | |
parent | Set PROG so that the binary correctly gets recompiled when the libraries (diff) | |
download | wireguard-openbsd-f90f52ab893a27d8233f0d27c07b228af6f82f0f.tar.xz wireguard-openbsd-f90f52ab893a27d8233f0d27c07b228af6f82f0f.zip |
Do not leak the ressources possibly allocated by EVP_MD_CTX_init() in the
trivial error path of PKCS12_key_gen_uni().
ok beck@ jsing@
-rw-r--r-- | lib/libcrypto/pkcs12/p12_key.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libcrypto/pkcs12/p12_key.c b/lib/libcrypto/pkcs12/p12_key.c index 38f8a8194c7..891f764c232 100644 --- a/lib/libcrypto/pkcs12/p12_key.c +++ b/lib/libcrypto/pkcs12/p12_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p12_key.c,v 1.23 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: p12_key.c,v 1.24 2016/11/05 13:02:34 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -107,11 +107,12 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ EVP_MD_CTX ctx; - EVP_MD_CTX_init(&ctx); v = EVP_MD_block_size(md_type); u = EVP_MD_size(md_type); if (u < 0) return 0; + + EVP_MD_CTX_init(&ctx); D = malloc(v); Ai = malloc(u); B = malloc(v + 1); |