diff options
author | Philip Prindeville <philipp@redfish-solutions.com> | 2021-12-21 22:00:38 -0700 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-01-21 15:44:28 +0100 |
commit | e1cd94f2dca4056ce042c62b89c468dffc088033 (patch) | |
tree | ee3ca7b476be8d96f92109f03c419b9fd0d11b27 /apps/dsaparam.c | |
parent | 8c2e588bcf0de61880ec8a956ef57ad6b8a50163 (diff) | |
download | openssl-new-e1cd94f2dca4056ce042c62b89c468dffc088033.tar.gz |
Standardize progress callback for dhparam, dsaparam, etc.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17359)
Diffstat (limited to 'apps/dsaparam.c')
-rw-r--r-- | apps/dsaparam.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 08f912340a..708cb9a648 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -11,7 +11,6 @@ #include <stdio.h> #include <stdlib.h> -#include "apps.h" #include <time.h> #include <string.h> #include "apps.h" @@ -25,8 +24,6 @@ static int verbose = 0; -static int gendsa_cb(EVP_PKEY_CTX *ctx); - typedef enum OPTION_choice { OPT_COMMON, OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, @@ -160,9 +157,9 @@ int dsaparam_main(int argc, char **argv) " Your key size is %d! Larger key size may behave not as expected.\n", OPENSSL_DSA_MAX_MODULUS_BITS, numbits); - EVP_PKEY_CTX_set_cb(ctx, gendsa_cb); EVP_PKEY_CTX_set_app_data(ctx, bio_err); if (verbose) { + EVP_PKEY_CTX_set_cb(ctx, progress_cb); BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n", num); BIO_printf(bio_err, "This could take some time\n"); @@ -235,21 +232,3 @@ int dsaparam_main(int argc, char **argv) return ret; } -static int gendsa_cb(EVP_PKEY_CTX *ctx) -{ - static const char symbols[] = ".+*\n"; - int p; - char c; - BIO *b; - - if (!verbose) - return 1; - - b = EVP_PKEY_CTX_get_app_data(ctx); - p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); - c = (p >= 0 && (size_t)p < sizeof(symbols) - 1) ? symbols[p] : '?'; - - BIO_write(b, &c, 1); - (void)BIO_flush(b); - return 1; -} |