X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fhmac%2Fhm_ameth.c;h=98e73e937ff8157fdb23bdf13f27ccd116b1ddc6;hp=20abe4f0871555a00e6cc50ad5816fefd8ef9127;hb=b7b8e948014d93e1eb6d954d0799ae68ab0e068b;hpb=3f6c7691870d1cd2ad0e0c83638cef3f35a0b548 diff --git a/crypto/hmac/hm_ameth.c b/crypto/hmac/hm_ameth.c index 20abe4f087..98e73e937f 100644 --- a/crypto/hmac/hm_ameth.c +++ b/crypto/hmac/hm_ameth.c @@ -75,7 +75,7 @@ static int hmac_size(const EVP_PKEY *pkey) static void hmac_key_free(EVP_PKEY *pkey) { - ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr; + ASN1_OCTET_STRING *os = EVP_PKEY_get0(pkey); if (os) { if (os->data) OPENSSL_cleanse(os->data, os->length); @@ -107,7 +107,7 @@ static int old_hmac_decode(EVP_PKEY *pkey, { ASN1_OCTET_STRING *os; os = ASN1_OCTET_STRING_new(); - if (!os || !ASN1_OCTET_STRING_set(os, *pder, derlen)) + if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) goto err; if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) goto err; @@ -121,7 +121,7 @@ static int old_hmac_decode(EVP_PKEY *pkey, static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) { int inc; - ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr; + ASN1_OCTET_STRING *os = EVP_PKEY_get0(pkey); if (pder) { if (!*pder) { *pder = OPENSSL_malloc(os->length);