diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/hmac/hm_pmeth.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c index 5ec86aa095..05eb1bf85d 100644 --- a/src/lib/libcrypto/hmac/hm_pmeth.c +++ b/src/lib/libcrypto/hmac/hm_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hm_pmeth.c,v 1.16 2023/11/29 21:35:57 tb Exp $ */ | 1 | /* $OpenBSD: hm_pmeth.c,v 1.17 2023/12/28 22:00:56 tb 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 2007. | 3 | * project 2007. |
| 4 | */ | 4 | */ |
| @@ -131,15 +131,22 @@ pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
| 131 | { | 131 | { |
| 132 | ASN1_OCTET_STRING *hkey = NULL; | 132 | ASN1_OCTET_STRING *hkey = NULL; |
| 133 | HMAC_PKEY_CTX *hctx = ctx->data; | 133 | HMAC_PKEY_CTX *hctx = ctx->data; |
| 134 | int ret = 0; | ||
| 134 | 135 | ||
| 135 | if (!hctx->ktmp.data) | 136 | if (hctx->ktmp.data == NULL) |
| 136 | return 0; | 137 | goto err; |
| 137 | hkey = ASN1_OCTET_STRING_dup(&hctx->ktmp); | 138 | if ((hkey = ASN1_OCTET_STRING_dup(&hctx->ktmp)) == NULL) |
| 138 | if (!hkey) | 139 | goto err; |
| 139 | return 0; | 140 | if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey)) |
| 140 | EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, hkey); | 141 | goto err; |
| 142 | hkey = NULL; | ||
| 141 | 143 | ||
| 142 | return 1; | 144 | ret = 1; |
| 145 | |||
| 146 | err: | ||
| 147 | ASN1_OCTET_STRING_free(hkey); | ||
| 148 | |||
| 149 | return ret; | ||
| 143 | } | 150 | } |
| 144 | 151 | ||
| 145 | static int | 152 | static int |
