mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
Fixes for building with WOLFSSL_ATECC508A
with latest atca.
This commit is contained in:
@ -92,7 +92,7 @@ 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;
|
||||||
}
|
}
|
||||||
atcab_printbin_label((const uint8_t*)"\r\nRandom Number", rand_out, count);
|
atcab_printbin_label((const char*)"\r\nRandom Number", rand_out, count);
|
||||||
#else
|
#else
|
||||||
// TODO: Use on-board TRNG
|
// TODO: Use on-board TRNG
|
||||||
#endif
|
#endif
|
||||||
@ -156,7 +156,7 @@ void atmel_ecc_free(int slot)
|
|||||||
/**
|
/**
|
||||||
* \brief Give enc key to read pms.
|
* \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) {
|
if (enckey == NULL || keysize != ATECC_KEY_SIZE) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -177,13 +177,13 @@ static int atmel_init_enc_key(void)
|
|||||||
uint8_t read_key[ATECC_KEY_SIZE] = { 0 };
|
uint8_t read_key[ATECC_KEY_SIZE] = { 0 };
|
||||||
|
|
||||||
XMEMSET(read_key, 0xFF, sizeof(read_key));
|
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) {
|
if (ret != ATCA_SUCCESS) {
|
||||||
WOLFSSL_MSG("Failed to write key");
|
WOLFSSL_MSG("Failed to write key");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = atcatlsfn_set_get_enckey(atmel_set_enc_key);
|
ret = atcatlsfn_set_get_enckey(atmel_get_enc_key);
|
||||||
if (ret != ATCA_SUCCESS) {
|
if (ret != ATCA_SUCCESS) {
|
||||||
WOLFSSL_MSG("Failed to set enckey");
|
WOLFSSL_MSG("Failed to set enckey");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <wolfssl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
#include <wolfssl/wolfcrypt/ecc.h>
|
|
||||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||||
|
|
||||||
#ifdef WOLFSSL_ATECC508A
|
#ifdef WOLFSSL_ATECC508A
|
||||||
@ -71,6 +70,7 @@ long atmel_get_curr_time_and_date(long* tm);
|
|||||||
int atmel_ecc_alloc(void);
|
int atmel_ecc_alloc(void);
|
||||||
void atmel_ecc_free(int slot);
|
void atmel_ecc_free(int slot);
|
||||||
|
|
||||||
|
#include <wolfssl/wolfcrypt/ecc.h>
|
||||||
|
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
int atcatls_create_key_cb(WOLFSSL* ssl, ecc_key* key, word32 keySz,
|
int atcatls_create_key_cb(WOLFSSL* ssl, ecc_key* key, word32 keySz,
|
||||||
|
Reference in New Issue
Block a user