Skip to content

Commit

Permalink
Test: use keywords instead of magic numbers for 'rsa_pss_saltlen'
Browse files Browse the repository at this point in the history
Since commit 137096a it is possible to specify keywords instead
of negative magic numbers for the salt length. This commit replaces
the remaining occurrences of `rsa_pss_saltlen:-3` in the test recipes
by `rsa_pss_saltlen:max`.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from openssl#8860)
  • Loading branch information
mspncp committed May 2, 2019
1 parent 0c4e984 commit 31fc48d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/recipes/15-test_rsapss.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ plan tests => 5;

#using test/testrsa.pem which happens to be a 512 bit RSA
ok(run(app(['openssl', 'dgst', '-sign', srctop_file('test', 'testrsa.pem'), '-sha1',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:-3',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:max',
'-sigopt', 'rsa_mgf1_md:sha512', '-out', 'testrsapss.sig',
srctop_file('test', 'testrsa.pem')])),
"openssl dgst -sign");

with({ exit_checker => sub { return shift == 1; } },
sub { ok(run(app(['openssl', 'dgst', '-sign', srctop_file('test', 'testrsa.pem'), '-sha512',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:-3',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:max',
'-sigopt', 'rsa_mgf1_md:sha512', srctop_file('test', 'testrsa.pem')])),
"openssl dgst -sign, expect to fail gracefully");
ok(run(app(['openssl', 'dgst', '-sign', srctop_file('test', 'testrsa.pem'), '-sha512',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:2147483647',
'-sigopt', 'rsa_mgf1_md:sha1', srctop_file('test', 'testrsa.pem')])),
"openssl dgst -sign, expect to fail gracefully");
ok(run(app(['openssl', 'dgst', '-prverify', srctop_file('test', 'testrsa.pem'), '-sha512',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:-3',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:max',
'-sigopt', 'rsa_mgf1_md:sha512', '-signature', 'testrsapss.sig',
srctop_file('test', 'testrsa.pem')])),
"openssl dgst -prverify, expect to fail gracefully");
});

ok(run(app(['openssl', 'dgst', '-prverify', srctop_file('test', 'testrsa.pem'), '-sha1',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:-3',
'-sigopt', 'rsa_padding_mode:pss', '-sigopt', 'rsa_pss_saltlen:max',
'-sigopt', 'rsa_mgf1_md:sha512', '-signature', 'testrsapss.sig',
srctop_file('test', 'testrsa.pem')])),
"openssl dgst -prverify");
Expand Down
4 changes: 2 additions & 2 deletions test/recipes/80-test_cms.t
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ my @smime_cms_param_tests = (
"-CAfile", catfile($smdir, "smroot.pem"), "-out", "smtst.txt" ]
],

[ "signed content test streaming PEM format, RSA keys, PSS signature, saltlen=-3",
[ "signed content test streaming PEM format, RSA keys, PSS signature, saltlen=max",
[ "-sign", "-in", $smcont, "-outform", "PEM", "-nodetach",
"-signer", catfile($smdir, "smrsa1.pem"), "-keyopt", "rsa_padding_mode:pss",
"-keyopt", "rsa_pss_saltlen:-3", "-out", "test.cms" ],
"-keyopt", "rsa_pss_saltlen:max", "-out", "test.cms" ],
[ "-verify", "-in", "test.cms", "-inform", "PEM",
"-CAfile", catfile($smdir, "smroot.pem"), "-out", "smtst.txt" ]
],
Expand Down

0 comments on commit 31fc48d

Please sign in to comment.