setting the two most significant bits assures an RSA modulus of maximum bit size

This commit is contained in:
Andreas Steffen
2010-03-15 15:13:26 +01:00
parent c0df187cb4
commit a3316c2b9f
@@ -149,8 +149,8 @@ static status_t compute_prime(private_gmp_rsa_private_key_t *this,
do
{
rng->allocate_bytes(rng, prime_size, &random_bytes);
/* make sure most significant bit is set */
random_bytes.ptr[0] = random_bytes.ptr[0] | 0x80;
/* make sure the two most significant bits are set */
random_bytes.ptr[0] = random_bytes.ptr[0] | 0xC0;
mpz_import(*prime, random_bytes.len, 1, 1, 1, 0, random_bytes.ptr);
mpz_nextprime (*prime, *prime);