When building with Visual Studio 2008, I get the following warning: C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
If '1UL' is an unsigned 32-bit value, the result of shifting it by more than 32 bits is *undefined*. The compiler isn't obliged to convert it to a 64-bit value for us — hence the warning. We're lucky it noticed, in fact. Make the value explicitly 64-bit before doing the shift, and everything should be OK. We do it by casting to (uint64_t) since support for the ULL suffix isn't ubiquitous, --- In fact perhaps this could be expressed differently as if (N >> (16 * r)) but I figured I'd leave it in basically its original form. crypto/evp/scrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/evp/scrypt.c b/crypto/evp/scrypt.c index 09dfdf2..4254abf 100644 --- a/crypto/evp/scrypt.c +++ b/crypto/evp/scrypt.c @@ -227,7 +227,7 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen, */ if (16 * r <= LOG2_UINT64_MAX) { - if (N >= (1UL << (16 * r))) + if (N >= (((uint64_t)1) << (16 * r))) return 0; } -- 2.4.3 -- David Woodhouse Open Source Technology Centre david.woodho...@intel.com Intel Corporation
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ openssl-bugs-mod mailing list openssl-bugs-...@openssl.org https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod
_______________________________________________ openssl-dev mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev