Bug 7: MAC2 buffer size
- Changed from fixed 1024-byte buffer to dynamic allocation
- Uses malloc/free for packets up to WG_MAX_PACKET_SIZE
Documentation:
- Added comments about WG_TYPE constants sharing values (intentional)
- Added note about platform-specific RNG for embedded systems
- system_rng() uses POSIX /dev/urandom - replace for u-boot/ESP32
Known limitations:
- chain_key initialization uses simplified version (peer_public_key directly)
Full handshake would use HASH("Noise_IKpsk2_25519...")
- For test phase, simplified version is acceptable
Test results: 29 passed, 3 failed (unchanged)
- Implemented ChaCha20-based CSPRNG seeded from SE050 TRNG
- Optimized for ESP32 and other embedded platforms
- Single SE050 access at startup, then fast software RNG
- All 10 CSPRNG tests passing
Usage:
Benefits:
- Minimal I2C communication (only once at startup)
- Fast random generation after seeding
- Cryptographically secure (ChaCha20-based)
- Suitable for resource-constrained devices
- 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):
- Session management with key derivation
- Packet encryption/decryption using ChaCha20-Poly1305
- Cookie mechanism for DoS protection (MAC1/MAC2)
- Key generation utility
- Integrated with existing crypto suite (X25519, ChaCha20, Poly1305, BLAKE2s)
- Clean-room implementation based on RFC 9153
- Add PlatformSCP03 integration test cases (test_scp03_platform_integration, test_scp03_platform_key_file)
- Update test helpers with mock session creation
- Update README with PlatformSCP03 configuration guide
- Add references to NXP AN12413 and AN12436
- Fix test assertions to work with opaque session type