mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
check key for NULL in wc_ecc_import_private_key_ex()
This commit is contained in:
@@ -5315,15 +5315,15 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (key == NULL || priv == NULL)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
/* public optional, NULL if only importing private */
|
/* public optional, NULL if only importing private */
|
||||||
if (pub != NULL) {
|
if (pub != NULL) {
|
||||||
ret = wc_ecc_import_x963_ex(pub, pubSz, key, curve_id);
|
ret = wc_ecc_import_x963_ex(pub, pubSz, key, curve_id);
|
||||||
key->type = ECC_PRIVATEKEY;
|
key->type = ECC_PRIVATEKEY;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (key == NULL || priv == NULL)
|
|
||||||
return BAD_FUNC_ARG;
|
|
||||||
|
|
||||||
/* make sure required variables are reset */
|
/* make sure required variables are reset */
|
||||||
wc_ecc_reset(key);
|
wc_ecc_reset(key);
|
||||||
|
|
||||||
@@ -5335,7 +5335,6 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
#ifdef WOLFSSL_ATECC508A
|
#ifdef WOLFSSL_ATECC508A
|
||||||
/* TODO: Implement equiv call to ATECC508A */
|
/* TODO: Implement equiv call to ATECC508A */
|
||||||
return BAD_COND_E;
|
return BAD_COND_E;
|
||||||
|
Reference in New Issue
Block a user