rustcrypto: add HKDF-SHA-384 self-test vector

Every offered algorithm needs a KAT before it is marked available;
the value is the RFC 5869 TC1 inputs checked against OpenSSL.
Refs: R3-4
This commit is contained in:
JohnE 2026-11-16 03:27:25 -05:00
parent 66ec0f0685
commit af11468d97
1 changed files with 8 additions and 1 deletions

View File

@ -11,7 +11,7 @@
//! - SHA-2 / SHA-3: FIPS 180-4 / FIPS 202 "abc"; BLAKE2b: RFC 7693 appendix A
//! and the reference keyed KAT.
//! - HMAC: RFC 4231 test case 2; HKDF: RFC 5869 test case 1 (SHA-256) and
//! the same inputs pinned for SHA-512.
//! the same inputs for SHA-384/512, checked against OpenSSL 3.6.
//! - Argon2id: RFC 9106 §5.3 (the core with secret and associated data).
//! - X25519: RFC 7748 §6.1.
//! - ML-KEM-768/1024: seed keys from the IETF LAMPS examples (seed 00..3f);
@ -103,6 +103,11 @@ const KATS: &[(u32, &str, Check)] = &[
"HKDF-SHA-256 RFC 5869 TC1",
|| hkdf(KdfAlgorithm::Sha256, HKDF256_TC1),
),
(
KdfAlgorithm::Sha384 as u32,
"HKDF-SHA-384 TC1 inputs",
|| hkdf(KdfAlgorithm::Sha384, HKDF384_TC1),
),
(
KdfAlgorithm::Sha512 as u32,
"HKDF-SHA-512 TC1 inputs",
@ -347,6 +352,8 @@ fn poly1305() -> Result<(), String> {
const HKDF256_TC1: &str = "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf\
34007208d5b887185865";
const HKDF384_TC1: &str = "9b5097a86038b805309076a44b3a9f38063e25b516dcbf369f394cfab43685f7\
48b6457763e4f0204fc5";
const HKDF512_TC1: &str = "832390086cda71fb47625bb5ceb168e4c8e26a1a16ed34d9fc7fe92c14815793\
38da362cb8d9f925d7cb";