Crypto: add HMAC-SHA1 and PBKDF2-HMAC-SHA256 #41

Open
opened 2026-12-03 10:24:26 +00:00 by faumaray · 0 comments
Owner

Context: Forge needs HOTP/TOTP and password-hash compatibility (Gitea pbkdf2_sha256) for M04 identity. Forge currently ships temporary RFC-verified implementations and tracks this as VL-CRYPTO-01 and VL-CRYPTO-02.

Need:

  • HMAC-SHA1 (RFC 2104) for HOTP (RFC 4226) and TOTP (RFC 6238).
  • PBKDF2-HMAC-SHA256 (RFC 8018) with checked iteration/salt/output bounds.

Both should be constant-time where they compare or process secrets, wipe intermediate key material, and never log inputs.

Tests/gate: RFC 2202 and RFC 4231 vectors for HMAC, RFC 4226/6238 vectors for the OTP consumers, and RFC 7914 PBKDF2 vectors plus boundary and overflow cases. Forge M04 swaps its temporary implementation for these.

Context: Forge needs HOTP/TOTP and password-hash compatibility (Gitea pbkdf2_sha256) for M04 identity. Forge currently ships temporary RFC-verified implementations and tracks this as VL-CRYPTO-01 and VL-CRYPTO-02. Need: - HMAC-SHA1 (RFC 2104) for HOTP (RFC 4226) and TOTP (RFC 6238). - PBKDF2-HMAC-SHA256 (RFC 8018) with checked iteration/salt/output bounds. Both should be constant-time where they compare or process secrets, wipe intermediate key material, and never log inputs. Tests/gate: RFC 2202 and RFC 4231 vectors for HMAC, RFC 4226/6238 vectors for the OTP consumers, and RFC 7914 PBKDF2 vectors plus boundary and overflow cases. Forge M04 swaps its temporary implementation for these.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Void/Library#41