]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add config option for speed command
authorKan <chenxinpingc2306@163.com>
Tue, 21 Jun 2022 06:55:55 +0000 (14:55 +0800)
committerPauli <pauli@openssl.org>
Mon, 11 Jul 2022 00:01:17 +0000 (10:01 +1000)
Fixed #16986

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

apps/speed.c
doc/man1/openssl-speed.pod.in

index c56f8e69f6872ec9079a8e4f841939a21d64bd6d..65220d31f1a8275b6e5d433f9ae50fe4df5f1ed4 100644 (file)
@@ -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;
 }
 
index 9ec4dce2f7c24f9fafd613c699474f43ca7dcd1f..8fa78ead41770c3ecd68ed8fe549ae27d8b230d9 100644 (file)
@@ -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>]
@@ -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