Skip to content

Add wolfGuard: native FIPS WireGuard driver for wolfIP#86

Merged
danielinux merged 1 commit intowolfSSL:masterfrom
gasbytes:wolfguard
Mar 25, 2026
Merged

Add wolfGuard: native FIPS WireGuard driver for wolfIP#86
danielinux merged 1 commit intowolfSSL:masterfrom
gasbytes:wolfguard

Conversation

@gasbytes
Copy link
Copy Markdown
Contributor

@gasbytes gasbytes commented Mar 25, 2026

core implementation included in src/wolfguard/, tests in src/tests/; which includes unit tests, loopback test that contains integration tests, and interop test against the wolfguard kernel implementation, this last one is also provided as script in tools/scripts/test-interop-wolfguard.sh.

note: added some minor fips guarding to correctly build against wolfssl in fips mode, which is now with this pr supported too.

@gasbytes gasbytes self-assigned this Mar 25, 2026
@gasbytes gasbytes force-pushed the wolfguard branch 2 times, most recently from 45f8246 to 89ec684 Compare March 25, 2026 10:07
@gasbytes gasbytes force-pushed the wolfguard branch 2 times, most recently from a986709 to fe87d4e Compare March 25, 2026 17:00
@gasbytes gasbytes marked this pull request as ready for review March 25, 2026 17:07
@gasbytes gasbytes assigned danielinux and unassigned gasbytes Mar 25, 2026
@gasbytes gasbytes requested a review from danielinux March 25, 2026 17:07
Copy link
Copy Markdown
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: shorten comment for wolfIP_ll_dev.priv

Comment thread wolfip.h Outdated
Core implementation (src/wolfguard/):
- wg_crypto.c: FIPS crypto abstraction with PRIVATE_KEY_UNLOCK/LOCK
  for wolfSSL FIPS v6 compatibility
- wg_noise.c: Noise_IKpsk2 handshake (create/consume initiation and
  response, session key derivation)
- wg_cookie.c: mac1/mac2 validation, cookie reply for DoS protection
- wg_packet.c: transport data encrypt/decrypt with replay counter
- wg_timers.c: rekey, keepalive, retransmit, key zeroing state machine
- wg_allowedips.c: flat-table longest-prefix-match for peer routing
- wolfguard.c: device init, wg0 virtual interface, UDP outer transport,
  poll loop integration via wolfIP_recv_ex()

Wire format matches kernel wolfGuard:
- 32-byte MACs (full SHA-256 HMAC, not truncated to 16)
- 16-byte AES-GCM IVs (AES_IV_SIZE, matching kernel ZeroNonce)
- TAI64N timestamps with 0x400000000000000a epoch offset
- 65-byte uncompressed P-256 public keys

Tests:
- unit_wolfguard.c: 38 unit tests covering crypto, noise handshake,
  cookies, allowed-IPs, replay counter, packet processing, timers
- test_wolfguard_loopback.c: 3 integration tests (roundtrip, session
  lifecycle with rekey/reconnect, DoS cookie mechanism)
- test_wolfguard_interop.c: bidirectional interop against the kernel
  wolfGuard module via TUN, tests both wolfIP-initiated and
  kernel-initiated handshakes with fresh key material

Build & CI:
- Makefile: wolfguard targets with ASan/UBSan variants
- tools/scripts/test-interop-wolfguard.sh: end-to-end interop harness
  (builds wolfSSL + kernel module, loads modules, generates keys, runs
  two-phase bidirectional test)
- .github/workflows/wolfguard.yml: CI for unit, loopback, and interop
@danielinux danielinux merged commit 84d92b6 into wolfSSL:master Mar 25, 2026
27 checks passed
@gasbytes gasbytes deleted the wolfguard branch March 26, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants