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/genpkey.c | |
parent | 8c2e588bcf0de61880ec8a956ef57ad6b8a50163 (diff) |
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/genpkey.c')
-rw-r--r-- | apps/genpkey.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/apps/genpkey.c b/apps/genpkey.c index f4c8f92c34..0f2a97137a 100644 --- a/apps/genpkey.c +++ b/apps/genpkey.c @@ -19,8 +19,6 @@ static int quiet; static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e, OSSL_LIB_CTX *libctx, const char *propq); -static int genpkey_cb(EVP_PKEY_CTX *ctx); - typedef enum OPTION_choice { OPT_COMMON, OPT_ENGINE, OPT_OUTFORM, OPT_OUT, OPT_PASS, OPT_PARAMFILE, @@ -181,7 +179,8 @@ int genpkey_main(int argc, char **argv) if (out == NULL) goto end; - EVP_PKEY_CTX_set_cb(ctx, genpkey_cb); + if (!quiet) + EVP_PKEY_CTX_set_cb(ctx, progress_cb); EVP_PKEY_CTX_set_app_data(ctx, bio_err); pkey = do_param ? app_paramgen(ctx, algname) @@ -319,27 +318,3 @@ int init_gen_str(EVP_PKEY_CTX **pctx, } -static int genpkey_cb(EVP_PKEY_CTX *ctx) -{ - char c = '*'; - BIO *b = EVP_PKEY_CTX_get_app_data(ctx); - - if (quiet) - return 1; - - switch (EVP_PKEY_CTX_get_keygen_info(ctx, 0)) { - case 0: - c = '.'; - break; - case 1: - c = '+'; - break; - case 3: - c = '\n'; - break; - } - - BIO_write(b, &c, 1); - (void)BIO_flush(b); - return 1; -} |