summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-11-18 11:32:33 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-11-20 11:59:23 +1000
commitf2a7151849a566892912737f7b633c04f64a2b9e (patch)
treed0f3046e6d519d66137111a426c80a60fbd22adf /test
parentae2e4d1fd11910245b6f7b4db31cccf1ff4bec60 (diff)
Fix crash in genpkey app when -pkeyopt digest:name is used for DH or DSA.
By the time the keygen is called the references to strings inside the gen ctx are floating pointers. A strdup solves this problem. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13432)
Diffstat (limited to 'test')
-rw-r--r--test/recipes/15-test_gendh.t10
-rw-r--r--test/recipes/15-test_gendsa.t10
2 files changed, 18 insertions, 2 deletions
diff --git a/test/recipes/15-test_gendh.t b/test/recipes/15-test_gendh.t
index c87ae0d89c..87dd73f438 100644
--- a/test/recipes/15-test_gendh.t
+++ b/test/recipes/15-test_gendh.t
@@ -18,7 +18,7 @@ setup("test_gendh");
plan skip_all => "This test is unsupported in a no-dh build" if disabled("dh");
-plan tests => 12;
+plan tests => 13;
ok(run(app([ 'openssl', 'genpkey', '-genparam',
'-algorithm', 'DH',
@@ -35,6 +35,14 @@ ok(run(app([ 'openssl', 'genpkey', '-genparam',
ok(run(app([ 'openssl', 'genpkey', '-genparam',
'-algorithm', 'DH',
+ '-pkeyopt', 'pbits:2048',
+ '-pkeyopt', 'qbits:224',
+ '-pkeyopt', 'digest:SHA512-224',
+ '-pkeyopt', 'type:fips186_4'])),
+ "genpkey DH params fips186_4 with truncated SHA");
+
+ok(run(app([ 'openssl', 'genpkey', '-genparam',
+ '-algorithm', 'DH',
'-pkeyopt', 'type:fips186_2',
'-text'])),
"genpkey DH params fips186_2");
diff --git a/test/recipes/15-test_gendsa.t b/test/recipes/15-test_gendsa.t
index 910cc7da56..5e36109b37 100644
--- a/test/recipes/15-test_gendsa.t
+++ b/test/recipes/15-test_gendsa.t
@@ -19,7 +19,7 @@ setup("test_gendsa");
plan skip_all => "This test is unsupported in a no-dsa build"
if disabled("dsa");
-plan tests => 10;
+plan tests => 11;
ok(run(app([ 'openssl', 'genpkey', '-genparam',
'-algorithm', 'DSA',
@@ -36,6 +36,14 @@ ok(run(app([ 'openssl', 'genpkey', '-genparam',
ok(run(app([ 'openssl', 'genpkey', '-genparam',
'-algorithm', 'DSA',
+ '-pkeyopt', 'pbits:2048',
+ '-pkeyopt', 'qbits:224',
+ '-pkeyopt', 'digest:SHA512-256',
+ '-pkeyopt', 'type:fips186_4'])),
+ "genpkey DSA params fips186_4 with truncated SHA");
+
+ok(run(app([ 'openssl', 'genpkey', '-genparam',
+ '-algorithm', 'DSA',
'-pkeyopt', 'type:fips186_2',
'-text'])),
"genpkey DSA params fips186_2");