From fd292b1ae477373ee8e0123d5cd567f9be7451b2 Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Wed, 20 Dec 2017 14:45:46 -0700 Subject: [PATCH] check key for NULL in wc_ecc_import_private_key_ex() --- wolfcrypt/src/ecc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 95666c5c5..00706aca3 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -5315,15 +5315,15 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz, { int ret; + if (key == NULL || priv == NULL) + return BAD_FUNC_ARG; + /* public optional, NULL if only importing private */ if (pub != NULL) { ret = wc_ecc_import_x963_ex(pub, pubSz, key, curve_id); key->type = ECC_PRIVATEKEY; } else { - if (key == NULL || priv == NULL) - return BAD_FUNC_ARG; - /* make sure required variables are reset */ wc_ecc_reset(key); @@ -5335,7 +5335,6 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz, if (ret != 0) return ret; - #ifdef WOLFSSL_ATECC508A /* TODO: Implement equiv call to ATECC508A */ return BAD_COND_E;