From: Philip Prindeville Date: Wed, 26 Jan 2022 03:42:18 +0000 (-0700) Subject: Use progress_cb in genrsa X-Git-Tag: openssl-3.2.0-alpha1~3010 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=261b399fd7b1f4339e6d0fa3ee37b32b81d9d9e0;p=thirdparty%2Fopenssl.git Use progress_cb in genrsa Signed-off-by: Philip Prindeville Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17336) --- diff --git a/apps/genrsa.c b/apps/genrsa.c index 9d0fea76460..1d10431b2ac 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -29,8 +29,6 @@ static int verbose = 0; -static int genrsa_cb(EVP_PKEY_CTX *ctx); - typedef enum OPTION_choice { OPT_COMMON, #ifndef OPENSSL_NO_DEPRECATED_3_0 @@ -180,7 +178,7 @@ opthelp: if (!init_gen_str(&ctx, "RSA", eng, 0, NULL, NULL)) goto end; - EVP_PKEY_CTX_set_cb(ctx, genrsa_cb); + EVP_PKEY_CTX_set_cb(ctx, progress_cb); EVP_PKEY_CTX_set_app_data(ctx, bio_err); if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, num) <= 0) { @@ -243,24 +241,3 @@ opthelp: return ret; } -static int genrsa_cb(EVP_PKEY_CTX *ctx) -{ - char c = '*'; - BIO *b = EVP_PKEY_CTX_get_app_data(ctx); - int p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); - - if (!verbose) - return 1; - - if (p == 0) - c = '.'; - if (p == 1) - c = '+'; - if (p == 2) - c = '*'; - if (p == 3) - c = '\n'; - BIO_write(b, &c, 1); - (void)BIO_flush(b); - return 1; -}