[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Tue May 31 14:14:49 UTC 2016


The branch master has been updated
       via  dab1f5fe4be0ca49b3aa382f0bfdcbf8c8855903 (commit)
      from  f72f00d49549c6620d7101f5e9bf7963da6df9ee (commit)


- Log -----------------------------------------------------------------
commit dab1f5fe4be0ca49b3aa382f0bfdcbf8c8855903
Author: Cristian Stoica <cristian.stoica at nxp.com>
Date:   Tue May 17 18:40:14 2016 +0300

    speed.c: fix segfault with unrecognized algorithms
    
    When an unrecognized algorithm is given on command line together with
    -async_jobs, speed_main will jump to clean-up and run
    ASYNC_cleanup_thread without calling ASYNC_init_thread first.
    
    Example:
    openssl speed -async_jobs 4 ras2048
    
    Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1084)

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

Summary of changes:
 apps/speed.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/apps/speed.c b/apps/speed.c
index 139295c..3b162e1 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -1192,6 +1192,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_
 int speed_main(int argc, char **argv)
 {
     loopargs_t *loopargs = NULL;
+    int async_init = 0;
     int loopargs_len = 0;
     char *prog;
     const EVP_CIPHER *evp_cipher = NULL;
@@ -1518,7 +1519,8 @@ int speed_main(int argc, char **argv)
 
     /* Initialize the job pool if async mode is enabled */
     if (async_jobs > 0) {
-        if (!ASYNC_init_thread(async_jobs, async_jobs)) {
+        async_init = ASYNC_init_thread(async_jobs, async_jobs);
+        if (!async_init) {
             BIO_printf(bio_err, "Error creating the ASYNC job pool\n");
             goto end;
         }
@@ -2799,7 +2801,9 @@ int speed_main(int argc, char **argv)
     if (async_jobs > 0) {
         for (i = 0; i < loopargs_len; i++)
             ASYNC_WAIT_CTX_free(loopargs[i].wait_ctx);
+    }
 
+    if (async_init) {
         ASYNC_cleanup_thread();
     }
     OPENSSL_free(loopargs);


More information about the openssl-commits mailing list