You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd36c2f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: rtl8735b/README.md
+45-2Lines changed: 45 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,13 @@ It is built inside the RealTek AmebaPro2 FreeRTOS SDK (which provides the startu
11
11
- The key is device-bound and deterministic: the same seed yields the same key (so GMAC verifies and AES round-trips), and a different seed yields a different key (GCM decrypt returns `AES_GCM_AUTH_E`).
12
12
- The port tolerates unaligned caller buffers (it bounces them to satisfy the HAL's 32-byte alignment); the example includes an explicitly-unaligned GCM check.
13
13
- HMAC-SHA256 under the HUK (`wc_HmacInit` with `devId = WC_HUK_DEVID`, then `wc_HmacSetKey`/`wc_HmacUpdate`/`wc_HmacFinal`): the MAC is deterministic for a given seed and differs for a wrong seed.
14
-
- HUK-bound ECDSA P-256 sign: a key is generated in software, its private scalar is wrapped under the HUK (ECB-encrypted with the HUK device), and signing then goes through the HUK device (unwrap + sign); the signature verifies against the software public key.
14
+
- HUK-bound ECDSA P-256 sign: a key is generated in software, its private scalar is wrapped under the HUK (AES-GCM-encrypted with the HUK device), and signing then goes through the HUK device (unwrap + sign); the signature verifies against the software public key.
15
+
- HUK-wrapped key storage: `huk_blob_create()` and `huk_blob_load()` in `main.c` show how to wrap a P-256 key, keep the seed, wrapped scalar and public key (plus the IV and tag for GCM) as a stored blob, and sign with a key set up from that blob alone. The blob only unwraps on the device that wrapped it. The example runs both wrap formats:
16
+
- AES-GCM (recommended): a damaged tag or wrapped scalar fails with `AES_GCM_AUTH_E`.
17
+
- AES-ECB: the same blob layout as the STM32 DHUK `wc_ecc_import_wrapped_private()`, for wrap code shared between the two parts. The port selects it when the key's `iv`, `ivSz`, `tag` and `tagSz` are all NULL/0. ECB has no integrity check: a damaged blob signs with a wrong scalar and the signature does not verify. Signing with an ECB blob needs wolfSSL PR #12056 or later.
18
+
19
+
Neither format covers the stored public key, so an application that relies on it needs its own integrity check; the example's verify of a fresh signature against the stored public key is one.
20
+
- HUK-wrapped AES key in a key-storage slot: an application AES key, stored wrapped under the HUK, is loaded with `wc_KeyStore_ImportWrapped()` into a hardware key-storage slot and then used through an `Aes` made with `wc_AesInit_Id()`, so GCM/ECB run from the slot and the key is in RAM only during the import. Both wrap formats are shown: RFC 3394 (`WC_KEYWRAP_FORMAT_AESKW`, a damaged blob fails with `BAD_KEYWRAP_IV_E`) and raw ECB (`WC_KEYWRAP_FORMAT_VENDOR`, the STM32 DHUK style, no integrity check). Needs wolfSSL PR #12056 or later; with an older wolfSSL the test is not built.
15
21
- HW ECDSA P-256 verify offload: the same signature is then verified through the HW engine (the public point is imported into a `WC_HUK_DEVID` key so `wc_ecc_verify_hash` dispatches to `hal_ecdsa`), and a tampered digest is shown to be rejected. No HUK context is needed to verify -- any P-256 public key.
16
22
-**Plaintext-key AES (second device):** with `WOLFSSL_RTL8735B_AES` also enabled (see `user_settings.h`), the example registers a second crypto-callback device, `wc_Rtl8735b_AesRegister(WC_RTL8735B_AES_DEVID)`, that runs a caller-supplied AES key directly on the HW engine with no HUK binding. It reproduces a published AES-GCM test vector (proving the key is used verbatim), then encrypts the same 32 key bytes through both devices to show the plaintext-key ciphertext differs from the HUK device-bound ciphertext -- the two devices coexist and are selected per `Aes` by `devId`.
17
23
@@ -78,6 +84,43 @@ Remove the J27 jumper and reset to boot. The console (UART, 115200) prints:
0 commit comments