From be318abbc20d120b543d993d937ad2dbe67a2a08 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 24 Aug 2018 16:10:51 -0700 Subject: [PATCH] Fixes for building with `WOLFSSL_ATECC508A` with latest atca. --- wolfcrypt/src/port/atmel/atmel.c | 8 ++++---- wolfssl/wolfcrypt/port/atmel/atmel.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wolfcrypt/src/port/atmel/atmel.c b/wolfcrypt/src/port/atmel/atmel.c index c5e5d95af..e45a716ba 100644 --- a/wolfcrypt/src/port/atmel/atmel.c +++ b/wolfcrypt/src/port/atmel/atmel.c @@ -92,7 +92,7 @@ int atmel_get_random_number(uint32_t count, uint8_t* rand_out) XMEMCPY(&rand_out[i], rng_buffer, copy_count); i += copy_count; } - atcab_printbin_label((const uint8_t*)"\r\nRandom Number", rand_out, count); + atcab_printbin_label((const char*)"\r\nRandom Number", rand_out, count); #else // TODO: Use on-board TRNG #endif @@ -156,7 +156,7 @@ void atmel_ecc_free(int slot) /** * \brief Give enc key to read pms. */ -static int atmel_set_enc_key(uint8_t* enckey, int16_t keysize) +static ATCA_STATUS atmel_get_enc_key(uint8_t* enckey, int16_t keysize) { if (enckey == NULL || keysize != ATECC_KEY_SIZE) { return -1; @@ -177,13 +177,13 @@ static int atmel_init_enc_key(void) uint8_t read_key[ATECC_KEY_SIZE] = { 0 }; XMEMSET(read_key, 0xFF, sizeof(read_key)); - ret = atcab_write_bytes_slot(TLS_SLOT_ENC_PARENT, 0, read_key, sizeof(read_key)); + ret = atcatls_set_enckey(read_key, TLS_SLOT_ENC_PARENT, 0); if (ret != ATCA_SUCCESS) { WOLFSSL_MSG("Failed to write key"); return -1; } - ret = atcatlsfn_set_get_enckey(atmel_set_enc_key); + ret = atcatlsfn_set_get_enckey(atmel_get_enc_key); if (ret != ATCA_SUCCESS) { WOLFSSL_MSG("Failed to set enckey"); return -1; diff --git a/wolfssl/wolfcrypt/port/atmel/atmel.h b/wolfssl/wolfcrypt/port/atmel/atmel.h index d021c6f04..209ab55bb 100644 --- a/wolfssl/wolfcrypt/port/atmel/atmel.h +++ b/wolfssl/wolfcrypt/port/atmel/atmel.h @@ -26,7 +26,6 @@ #include #include -#include #include #ifdef WOLFSSL_ATECC508A @@ -71,6 +70,7 @@ long atmel_get_curr_time_and_date(long* tm); int atmel_ecc_alloc(void); void atmel_ecc_free(int slot); +#include #ifdef HAVE_PK_CALLBACKS int atcatls_create_key_cb(WOLFSSL* ssl, ecc_key* key, word32 keySz,