[openssl] master update
beldmit at gmail.com
beldmit at gmail.com
Thu Aug 5 08:15:57 UTC 2021
The branch master has been updated
via 46d51520319b8e4220b203c517b1232cf33a579f (commit)
via 5cdeb99f9c8ab0ee5a4b17c677fc054f5acc0b2c (commit)
from d209fc6cce47be332ca10dbef1ada8077a22fb38 (commit)
- Log -----------------------------------------------------------------
commit 46d51520319b8e4220b203c517b1232cf33a579f
Author: Pauli <pauli at openssl.org>
Date: Thu Aug 5 09:25:56 2021 +1000
test: add -macopt hexkey: to dgst command tests
Comparison checksum generated using 1.1.1f.
Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16212)
commit 5cdeb99f9c8ab0ee5a4b17c677fc054f5acc0b2c
Author: Pauli <pauli at openssl.org>
Date: Wed Aug 4 13:30:44 2021 +1000
ctrls: add missing control string translation for key -> priv for HMAC
Fixes #16200
Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/16212)
-----------------------------------------------------------------------
Summary of changes:
crypto/evp/ctrl_params_translate.c | 2 +-
test/recipes/20-test_dgst.t | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index 4ea17380af..a441c1f4b7 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -2221,7 +2221,7 @@ static const struct translation_st evp_pkey_ctx_translations[] = {
EVP_PKEY_CTRL_CIPHER, NULL, NULL,
OSSL_PKEY_PARAM_CIPHER, OSSL_PARAM_UTF8_STRING, fix_cipher },
{ SET, -1, -1, EVP_PKEY_OP_KEYGEN,
- EVP_PKEY_CTRL_SET_MAC_KEY, NULL, NULL,
+ EVP_PKEY_CTRL_SET_MAC_KEY, "key", "hexkey",
OSSL_PKEY_PARAM_PRIV_KEY, OSSL_PARAM_OCTET_STRING, NULL },
{ SET, -1, -1, EVP_PKEY_OP_TYPE_SIG,
diff --git a/test/recipes/20-test_dgst.t b/test/recipes/20-test_dgst.t
index d64d810edd..5af74aec2a 100644
--- a/test/recipes/20-test_dgst.t
+++ b/test/recipes/20-test_dgst.t
@@ -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;
More information about the openssl-commits
mailing list