[openssl-commits] [openssl] master update

Andy Polyakov appro at openssl.org
Sat Mar 3 21:08:40 UTC 2018


The branch master has been updated
       via  9cbcea7e68f0e805109d7d253c31f02ba37b3b2b (commit)
       via  3ccbc5fff7904b2ac0858fb64fd3978e97fd2924 (commit)
      from  55a7f77d72930f9aee1a51e0af9658b2728be127 (commit)


- Log -----------------------------------------------------------------
commit 9cbcea7e68f0e805109d7d253c31f02ba37b3b2b
Author: Andy Polyakov <appro at openssl.org>
Date:   Fri Mar 2 22:16:29 2018 +0100

    ec/curve448/f_generic.c: fix VC-WIN32 debug build failure.
    
    Debugging asserts had implicit casts that triggered the warnings.
    However, instead of making the casts explicit it's more appropriate
    to perform checks that ensure that implicit casts were safe.
    
    ec/curve448/scalar.c: size_t-fy scalar_decode_short.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5494)

commit 3ccbc5fff7904b2ac0858fb64fd3978e97fd2924
Author: Andy Polyakov <appro at openssl.org>
Date:   Fri Mar 2 17:25:31 2018 +0100

    ec/curve448/curve448.c: fix undefined behaviour sanitizer failure.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5494)

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

Summary of changes:
 crypto/ec/curve448/curve448.c  | 2 +-
 crypto/ec/curve448/f_generic.c | 4 ++--
 crypto/ec/curve448/scalar.c    | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/crypto/ec/curve448/curve448.c b/crypto/ec/curve448/curve448.c
index 8ced622..7dc68c8 100644
--- a/crypto/ec/curve448/curve448.c
+++ b/crypto/ec/curve448/curve448.c
@@ -579,7 +579,7 @@ static int recode_wnaf(struct smvt_control *control,
             assert(position >= 0);
             if (odd & (1 << (table_bits + 1)))
                 delta -= (1 << (table_bits + 1));
-            current -= delta << pos;
+            current -= delta * (1 << pos);
             control[position].power = pos + 16 * (w - 1);
             control[position].addend = delta;
             position--;
diff --git a/crypto/ec/curve448/f_generic.c b/crypto/ec/curve448/f_generic.c
index 6babea6..ed8f36d 100644
--- a/crypto/ec/curve448/f_generic.c
+++ b/crypto/ec/curve448/f_generic.c
@@ -122,7 +122,7 @@ void gf_strong_reduce(gf a)
      * it was < p, so now scarry = -1 and this = x - p + 2^255 so let's add
      * back in p.  will carry back off the top for 2^255.
      */
-    assert(word_is_zero(scarry) | word_is_zero(scarry + 1));
+    assert(scarry == 0 || scarry == -1);
 
     scarry_0 = (word_t)scarry;
 
@@ -135,7 +135,7 @@ void gf_strong_reduce(gf a)
         carry >>= LIMB_PLACE_VALUE(LIMBPERM(i));
     }
 
-    assert(word_is_zero(carry + scarry_0));
+    assert(carry < 2 && ((word_t)carry + scarry_0) == 0);
 }
 
 /* Subtract two gf elements d=a-b */
diff --git a/crypto/ec/curve448/scalar.c b/crypto/ec/curve448/scalar.c
index 0f14bc4..b5702c0 100644
--- a/crypto/ec/curve448/scalar.c
+++ b/crypto/ec/curve448/scalar.c
@@ -135,9 +135,9 @@ void curve448_scalar_add(curve448_scalar_t out, const curve448_scalar_t a,
 
 static ossl_inline void scalar_decode_short(curve448_scalar_t s,
                                             const unsigned char *ser,
-                                            unsigned int nbytes)
+                                            size_t nbytes)
 {
-    unsigned int i, j, k = 0;
+    size_t i, j, k = 0;
 
     for (i = 0; i < C448_SCALAR_LIMBS; i++) {
         c448_word_t out = 0;


More information about the openssl-commits mailing list