[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Mon Sep 10 16:27:46 UTC 2018


The branch master has been updated
       via  52307f94f8f3e5a1cd392f0a48802a24ccf73ba2 (commit)
      from  6ccfc8fa316f8dcfe4c943e5a43e9e3661be9cb1 (commit)


- Log -----------------------------------------------------------------
commit 52307f94f8f3e5a1cd392f0a48802a24ccf73ba2
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Sep 10 16:03:14 2018 +0100

    Don't cast an int * to a size_t *
    
    If sizeof(int) != sizeof(size_t) this may not work correctly.
    
    Fixes a Coverity issue.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/7168)

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

Summary of changes:
 apps/speed.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/apps/speed.c b/apps/speed.c
index c859c86..a487917 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -600,6 +600,7 @@ typedef struct loopargs_st {
     unsigned char *buf2_malloc;
     unsigned char *key;
     unsigned int siglen;
+    size_t sigsize;
 #ifndef OPENSSL_NO_RSA
     RSA *rsa_key[RSA_NUM];
 #endif
@@ -1185,11 +1186,11 @@ static int EdDSA_sign_loop(void *args)
     unsigned char *buf = tempargs->buf;
     EVP_MD_CTX **edctx = tempargs->eddsa_ctx;
     unsigned char *eddsasig = tempargs->buf2;
-    unsigned int *eddsasiglen = &tempargs->siglen;
+    size_t *eddsasigsize = &tempargs->sigsize;
     int ret, count;
 
     for (count = 0; COND(eddsa_c[testnum][0]); count++) {
-        ret = EVP_DigestSign(edctx[testnum], eddsasig, (size_t *)eddsasiglen, buf, 20);
+        ret = EVP_DigestSign(edctx[testnum], eddsasig, eddsasigsize, buf, 20);
         if (ret == 0) {
             BIO_printf(bio_err, "EdDSA sign failure\n");
             ERR_print_errors(bio_err);
@@ -1206,11 +1207,11 @@ static int EdDSA_verify_loop(void *args)
     unsigned char *buf = tempargs->buf;
     EVP_MD_CTX **edctx = tempargs->eddsa_ctx;
     unsigned char *eddsasig = tempargs->buf2;
-    unsigned int eddsasiglen = tempargs->siglen;
+    size_t eddsasigsize = tempargs->sigsize;
     int ret, count;
 
     for (count = 0; COND(eddsa_c[testnum][1]); count++) {
-        ret = EVP_DigestVerify(edctx[testnum], eddsasig, eddsasiglen, buf, 20);
+        ret = EVP_DigestVerify(edctx[testnum], eddsasig, eddsasigsize, buf, 20);
         if (ret != 1) {
             BIO_printf(bio_err, "EdDSA verify failure\n");
             ERR_print_errors(bio_err);
@@ -1525,7 +1526,7 @@ int speed_main(int argc, char **argv)
         const char *name;
         unsigned int nid;
         unsigned int bits;
-        unsigned int siglen;
+        size_t sigsize;
     } test_ed_curves[] = {
         /* EdDSA */
         {"Ed25519", NID_ED25519, 253, 64},
@@ -3101,9 +3102,9 @@ int speed_main(int argc, char **argv)
         } else {
             for (i = 0; i < loopargs_len; i++) {
                 /* Perform EdDSA signature test */
-                loopargs[i].siglen = test_ed_curves[testnum].siglen;
+                loopargs[i].sigsize = test_ed_curves[testnum].sigsize;
                 st = EVP_DigestSign(loopargs[i].eddsa_ctx[testnum],
-                                    loopargs[i].buf2, (size_t *)&loopargs[i].siglen,
+                                    loopargs[i].buf2, &loopargs[i].sigsize,
                                     loopargs[i].buf, 20);
                 if (st == 0)
                     break;
@@ -3133,7 +3134,7 @@ int speed_main(int argc, char **argv)
             /* Perform EdDSA verification test */
             for (i = 0; i < loopargs_len; i++) {
                 st = EVP_DigestVerify(loopargs[i].eddsa_ctx[testnum],
-                                      loopargs[i].buf2, loopargs[i].siglen,
+                                      loopargs[i].buf2, loopargs[i].sigsize,
                                       loopargs[i].buf, 20);
                 if (st != 1)
                     break;


More information about the openssl-commits mailing list