Merge pull request #2172 from dgarske/atecc

Fixes for ATECC support
This commit is contained in:
John Safranek
2019-03-28 10:36:54 -07:00
committed by GitHub
4 changed files with 17 additions and 4 deletions

View File

@ -14924,7 +14924,7 @@ static int test_wc_ecc_verify_hash_ex (void)
int ret = 0; int ret = 0;
#if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN) && defined(WOLFSSL_PUBLIC_MP) \ #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; ecc_key key;
WC_RNG rng; WC_RNG rng;
mp_int r; 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); err = atmel_ecc_create_key(key->slot, key->pubkey_raw);
/* populate key->pubkey */ /* 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, err = mp_read_unsigned_bin(key->pubkey.x, key->pubkey_raw,
ECC_MAX_CRYPTO_HW_SIZE); 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, err = mp_read_unsigned_bin(key->pubkey.y,
key->pubkey_raw + ECC_MAX_CRYPTO_HW_SIZE, key->pubkey_raw + ECC_MAX_CRYPTO_HW_SIZE,
ECC_MAX_CRYPTO_HW_SIZE); ECC_MAX_CRYPTO_HW_SIZE);

View File

@ -105,7 +105,9 @@ int atmel_get_random_number(uint32_t count, uint8_t* rand_out)
XMEMCPY(&rand_out[i], rng_buffer, copy_count); XMEMCPY(&rand_out[i], rng_buffer, copy_count);
i += copy_count; i += copy_count;
} }
#ifdef ATCAPRINTF
atcab_printbin_label((const char*)"\r\nRandom Number", rand_out, count); atcab_printbin_label((const char*)"\r\nRandom Number", rand_out, count);
#endif
#else #else
/* TODO: Use on-board TRNG */ /* TODO: Use on-board TRNG */
#endif #endif

View File

@ -70,7 +70,6 @@ noinst_HEADERS+= \
wolfssl/wolfcrypt/port/ti/ti-ccm.h \ wolfssl/wolfcrypt/port/ti/ti-ccm.h \
wolfssl/wolfcrypt/port/nrf51.h \ wolfssl/wolfcrypt/port/nrf51.h \
wolfssl/wolfcrypt/port/nxp/ksdk_port.h \ wolfssl/wolfcrypt/port/nxp/ksdk_port.h \
wolfssl/wolfcrypt/port/atmel/atmel.h \
wolfssl/wolfcrypt/port/xilinx/xil-sha3.h \ wolfssl/wolfcrypt/port/xilinx/xil-sha3.h \
wolfssl/wolfcrypt/port/caam/caam_driver.h \ wolfssl/wolfcrypt/port/caam/caam_driver.h \
wolfssl/wolfcrypt/port/caam/wolfcaam.h \ wolfssl/wolfcrypt/port/caam/wolfcaam.h \
@ -79,6 +78,10 @@ noinst_HEADERS+= \
wolfssl/wolfcrypt/port/st/stsafe.h \ wolfssl/wolfcrypt/port/st/stsafe.h \
wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h
if BUILD_CRYPTOAUTHLIB
nobase_include_HEADERS+= wolfssl/wolfcrypt/port/atmel/atmel.h
endif
if BUILD_AFALG if BUILD_AFALG
nobase_include_HEADERS+= wolfssl/wolfcrypt/port/af_alg/afalg_hash.h nobase_include_HEADERS+= wolfssl/wolfcrypt/port/af_alg/afalg_hash.h
nobase_include_HEADERS+= wolfssl/wolfcrypt/port/af_alg/wc_afalg.h nobase_include_HEADERS+= wolfssl/wolfcrypt/port/af_alg/wc_afalg.h