From 6c1e0ff0493be5ef566de39d837c6eaa13e8f017 Mon Sep 17 00:00:00 2001 From: Martin Akman Date: Sat, 4 Jan 2020 10:23:03 +1000 Subject: [PATCH] ATECC: Option to disable I2C transport key --- wolfcrypt/src/port/atmel/atmel.c | 4 ++++ wolfssl/wolfcrypt/port/atmel/atmel.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/wolfcrypt/src/port/atmel/atmel.c b/wolfcrypt/src/port/atmel/atmel.c index cfe0a93c7..65dd4dfa7 100644 --- a/wolfcrypt/src/port/atmel/atmel.c +++ b/wolfcrypt/src/port/atmel/atmel.c @@ -347,7 +347,11 @@ int atmel_ecc_create_pms(int slotId, const uint8_t* peerKey, uint8_t* pms) ATECC_GET_ENC_KEY(read_key, sizeof(read_key)); /* send the encrypted version of the ECDH command */ +#if defined(ATECC_USE_TRANSPORT_KEY) && ATECC_USE_TRANSPORT_KEY ret = atcab_ecdh_enc(slotId, peerKey, pms, read_key, slotIdEnc); +#else + ret = atcab_ecdh(slotId, peerKey, pms); +#endif ret = atmel_ecc_translate_err(ret); /* free the ECDHE slot */ diff --git a/wolfssl/wolfcrypt/port/atmel/atmel.h b/wolfssl/wolfcrypt/port/atmel/atmel.h index 70035130c..3d7b54d2d 100644 --- a/wolfssl/wolfcrypt/port/atmel/atmel.h +++ b/wolfssl/wolfcrypt/port/atmel/atmel.h @@ -60,6 +60,11 @@ #define ATECC_SLOT_ENC_PARENT (0x7) #endif +/* Use a I2C transport key */ +#ifndef ATECC_USE_TRANSPORT_KEY +#define ATECC_USE_TRANSPORT_KEY 1 +#endif + /* ATECC_KEY_SIZE required for ecc.h */ #include