From: Kan Date: Tue, 21 Jun 2022 06:55:55 +0000 (+0800) Subject: Add config option for speed command X-Git-Tag: openssl-3.2.0-alpha1~2414 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8403c7350fd836ea44baf69c0b7dc3af1189253f;p=thirdparty%2Fopenssl.git Add config option for speed command Fixed #16986 Reviewed-by: Todd Short Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18616) --- diff --git a/apps/speed.c b/apps/speed.c index c56f8e69f68..65220d31f1a 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -210,7 +210,7 @@ static int opt_found(const char *name, unsigned int *result, typedef enum OPTION_choice { OPT_COMMON, OPT_ELAPSED, OPT_EVP, OPT_HMAC, OPT_DECRYPT, OPT_ENGINE, OPT_MULTI, - OPT_MR, OPT_MB, OPT_MISALIGN, OPT_ASYNCJOBS, OPT_R_ENUM, OPT_PROV_ENUM, + OPT_MR, OPT_MB, OPT_MISALIGN, OPT_ASYNCJOBS, OPT_R_ENUM, OPT_PROV_ENUM, OPT_CONFIG, OPT_PRIMES, OPT_SECONDS, OPT_BYTES, OPT_AEAD, OPT_CMAC } OPTION_CHOICE; @@ -237,6 +237,7 @@ const OPTIONS speed_options[] = { {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, #endif {"primes", OPT_PRIMES, 'p', "Specify number of primes (for RSA only)"}, + OPT_CONFIG_OPTION, OPT_SECTION("Selection"), {"evp", OPT_EVP, 's', "Use EVP-named cipher or digest"}, @@ -1342,6 +1343,7 @@ static EVP_PKEY *get_ecdsa(const EC_CURVE *curve) int speed_main(int argc, char **argv) { + CONF *conf = NULL; ENGINE *e = NULL; loopargs_t *loopargs = NULL; const char *prog; @@ -1598,6 +1600,11 @@ int speed_main(int argc, char **argv) if (!opt_provider(o)) goto end; break; + case OPT_CONFIG: + conf = app_load_config_modules(opt_arg()); + if (conf == NULL) + goto end; + break; case OPT_PRIMES: primes = opt_int_arg(); break; @@ -3350,6 +3357,7 @@ int speed_main(int argc, char **argv) release_engine(e); EVP_CIPHER_free(evp_cipher); EVP_MAC_free(mac); + NCONF_free(conf); return ret; } diff --git a/doc/man1/openssl-speed.pod.in b/doc/man1/openssl-speed.pod.in index 9ec4dce2f7c..8fa78ead417 100644 --- a/doc/man1/openssl-speed.pod.in +++ b/doc/man1/openssl-speed.pod.in @@ -9,6 +9,7 @@ openssl-speed - test library performance B [B<-help>] +[B<-config> I] [B<-elapsed>] [B<-evp> I] [B<-hmac> I] @@ -39,6 +40,12 @@ This command is used to test the performance of cryptographic algorithms. Print out a usage message. +=item B<-config> I + +Specifies the configuration file to use. +Optional; for a description of the default value, +see L. + =item B<-elapsed> When calculating operations- or bytes-per-second, use wall-clock time