forked from wolfSSL/wolfssl
Fixes for building with ATECC508A. Allow ECC check key to pass if slot numb is valid.
This commit is contained in:
@ -4707,8 +4707,11 @@ int wc_ecc_check_key(ecc_key* key)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#ifdef WOLFSSL_ATECC508A
|
||||
/* TODO: Implement equiv call to ATECC508A */
|
||||
err = BAD_COND_E;
|
||||
|
||||
if (key->slot == ATECC_INVALID_SLOT)
|
||||
return ECC_BAD_ARG_E;
|
||||
|
||||
err = 0; /* consider key check success on ECC508A */
|
||||
|
||||
#else
|
||||
|
||||
@ -5014,13 +5017,25 @@ static int wc_ecc_export_raw(ecc_key* key, byte* qx, word32* qxLen,
|
||||
*dLen = numLen;
|
||||
XMEMSET(d, 0, *dLen);
|
||||
|
||||
#ifdef WOLFSSL_ATECC508A
|
||||
/* TODO: Implement equiv call to ATECC508A */
|
||||
return BAD_COND_E;
|
||||
|
||||
#else
|
||||
|
||||
/* private key, d */
|
||||
err = mp_to_unsigned_bin(&key->k, d +
|
||||
(numLen - mp_unsigned_bin_size(&key->k)));
|
||||
if (err != MP_OKAY)
|
||||
return err;
|
||||
#endif /* WOLFSSL_ATECC508A */
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_ATECC508A
|
||||
/* TODO: Implement equiv call to ATECC508A */
|
||||
return BAD_COND_E;
|
||||
|
||||
#else
|
||||
/* public x component */
|
||||
err = mp_to_unsigned_bin(key->pubkey.x, qx +
|
||||
(numLen - mp_unsigned_bin_size(key->pubkey.x)));
|
||||
@ -5034,6 +5049,7 @@ static int wc_ecc_export_raw(ecc_key* key, byte* qx, word32* qxLen,
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
#endif /* WOLFSSL_ATECC508A */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1088,6 +1088,7 @@ int asn_test()
|
||||
return -1302;
|
||||
}
|
||||
if (now == 0) {
|
||||
printf("RTC/Time not set!\n");
|
||||
return -1303;
|
||||
}
|
||||
#endif
|
||||
@ -10664,6 +10665,7 @@ done:
|
||||
}
|
||||
#endif /* HAVE_ECC_KEY_IMPORT && HAVE_ECC_KEY_EXPORT */
|
||||
|
||||
#ifndef WOLFSSL_ATECC508A
|
||||
#ifdef HAVE_ECC_KEY_IMPORT
|
||||
static int ecc_mulmod_test(ecc_key* key1)
|
||||
{
|
||||
@ -10705,7 +10707,6 @@ done:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_ATECC508A
|
||||
static int ecc_ssh_test(ecc_key* key)
|
||||
{
|
||||
int ret;
|
||||
@ -10757,16 +10758,16 @@ static int ecc_def_curve_test(WC_RNG *rng)
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
#endif
|
||||
#ifndef WOLFSSL_ATECC508A
|
||||
#ifdef HAVE_ECC_KEY_IMPORT
|
||||
ret = ecc_mulmod_test(&key);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
#endif
|
||||
#ifndef WOLFSSL_ATECC508A
|
||||
ret = ecc_ssh_test(&key);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
#endif
|
||||
#endif /* WOLFSSL_ATECC508A */
|
||||
done:
|
||||
wc_ecc_free(&key);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user