mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
wolfcrypt/src/evp.c: tweak to silence gcc -Wmaybe-uninitialized.
This commit is contained in:
@ -2140,7 +2140,6 @@ static int wolfSSL_evp_digest_pk_init(WOLFSSL_EVP_MD_CTX *ctx,
|
|||||||
if (pkey->type == EVP_PKEY_HMAC) {
|
if (pkey->type == EVP_PKEY_HMAC) {
|
||||||
int hashType;
|
int hashType;
|
||||||
const unsigned char* key;
|
const unsigned char* key;
|
||||||
size_t keySz;
|
|
||||||
|
|
||||||
if (XSTRNCMP(type, "SHA256", 6) == 0) {
|
if (XSTRNCMP(type, "SHA256", 6) == 0) {
|
||||||
hashType = WC_SHA256;
|
hashType = WC_SHA256;
|
||||||
@ -2174,13 +2173,17 @@ static int wolfSSL_evp_digest_pk_init(WOLFSSL_EVP_MD_CTX *ctx,
|
|||||||
else
|
else
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
key = wolfSSL_EVP_PKEY_get0_hmac(pkey, &keySz);
|
{
|
||||||
|
size_t keySz = 0;
|
||||||
|
|
||||||
if (wc_HmacInit(&ctx->hash.hmac, NULL, INVALID_DEVID) != 0)
|
key = wolfSSL_EVP_PKEY_get0_hmac(pkey, &keySz);
|
||||||
return WOLFSSL_FAILURE;
|
|
||||||
|
|
||||||
if (wc_HmacSetKey(&ctx->hash.hmac, hashType, key, (word32)keySz) != 0)
|
if (wc_HmacInit(&ctx->hash.hmac, NULL, INVALID_DEVID) != 0)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
|
||||||
|
if (wc_HmacSetKey(&ctx->hash.hmac, hashType, key, (word32)keySz) != 0)
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->isHMAC = 1;
|
ctx->isHMAC = 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user