From: Matt Caswell Date: Thu, 8 Aug 2024 15:12:11 +0000 (+0100) Subject: Add a test for the nonce-type sigopt X-Git-Tag: openssl-3.3.3~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2219263d855be53dd18ea8990b3e644a2909b254;p=thirdparty%2Fopenssl.git Add a test for the nonce-type sigopt Check that using the nonce-type sigopt via the dgst app works correctly Based on the reproducer from #25012 Reviewed-by: Dmitry Belyavskiy Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25057) (cherry picked from commit c9e36a8221517c0083695a567c11e0c2208e1f8d) --- diff --git a/test/recipes/20-test_dgst.t b/test/recipes/20-test_dgst.t index d1b2ccf5c7b..7bd558331d7 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 => 13; +plan tests => 14; sub tsignverify { my $testtext = shift; @@ -233,7 +233,7 @@ subtest "SHAKE digest generation with no xoflen set `dgst` CLI" => sub { }; SKIP: { - skip "ECDSA is not supported by this OpenSSL build", 1 + skip "ECDSA is not supported by this OpenSSL build", 2 if disabled("ec"); subtest "signing with xoflen is not supported `dgst` CLI" => sub { @@ -245,5 +245,17 @@ SKIP: { '-out', 'test.sig', srctop_file('test', 'data.bin')])), "Generating signature with xoflen should fail"); + }; + + subtest "signing using the nonce-type sigopt" => sub { + plan tests => 1; + my $data_to_sign = srctop_file('test', 'data.bin'); + + ok(run(app(['openssl', 'dgst', '-sha256', + '-sign', srctop_file("test","testec-p256.pem"), + '-out', 'test.sig', + '-sigopt', 'nonce-type:1', + srctop_file('test', 'data.bin')])), + "Sign using the nonce-type sigopt"); } }