diff options
author | Andy Polyakov <appro@openssl.org> | 2018-03-02 22:16:29 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2018-03-03 22:03:44 +0100 |
commit | 9cbcea7e68f0e805109d7d253c31f02ba37b3b2b (patch) | |
tree | 117037759ac91a2c17883d865a9ed55efeeff6a8 /crypto | |
parent | ec/curve448/curve448.c: fix undefined behaviour sanitizer failure. (diff) | |
download | openssl-9cbcea7e68f0e805109d7d253c31f02ba37b3b2b.tar.xz openssl-9cbcea7e68f0e805109d7d253c31f02ba37b3b2b.zip |
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@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5494)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ec/curve448/f_generic.c | 4 | ||||
-rw-r--r-- | crypto/ec/curve448/scalar.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crypto/ec/curve448/f_generic.c b/crypto/ec/curve448/f_generic.c index 6babea6e41..ed8f36d868 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 0f14bc4b98..b5702c0255 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; |