summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libssl/src')
-rw-r--r--lib/libssl/src/crypto/hmac/hm_ameth.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/libssl/src/crypto/hmac/hm_ameth.c b/lib/libssl/src/crypto/hmac/hm_ameth.c
index f4fa6f4bc34..da3471c4fd4 100644
--- a/lib/libssl/src/crypto/hmac/hm_ameth.c
+++ b/lib/libssl/src/crypto/hmac/hm_ameth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hm_ameth.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: hm_ameth.c,v 1.9 2015/07/20 15:45:29 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2007.
*/
@@ -112,10 +112,17 @@ old_hmac_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen)
ASN1_OCTET_STRING *os;
os = ASN1_OCTET_STRING_new();
- if (!os || !ASN1_OCTET_STRING_set(os, *pder, derlen))
- return 0;
- EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os);
+ if (os == NULL)
+ goto err;
+ if (ASN1_OCTET_STRING_set(os, *pder, derlen) == 0)
+ goto err;
+ if (EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os) == 0)
+ goto err;
return 1;
+
+err:
+ ASN1_OCTET_STRING_free(os);
+ return 0;
}
static int
@@ -127,6 +134,8 @@ old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
if (pder) {
if (!*pder) {
*pder = malloc(os->length);
+ if (*pder == NULL)
+ return -1;
inc = 0;
} else
inc = 1;