summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-03-05 10:06:29 +1000
committerPauli <paul.dale@oracle.com>2020-04-19 10:37:39 +1000
commit99a7c3a7bf98c7b8d1df943ab7f53cc26aec65dd (patch)
tree2733b84bdcbbda3209c802df1ece49da746852a5 /apps
parent188dd86ab455eec54e4d940b545ae82ad23b4f1a (diff)
openssl: include the version a command was deprecated in the output text.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11225)
Diffstat (limited to 'apps')
-rw-r--r--apps/include/function.h1
-rw-r--r--apps/openssl.c17
-rw-r--r--apps/progs.pl53
3 files changed, 39 insertions, 32 deletions
diff --git a/apps/include/function.h b/apps/include/function.h
index 28eb3e5d1c..58657cdf43 100644
--- a/apps/include/function.h
+++ b/apps/include/function.h
@@ -26,6 +26,7 @@ typedef struct function_st {
int (*func)(int argc, char *argv[]);
const OPTIONS *help;
const char *deprecated_alternative;
+ const char *deprecated_version;
} FUNCTION;
DEFINE_LHASH_OF(FUNCTION);
diff --git a/apps/openssl.c b/apps/openssl.c
index 558f662e14..e3197daab9 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -47,12 +47,15 @@ BIO *bio_in = NULL;
BIO *bio_out = NULL;
BIO *bio_err = NULL;
-static void warn_deprecated(const char *pname,
- const char *deprecated_alternative)
+static void warn_deprecated(const FUNCTION *fp)
{
- BIO_printf(bio_err, "The command %s is deprecated.", pname);
- if (strcmp(deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
- BIO_printf(bio_err, " Use '%s' instead.", deprecated_alternative);
+ if (fp->deprecated_version != NULL)
+ BIO_printf(bio_err, "The command %s was deprecated in version %s.",
+ fp->name, fp->deprecated_version);
+ else
+ BIO_printf(bio_err, "The command %s is deprecated.", fp->name);
+ if (strcmp(fp->deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
+ BIO_printf(bio_err, " Use '%s' instead.", fp->deprecated_alternative);
BIO_printf(bio_err, "\n");
}
@@ -287,7 +290,7 @@ int main(int argc, char *argv[])
if (fp != NULL) {
argv[0] = pname;
if (fp->deprecated_alternative != NULL)
- warn_deprecated(pname, fp->deprecated_alternative);
+ warn_deprecated(fp);
ret = fp->func(argc, argv);
goto end;
}
@@ -483,7 +486,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
}
if (fp != NULL) {
if (fp->deprecated_alternative != NULL)
- warn_deprecated(fp->name, fp->deprecated_alternative);
+ warn_deprecated(fp);
return fp->func(argc, argv);
}
if ((strncmp(argv[0], "no-", 3)) == 0) {
diff --git a/apps/progs.pl b/apps/progs.pl
index 6a68dd93b9..b6f40e7e20 100644
--- a/apps/progs.pl
+++ b/apps/progs.pl
@@ -92,45 +92,48 @@ EOF
my %cmd_disabler = (
ciphers => "sock",
+ genrsa => "rsa",
+ gendsa => "dsa",
+ dsaparam => "dsa",
+ gendh => "dh",
+ dhparam => "dh",
+ ecparam => "ec",
pkcs12 => "des",
);
my %cmd_deprecated = (
# The format of this table is:
-# [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 => [ 0, "genpkey", "3_0", "rsa" ],
- rsautl => [ 0, "pkeyutl", "3_0", "rsa" ],
- dhparam => [ 0, "pkeyparam", "3_0", "dh" ],
- dsaparam => [ 0, "pkeyparam", "3_0", "dsa" ],
- dsa => [ 0, "pkey", "3_0", "dsa" ],
- gendsa => [ 0, "genpkey", "3_0", "dsa" ],
- ec => [ 0, "pkey", "3_0", "ec" ],
- ecparam => [ 0, "pkeyparam", "3_0", "ec" ],
+# [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" ],
);
print "FUNCTION functions[] = {\n";
foreach my $cmd ( @ARGV ) {
my $str =
- " {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options, NULL},\n";
+ " {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options, NULL, NULL},\n";
if ($cmd =~ /^s_/) {
print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
} elsif (my $deprecated = $cmd_deprecated{$cmd}) {
my @dep = @{$deprecated};
- print "#if ";
- if ($dep[0]) {
- print "!defined(OPENSSL_NO_DEPRECATED_" . $dep[2] . ")";
+ 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) . ")";
}
- if ($dep[3]) {
- if ($dep[0]) {
- print " && ";
- }
- print "!defined(OPENSSL_NO_" . uc($dep[3]) . ")";
- }
- my $dalt = "\"" . $dep[1] . "\"";
- $str =~ s/NULL/$dalt/;
+ $dver =~ s/_/./g;
+ my $dalt = "\"" . $daltprg . "\", \"" . $dver . "\"";
+ $str =~ s/NULL, NULL/$dalt/;
print "\n${str}#endif\n";
} elsif (grep { $cmd eq $_ } @disablables) {
print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";