mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-11-12 16:41:03 +03:00
When a random number is generated for the Miller-Rabin primality test, if the bit length of the random number is larger than the number being tested, the random number is shifted right to have the same bit length. This introduces bias, as the random number is now guaranteed to be larger than 2^(bit length-1). Changing this to instead zero all bits higher than the tested numbers bit length will remove this bias and keep the random number being uniformly generated.
59 KiB
59 KiB