From 7539cb70eb2b0713fbebda877ac411009d9c9ecc Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 3 Mar 2020 11:01:26 +1000 Subject: [PATCH] dsaparam: update command line app to use EVP calls Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11225) --- apps/progs.pl | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/apps/progs.pl b/apps/progs.pl index b6f40e7e20..add4e67499 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -102,18 +102,19 @@ EOF ); my %cmd_deprecated = ( # The format of this table is: -# [0] = alternative command to use instead -# [1] = deprecented in this version -# [2] = preprocessor conditional for exclusing irrespective of deprecation -# rsa => [ "pkey", "3_0", "rsa" ], -# genrsa => [ "genpkey", "3_0", "rsa" ], - rsautl => [ "pkeyutl", "3_0", "rsa" ], -# dhparam => [ "pkeyparam", "3_0", "dh" ], -# dsaparam => [ "pkeyparam", "3_0", "dsa" ], -# dsa => [ "pkey", "3_0", "dsa" ], -# gendsa => [ "genpkey", "3_0", "dsa" ], -# ec => [ "pkey", "3_0", "ec" ], -# ecparam => [ "pkeyparam", "3_0", "ec" ], +# [0] = 0/1, 1 means deprecated and gone, 0 is deprecated but still present +# [1] = alternative command to use instead +# [2] = deprecented in this version +# [3] = preprocessor conditional for exclusing irrespective of deprecation + rsa => [ 0, "pkey", "3_0", "rsa" ], + genrsa => [ 1, "genpkey", "3_0", "rsa" ], + rsautl => [ 0, "pkeyutl", "3_0", "rsa" ], + dhparam => [ 1, "pkeyparam", "3_0", "dh" ], + dsaparam => [ 1, "pkeyparam", "3_0", "dsa" ], + dsa => [ 0, "pkey", "3_0", "dsa" ], + gendsa => [ 1, "genpkey", "3_0", "dsa" ], + ec => [ 0, "pkey", "3_0", "ec" ], + ecparam => [ 0, "pkeyparam", "3_0", "ec" ], ); print "FUNCTION functions[] = {\n"; @@ -124,16 +125,18 @@ EOF print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n"; } elsif (my $deprecated = $cmd_deprecated{$cmd}) { my @dep = @{$deprecated}; - my $daltprg = $dep[0]; - my $dver = $dep[1]; - my $dsys = $dep[2]; - print "#if !defined(OPENSSL_NO_DEPRECATED_" . $dver . ")"; - if ($dsys) { - print " && !defined(OPENSSL_NO_" . uc($dsys) . ")"; + print "#if "; + if ($dep[0]) { + print "!defined(OPENSSL_NO_DEPRECATED_" . $dep[2] . ")"; } - $dver =~ s/_/./g; - my $dalt = "\"" . $daltprg . "\", \"" . $dver . "\""; - $str =~ s/NULL, NULL/$dalt/; + if ($dep[3]) { + if ($dep[0]) { + print " && "; + } + print "!defined(OPENSSL_NO_" . uc($dep[3]) . ")"; + } + my $dalt = "\"" . $dep[1] . "\""; + $str =~ s/NULL/$dalt/; print "\n${str}#endif\n"; } elsif (grep { $cmd eq $_ } @disablables) { print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n"; -- 2.25.1