mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-28 00:39:56 +00:00
The library rejected an RNG input of all-bits-zero, which led to the key 2^{254} (for Curve25519) having a 31/32 chance of being generated compared to other keys. This had no practical impact because the probability of non-compliance was 2^{-256}, but needlessly complicated the code. The exception was added in 98e28a74e33f32bcb855e16f8d5d2016b2102129 to avoid the case where b - 1 wraps because b is 0. Instead, change the comparison code to avoid calculating b - 1. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>