mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Return early on failed key
init
This commit is contained in:
@ -8182,6 +8182,13 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wc_ecc_init(&key) != 0) {
|
||||||
|
/* Return early so we don't have to remember if init succeeded
|
||||||
|
* or not. */
|
||||||
|
mp_free(&a);
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (indent < 0) {
|
if (indent < 0) {
|
||||||
indent = 0;
|
indent = 0;
|
||||||
}
|
}
|
||||||
@ -8189,8 +8196,6 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
|||||||
indent = EVP_PKEY_PRINT_INDENT_MAX;
|
indent = EVP_PKEY_PRINT_INDENT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = wc_ecc_init(&key) == 0;
|
|
||||||
|
|
||||||
if (res == WOLFSSL_SUCCESS) {
|
if (res == WOLFSSL_SUCCESS) {
|
||||||
res = wc_EccPublicKeyDecode(pkey, &inOutIdx, &key, pkeySz) == 0;
|
res = wc_EccPublicKeyDecode(pkey, &inOutIdx, &key, pkeySz) == 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user