[test] Allow for HMAC tests with partial expected output digest values

Some public HMAC test vectors provide expected output digest values
that are shorter than the digest size.

Allow HMAC tests to provide expected output digest values of any
non-zero length up to and including the digest size, so that we can
use these public test vectors without needing to synthesize the
remainder of the output digest value.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2026-08-31 21:23:35 +01:00
parent 0a2a0ef50e
commit a1c38478f2
+2 -1
View File
@@ -108,7 +108,8 @@ static void hmac_okx ( struct hmac_test *test, const char *file,
okx ( sizeof ( ctx ) == ( digest->ctxsize + digest->blocksize ),
file, line );
okx ( sizeof ( key ) == digest->blocksize, file, line );
okx ( test->expected_len == digest->digestsize, file, line );
okx ( test->expected_len > 0, file, line );
okx ( test->expected_len <= digest->digestsize, file, line );
/* Calculate HMAC */
DBGC ( test, "HMAC-%s key:\n", digest->name );