fix: Additional WireGuard bugs
Bug 3: wg_hkdf_3 implementation - Added proper T(3) = HMAC(PRK, T(2) || 0x03) Bug 4: Nonce construction - verified correct - Encrypt: memcpy(nonce_buf + 4, header + 8, 8) ✓ - Decrypt: memcpy(nonce_buf + 4, packet + 8, 8) ✓ - Both use little-endian nonce bytes from header[8..15] Bug 5: Replay detection logic - Fixed: if (session->packets_received > 0 && nonce <= session->receiving_nonce) - Added packets_received counter to session struct - Now strictly rejects any nonce <= last received nonce Test results: 29 passed, 3 failed Remaining failures in packet encryption/decryption need further investigation.
This commit is contained in:
@@ -51,6 +51,7 @@ typedef struct se050_wireguard_session {
|
||||
/* State flags */
|
||||
int is_initiator;
|
||||
int handshake_complete;
|
||||
int packets_received; /* Number of packets received (for replay detection) */
|
||||
} se050_wireguard_session_t;
|
||||
|
||||
/* =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user