Skip to content

Commit 81086ff

Browse files
committed
Addressed two more comments
- Added option WOLFSSL_TA100_AUTO_LOCK to permanently store generated keys in the vault - fixed key size for HW RSA keys in signature.c
1 parent f5a9ec4 commit 81086ff

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

wolfcrypt/src/port/atmel/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ ATECC508A HW accelerated implementation:
9898

9999
### Microchip Trust Anchor TA100 ECC/RSA
100100

101+
## TA100 Support Notes
102+
103+
The TA100 integration uses Microchip CryptoAuthLib TALIB APIs and supports
104+
ECC P-256 and RSA (2048 or 3072 depending on build options). This port is
105+
built against CryptoAuthLib v3.6.0. TA100 uses
106+
device handles rather than ATECC slot addresses; wolfSSL maps ECC slots to
107+
TA100 handles internally and uses a dedicated symmetric key handle for AES-GCM.
108+
109+
Key points:
110+
* TA100 support is enabled via `WOLFSSL_MICROCHIP_TA100` and CryptoAuthLib
111+
must be built with TA100 support enabled (`ATCA_TA100_SUPPORT`).
112+
* RSA key size selection uses `WOLFSSL_SP_NO_2048` / `WOLFSSL_SP_NO_3072`
113+
to choose `WOLFSSL_TA_KEY_TYPE_RSA` and `WOLFSSL_TA_KEY_TYPE_RSA_SIZE`.
114+
* AES-GCM support requires `WOLFSSL_MICROCHIP_AESGCM` and CryptoAuthLib
115+
TA100 AES-GCM support (`ATCA_TA100_AES_AUTH_SUPPORT`).
116+
117+
### TA100 Auto-Lock Option
118+
119+
By default, wolfSSL does **not** lock the TA100 setup/data zone when setting
120+
an AES key. If you want to lock the setup/data zone automatically after the
121+
AES key is loaded, define:
122+
123+
`WOLFSSL_TA100_AUTO_LOCK=1`
124+
125+
This gates the call to `talib_lock_setup()` inside
126+
`wc_Microchip_aes_set_key()` in `wolfcrypt/src/port/atmel/atmel.c`.
127+
Because locking is a one-way operation on real hardware, this option is
128+
disabled by default and should only be enabled in a controlled provisioning
129+
flow.
130+
101131
rm -rf build-shared
102132
cmake -S . -B build-shared \
103133
-DCMAKE_BUILD_TYPE=Debug \

wolfcrypt/src/port/atmel/atmel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,12 +1898,14 @@ int wc_Microchip_aes_set_key(Aes* aes, const byte* key, word32 keylen,
18981898
status = talib_aes_gcm_keyload(atcab_get_device(), aes->key_id, 0);
18991899
CHECK_STATUS(status);
19001900

1901+
#if WOLFSSL_TA100_AUTO_LOCK
19011902
/* Test if data zone is locked */
19021903
status = talib_is_setup_locked(atcab_get_device(), &is_locked);
19031904
if (!is_locked) {
19041905
status = talib_lock_setup(atcab_get_device());
19051906
CHECK_STATUS(status);
19061907
}
1908+
#endif
19071909

19081910
return atmel_ecc_translate_err(status);
19091911
}

wolfcrypt/src/signature.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ int wc_SignatureGetSize(enum wc_SignatureType sig_type,
114114
#if defined(WOLFSSL_MICROCHIP_TA100)
115115
if (sig_len <= 0) {
116116
const RsaKey* r = (const RsaKey*)key;
117-
/* TA100 handles imply a 2048-bit RSA key. */
117+
/* TA100 handles imply a hardware RSA key. */
118118
if (r->rKeyH != 0 || r->uKeyH != 0) {
119-
sig_len = 256;
119+
sig_len = WOLFSSL_TA_KEY_TYPE_RSA_SIZE;
120120
}
121121
}
122122
#endif

wolfssl/wolfcrypt/port/atmel/atmel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ int atmel_ecc_verify_ex(const byte* message, word32 message_len,
149149

150150
#if defined(WOLFSSL_MICROCHIP_TA100)
151151

152+
#ifndef WOLFSSL_TA100_AUTO_LOCK
153+
#define WOLFSSL_TA100_AUTO_LOCK 0
154+
#endif
155+
152156
#if !defined(NO_AES) && defined(HAVE_AESGCM) && \
153157
defined(WOLFSSL_MICROCHIP_AESGCM)
154158
#include <wolfssl/wolfcrypt/aes.h>

0 commit comments

Comments
 (0)