Fix for build warning with x/y always true when not building with ALT_ECC_SIZE. Fix for build error with undefined `wc_ecc_sign_hash_ex` when building ATECC and `WOLFSSL_PUBLIC_MP`.

pull/2172/head
David Garske 2019-03-18 11:43:32 -07:00
parent e07e41d0aa
commit f66aa60385
2 changed files with 11 additions and 3 deletions

View File

@ -14924,7 +14924,7 @@ static int test_wc_ecc_verify_hash_ex (void)
int ret = 0;
#if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN) && defined(WOLFSSL_PUBLIC_MP) \
&& !defined(WC_NO_RNG)
&& !defined(WC_NO_RNG) && !defined(WOLFSSL_ATECC508A)
ecc_key key;
WC_RNG rng;
mp_int r;

View File

@ -3979,11 +3979,19 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
err = atmel_ecc_create_key(key->slot, key->pubkey_raw);
/* populate key->pubkey */
if (err == 0 && key->pubkey.x) {
if (err == 0
#ifdef ALT_ECC_SIZE
&& key->pubkey.x
#endif
) {
err = mp_read_unsigned_bin(key->pubkey.x, key->pubkey_raw,
ECC_MAX_CRYPTO_HW_SIZE);
}
if (err == 0 && key->pubkey.y) {
if (err == 0
#ifdef ALT_ECC_SIZE
&& key->pubkey.y
#endif
) {
err = mp_read_unsigned_bin(key->pubkey.y,
key->pubkey_raw + ECC_MAX_CRYPTO_HW_SIZE,
ECC_MAX_CRYPTO_HW_SIZE);