Skip to content

Commit

Permalink
Add config option for speed command
Browse files Browse the repository at this point in the history
Fixed #16986

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #18616)

(cherry picked from commit 8403c73)
  • Loading branch information
KanPlus authored and t8m committed Nov 23, 2022
1 parent b800396 commit a193030
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/speed.c
Expand Up @@ -211,7 +211,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;

Expand All @@ -234,6 +234,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"},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
7 changes: 7 additions & 0 deletions doc/man1/openssl-speed.pod.in
Expand Up @@ -9,6 +9,7 @@ openssl-speed - test library performance

B<openssl speed>
[B<-help>]
[B<-config> I<filename>]
[B<-elapsed>]
[B<-evp> I<algo>]
[B<-hmac> I<algo>]
Expand Down Expand Up @@ -39,6 +40,12 @@ This command is used to test the performance of cryptographic algorithms.

Print out a usage message.

=item B<-config> I<filename>

Specifies the configuration file to use.
Optional; for a description of the default value,
see L<openssl(1)/COMMAND SUMMARY>.

=item B<-elapsed>

When calculating operations- or bytes-per-second, use wall-clock time
Expand Down

0 comments on commit a193030

Please sign in to comment.