diff options
author | Pauli <paul.dale@oracle.com> | 2020-10-20 13:32:26 +1000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-12-17 21:09:54 +0100 |
commit | 47422549da431cf9546a148d916d162e196fcd44 (patch) | |
tree | a09cdee887b43d97878a2c1382b6df8b48fddc5e /apps/gendsa.c | |
parent | 575b36ecefca4eff181210ff1eeb3a3dcfbf5456 (diff) |
dsa: apps deprecation changes
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13638)
Diffstat (limited to 'apps/gendsa.c')
-rw-r--r-- | apps/gendsa.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/apps/gendsa.c b/apps/gendsa.c index d525f7093b..c90a01d979 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -54,7 +54,6 @@ int gendsa_main(int argc, char **argv) { ENGINE *e = NULL; BIO *out = NULL, *in = NULL; - DSA *dsa = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *ctx = NULL; const EVP_CIPHER *enc = NULL; @@ -117,38 +116,18 @@ int gendsa_main(int argc, char **argv) goto end; } - in = bio_open_default(dsaparams, 'r', FORMAT_PEM); - if (in == NULL) - goto end2; - - if ((dsa = PEM_read_bio_DSAparams(in, NULL, NULL, NULL)) == NULL) { - BIO_printf(bio_err, "unable to load DSA parameter file\n"); - goto end; - } - BIO_free(in); - in = NULL; + pkey = load_keyparams(dsaparams, 1, "DSA", "DSA parameters"); out = bio_open_owner(outfile, FORMAT_PEM, private); if (out == NULL) goto end2; - DSA_get0_pqg(dsa, &p, NULL, NULL); - - if (BN_num_bits(p) > OPENSSL_DSA_MAX_MODULUS_BITS) + if (EVP_PKEY_bits(pkey) > OPENSSL_DSA_MAX_MODULUS_BITS) BIO_printf(bio_err, "Warning: It is not recommended to use more than %d bit for DSA keys.\n" " Your key size is %d! Larger key size may behave not as expected.\n", - OPENSSL_DSA_MAX_MODULUS_BITS, BN_num_bits(p)); + OPENSSL_DSA_MAX_MODULUS_BITS, EVP_PKEY_bits(pkey)); - pkey = EVP_PKEY_new(); - if (pkey == NULL) { - BIO_printf(bio_err, "unable to allocate PKEY\n"); - goto end; - } - if (!EVP_PKEY_set1_DSA(pkey, dsa)) { - BIO_printf(bio_err, "unable to associate DSA parameters with PKEY\n"); - goto end; - } ctx = EVP_PKEY_CTX_new(pkey, NULL); if (ctx == NULL) { BIO_printf(bio_err, "unable to create PKEY context\n"); @@ -179,7 +158,6 @@ int gendsa_main(int argc, char **argv) end2: BIO_free(in); BIO_free_all(out); - DSA_free(dsa); EVP_PKEY_free(pkey); EVP_PKEY_CTX_free(ctx); release_engine(e); |