mirror of
https://github.com/openssl/openssl.git
synced 2025-02-23 14:42:15 +08:00
test: add -macopt hexkey: to dgst command tests
Comparison checksum generated using 1.1.1f. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/16212)
This commit is contained in:
parent
5cdeb99f9c
commit
46d5152031
@ -17,7 +17,7 @@ use OpenSSL::Test::Utils;
|
||||
|
||||
setup("test_dgst");
|
||||
|
||||
plan tests => 8;
|
||||
plan tests => 9;
|
||||
|
||||
sub tsignverify {
|
||||
my $testtext = shift;
|
||||
@ -131,6 +131,21 @@ subtest "HMAC generation with `dgst` CLI, default digest" => sub {
|
||||
"HMAC: Check second HMAC value is consistent with the first ($hmacdata[1]) vs ($expected)");
|
||||
};
|
||||
|
||||
subtest "HMAC generation with `dgst` CLI, key via option" => sub {
|
||||
plan tests => 2;
|
||||
|
||||
my $testdata = srctop_file('test', 'data.bin');
|
||||
#HMAC the data twice to check consistency
|
||||
my @hmacdata = run(app(['openssl', 'dgst', '-sha256', '-hmac',
|
||||
'-macopt', 'hexkey:FFFF',
|
||||
$testdata, $testdata]), capture => 1);
|
||||
chomp(@hmacdata);
|
||||
my $expected = qr/HMAC-SHA2-256\(\Q$testdata\E\)= b6727b7bb251dfa65846e0a8223bdd57d244aa6d7e312cb906d8e21f2dee3a57/;
|
||||
ok($hmacdata[0] =~ $expected, "HMAC: Check HMAC value is as expected ($hmacdata[0]) vs ($expected)");
|
||||
ok($hmacdata[1] =~ $expected,
|
||||
"HMAC: Check second HMAC value is consistent with the first ($hmacdata[1]) vs ($expected)");
|
||||
};
|
||||
|
||||
subtest "Custom length XOF digest generation with `dgst` CLI" => sub {
|
||||
plan tests => 2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user