summaryrefslogtreecommitdiffstats
path: root/apps/dsa.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-02-07 08:09:53 +1000
committerPauli <paul.dale@oracle.com>2020-02-12 08:52:42 +1000
commit1ddf2594e18137aeb7ce861e54f46824db76e36f (patch)
treee3dba8a2ebf5bcde9e10242c9af842b2f36d6f8a /apps/dsa.c
parentc2ec4a16f79cec06b5449bd8728f2e03fa16e22b (diff)
dsa: deprecate applications that depend on the low level DSA functions.
speed is updated to not support DSA instead of being removed. The dhparam, dsaparam, dsa and gendsa commands are deprecated but still exist without NO_DEPRECATED defined. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10977)
Diffstat (limited to 'apps/dsa.c')
-rw-r--r--apps/dsa.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/dsa.c b/apps/dsa.c
index 8ba9305030..0156ff8373 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -7,8 +7,11 @@
* https://www.openssl.org/source/license.html
*/
+/* We need to use the deprecated DSA_print */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <openssl/opensslconf.h>
-#ifdef OPENSSL_NO_DSA
+#if defined(OPENSSL_NO_DSA) || defined(OPENSSL_NO_DEPRECATED_3_0)
NON_EMPTY_TRANSLATION_UNIT
#else
@@ -81,7 +84,6 @@ int dsa_main(int argc, char **argv)
int pvk_encr = 2;
# endif
int private = 0;
- EVP_PKEY *pkey = NULL;
prog = opt_init(argc, argv, dsa_options);
while ((o = opt_next()) != OPT_EOF) {
@@ -161,13 +163,19 @@ int dsa_main(int argc, char **argv)
}
BIO_printf(bio_err, "read DSA key\n");
- if (pubin)
- pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
- else
- pkey = load_key(infile, informat, 1, passin, e, "Private Key");
+ {
+ EVP_PKEY *pkey;
+
+ if (pubin)
+ pkey = load_pubkey(infile, informat, 1, passin, e, "Public Key");
+ else
+ pkey = load_key(infile, informat, 1, passin, e, "Private Key");
- if (pkey != NULL)
- dsa = EVP_PKEY_get1_DSA(pkey);
+ if (pkey != NULL) {
+ dsa = EVP_PKEY_get1_DSA(pkey);
+ EVP_PKEY_free(pkey);
+ }
+ }
if (dsa == NULL) {
BIO_printf(bio_err, "unable to load Key\n");
@@ -181,7 +189,7 @@ int dsa_main(int argc, char **argv)
if (text) {
assert(pubin || private);
- if (!EVP_PKEY_print_private(out, pkey, 0, NULL)) {
+ if (!DSA_print(out, dsa, 0)) {
perror(outfile);
ERR_print_errors(bio_err);
goto end;
@@ -257,7 +265,6 @@ int dsa_main(int argc, char **argv)
}
ret = 0;
end:
- EVP_PKEY_free(pkey);
BIO_free_all(out);
DSA_free(dsa);
release_engine(e);