summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pvkfmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pem/pvkfmt.c')
-rw-r--r--src/lib/libcrypto/pem/pvkfmt.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/libcrypto/pem/pvkfmt.c b/src/lib/libcrypto/pem/pvkfmt.c
index 2009c9db80..025381bcc0 100644
--- a/src/lib/libcrypto/pem/pvkfmt.c
+++ b/src/lib/libcrypto/pem/pvkfmt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pvkfmt.c,v 1.12 2014/10/22 13:02:04 jsing Exp $ */ 1/* $OpenBSD: pvkfmt.c,v 1.13 2015/05/15 11:00:14 jsg Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -731,17 +731,16 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen,
731 inlen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u); 731 inlen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u);
732 if (inlen <= 0) { 732 if (inlen <= 0) {
733 PEMerr(PEM_F_DO_PVK_BODY, PEM_R_BAD_PASSWORD_READ); 733 PEMerr(PEM_F_DO_PVK_BODY, PEM_R_BAD_PASSWORD_READ);
734 return NULL; 734 goto err;
735 } 735 }
736 enctmp = malloc(keylen + 8); 736 enctmp = malloc(keylen + 8);
737 if (!enctmp) { 737 if (!enctmp) {
738 PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); 738 PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE);
739 return NULL; 739 goto err;
740 } 740 }
741 if (!derive_pvk_key(keybuf, p, saltlen, (unsigned char *)psbuf, 741 if (!derive_pvk_key(keybuf, p, saltlen, (unsigned char *)psbuf,
742 inlen)) { 742 inlen)) {
743 free(enctmp); 743 goto err;
744 return NULL;
745 } 744 }
746 p += saltlen; 745 p += saltlen;
747 /* Copy BLOBHEADER across, decrypt rest */ 746 /* Copy BLOBHEADER across, decrypt rest */
@@ -749,8 +748,7 @@ do_PVK_body(const unsigned char **in, unsigned int saltlen,
749 p += 8; 748 p += 8;
750 if (keylen < 8) { 749 if (keylen < 8) {
751 PEMerr(PEM_F_DO_PVK_BODY, PEM_R_PVK_TOO_SHORT); 750 PEMerr(PEM_F_DO_PVK_BODY, PEM_R_PVK_TOO_SHORT);
752 free(enctmp); 751 goto err;
753 return NULL;
754 } 752 }
755 inlen = keylen - 8; 753 inlen = keylen - 8;
756 q = enctmp + 8; 754 q = enctmp + 8;