feat: Add SE050 hardware RNG integration

- Added system RNG fallback using /dev/urandom
- Created se050_wireguard_se050_rng.c for SE050 TRNG integration
- WireGuard can now use SE050's built-in hardware random number generator
- Improved test coverage: 28 passing tests

Usage for SE050 RNG:

For standalone (no SE050):
This commit is contained in:
km
2026-03-28 20:20:29 +09:00
parent 4ec660de02
commit 1894e9a933
4 changed files with 117 additions and 7 deletions
+20
View File
@@ -170,12 +170,32 @@ int se050_wireguard_compute_mac2(se050_wireguard_session_t *session,
/**
* @brief Generate a new WireGuard keypair
*
* Uses system RNG (/dev/urandom on POSIX).
* For SE050 hardware RNG, use se050_wireguard_generate_keypair_se050().
*
* @param private_key Output: private key (32 bytes)
* @param public_key Output: public key (32 bytes)
* @return 0 on success, -1 on error
*/
int se050_wireguard_generate_keypair(uint8_t *private_key, uint8_t *public_key);
/**
* @brief Generate WireGuard keypair using SE050 hardware RNG
*
* This function uses the SE050 chip's built-in True Random Number Generator
* for cryptographically secure key generation.
*
* @param session SE050 session context (initialized via se050_session_init())
* @param private_key Output: private key (32 bytes)
* @param public_key Output: public key (32 bytes)
* @return 0 on success, -1 on error
*/
#ifdef SE050_ENABLED
int se050_wireguard_generate_keypair_se050(se050_session_ctx_t *session,
uint8_t *private_key,
uint8_t *public_key);
#endif
/* =========================================================================
* Constants
* ========================================================================= */