From: Aleksey Sanin Date: Mon, 20 Mar 2023 15:26:50 +0000 (-0400) Subject: Added tests and updated help X-Git-Tag: openssl-3.2.0-alpha1~1108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=438068674b95b38892d2d1790b3fd14e3112d0cb;p=thirdparty%2Fopenssl.git Added tests and updated help Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/19898) --- diff --git a/apps/dsaparam.c b/apps/dsaparam.c index adeeb095a0c..ca98fe58c45 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -32,7 +32,7 @@ typedef enum OPTION_choice { } OPTION_CHOICE; const OPTIONS dsaparam_options[] = { - {OPT_HELP_STR, 1, '-', "Usage: %s [options] [numbits]\n"}, + {OPT_HELP_STR, 1, '-', "Usage: %s [options] [numbits] [numqbits]\n"}, OPT_SECTION("General"), {"help", OPT_HELP, '-', "Display this summary"}, @@ -57,8 +57,8 @@ const OPTIONS dsaparam_options[] = { OPT_PROV_OPTIONS, OPT_PARAMETERS(), - {"numbits", 0, 0, "Number of bits if generating parameters (optional)"}, - {"numqbits", 0, 0, "Number of bits in the subprime parameter q if generating parameters (optional)"}, + {"numbits", 0, 0, "Number of bits if generating parameters or key (optional)"}, + {"numqbits", 0, 0, "Number of bits in the subprime parameter q if generating parameters or key (optional)"}, {NULL} }; @@ -249,4 +249,3 @@ int dsaparam_main(int argc, char **argv) release_engine(e); return ret; } - diff --git a/test/recipes/15-test_gendsa.t b/test/recipes/15-test_gendsa.t index 00423ce12fa..b4bb9b29ca9 100644 --- a/test/recipes/15-test_gendsa.t +++ b/test/recipes/15-test_gendsa.t @@ -28,7 +28,7 @@ my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); plan tests => ($no_fips ? 0 : 2) # FIPS related tests - + 13; + + 18; ok(run(app([ 'openssl', 'genpkey', '-genparam', '-algorithm', 'DSA', @@ -115,6 +115,43 @@ ok(!run(app(["openssl", "gendsa", 'dsagen.pem', "-verbose"])), "gendsa with extra parameter (at end) should fail"); +# test key generation with dsaparam tool +ok(run(app([ 'openssl', 'dsaparam', + '-genkey', + '-text', + '1024', + ])), + "dsaparam -genkey DSA 1024 with default qbits"); + +ok(run(app([ 'openssl', 'dsaparam', + '-genkey', + '-text', + '2048', + ])), + "dsaparam -genkey DSA 2048 with default qbits"); + +ok(run(app([ 'openssl', 'dsaparam', + '-genkey', + '-text', + '1024', '160', + ])), + "dsaparam -genkey DSA 1024 with 160 qbits"); + +ok(run(app([ 'openssl', 'dsaparam', + '-genkey', + '-text', + '2048', '224', + ])), + "dsaparam -genkey DSA 2048 with 224 qbits"); + +ok(run(app([ 'openssl', 'dsaparam', + '-genkey', + '-text', + '2048', '256', + ])), + "dsaparam -genkey DSA 2048 with 256 qbits"); +# genkey test for 3072 bits keys were removed to speed up the tests + unless ($no_fips) { my $provconf = srctop_file("test", "fips-and-base.cnf"); my $provpath = bldtop_dir("providers");