[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Tue Oct 10 13:25:43 UTC 2017


The branch master has been updated
       via  65e6b9a42364d7dd1108d952ff1c58f3b911ddc0 (commit)
      from  751b26b13256b9918bdb7f833fb7d701f115ab2e (commit)


- Log -----------------------------------------------------------------
commit 65e6b9a42364d7dd1108d952ff1c58f3b911ddc0
Author: Patrick Steuer <patrick.steuer at de.ibm.com>
Date:   Sat Oct 7 11:38:19 2017 +0200

    apps/speed.c: add 'rand' algo to enable DRBG performance measurements.
    
    Signed-off-by: Patrick Steuer <patrick.steuer at de.ibm.com>
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4481)

-----------------------------------------------------------------------

Summary of changes:
 apps/speed.c       | 30 ++++++++++++++++++++++++++++--
 doc/man1/speed.pod |  3 ++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/apps/speed.c b/apps/speed.c
index 942810b..44aeb44 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -115,7 +115,7 @@
 #define BUFSIZE (1024*16+1)
 #define MAX_MISALIGNMENT 63
 
-#define ALGOR_NUM       30
+#define ALGOR_NUM       31
 #define SIZE_NUM        6
 #define RSA_NUM         7
 #define DSA_NUM         3
@@ -192,6 +192,7 @@ static int AES_cbc_256_encrypt_loop(void *args);
 static int AES_ige_192_encrypt_loop(void *args);
 static int AES_ige_256_encrypt_loop(void *args);
 static int CRYPTO_gcm128_aad_loop(void *args);
+static int RAND_bytes_loop(void *args);
 static int EVP_Update_loop(void *args);
 static int EVP_Update_loop_ccm(void *args);
 static int EVP_Digest_loop(void *args);
@@ -226,7 +227,8 @@ static const char *names[ALGOR_NUM] = {
     "aes-128 cbc", "aes-192 cbc", "aes-256 cbc",
     "camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc",
     "evp", "sha256", "sha512", "whirlpool",
-    "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash"
+    "aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash",
+    "rand"
 };
 
 static double results[ALGOR_NUM][SIZE_NUM];
@@ -397,6 +399,7 @@ const OPTIONS speed_options[] = {
 #define D_IGE_192_AES   27
 #define D_IGE_256_AES   28
 #define D_GHASH         29
+#define D_RAND          30
 static OPT_PAIR doit_choices[] = {
 #ifndef OPENSSL_NO_MD2
     {"md2", D_MD2},
@@ -462,6 +465,7 @@ static OPT_PAIR doit_choices[] = {
     {"cast5", D_CBC_CAST},
 #endif
     {"ghash", D_GHASH},
+    {"rand", D_RAND},
     {NULL}
 };
 
@@ -835,6 +839,17 @@ static int CRYPTO_gcm128_aad_loop(void *args)
     return count;
 }
 
+static int RAND_bytes_loop(void *args)
+{
+    loopargs_t *tempargs = *(loopargs_t **) args;
+    unsigned char *buf = tempargs->buf;
+    int count;
+
+    for (count = 0; COND(c[D_RAND][testnum]); count++)
+        RAND_bytes(buf, lengths[testnum]);
+    return count;
+}
+
 static long save_count = 0;
 static int decrypt = 0;
 static int EVP_Update_loop(void *args)
@@ -1698,6 +1713,7 @@ int speed_main(int argc, char **argv)
     c[D_IGE_192_AES][0] = count;
     c[D_IGE_256_AES][0] = count;
     c[D_GHASH][0] = count;
+    c[D_RAND][0] = count;
 
     for (i = 1; i < SIZE_NUM; i++) {
         long l0, l1;
@@ -1716,6 +1732,7 @@ int speed_main(int argc, char **argv)
         c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1;
         c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1;
         c[D_GHASH][i] = c[D_GHASH][0] * 4 * l0 / l1;
+        c[D_RAND][i] = c[D_RAND][0] * 4 * l0 / l1;
 
         l0 = (long)lengths[i - 1];
 
@@ -2296,6 +2313,15 @@ int speed_main(int argc, char **argv)
         }
     }
 #endif
+    if (doit[D_RAND]) {
+        for (testnum = 0; testnum < SIZE_NUM; testnum++) {
+            print_message(names[D_RAND], c[D_RAND][testnum], lengths[testnum]);
+            Time_F(START);
+            count = run_benchmark(async_jobs, RAND_bytes_loop, loopargs);
+            d = Time_F(STOP);
+            print_result(D_RAND, testnum, count, d);
+        }
+    }
 
     if (doit[D_EVP]) {
         if (multiblock && evp_cipher) {
diff --git a/doc/man1/speed.pod b/doc/man1/speed.pod
index 0e5bb57..647c59f 100644
--- a/doc/man1/speed.pod
+++ b/doc/man1/speed.pod
@@ -20,7 +20,8 @@ B<openssl speed>
 
 This command is used to test the performance of cryptographic algorithms.
 To see the list of supported algorithms, use the I<list --digest-commands>
-or I<list --cipher-commands> command.
+or I<list --cipher-commands> command. The global CSPRNG is denoted by
+the I<rand> algorithm name.
 
 =head1 OPTIONS
 


More information about the openssl-commits mailing list