Remove workaround forcing rsa mpint to exactly a 8 bits multiple for putty (see

http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/rsa-non8mult-verify-fail.html ,
was fixed in 2004)

--HG--
extra : convert_revision : f21045c791002d81fc6b8dde6537ea481e513eb2
This commit is contained in:
Matt Johnston 2008-09-12 17:48:33 +00:00
parent f90f64b5c1
commit 460bf43822

View File

@ -62,17 +62,13 @@ rsa_key * gen_rsa_priv_key(unsigned int size) {
exit(1);
}
/* PuTTY doesn't like it if the modulus isn't a multiple of 8 bits,
* so we just generate them until we get one which is OK */
getrsaprime(key->p, &pminus, key->e, size/2);
do {
getrsaprime(key->q, &qminus, key->e, size/2);
getrsaprime(key->q, &qminus, key->e, size/2);
if (mp_mul(key->p, key->q, key->n) != MP_OKAY) {
fprintf(stderr, "rsa generation failed\n");
exit(1);
}
} while (mp_count_bits(key->n) % 8 != 0);
if (mp_mul(key->p, key->q, key->n) != MP_OKAY) {
fprintf(stderr, "rsa generation failed\n");
exit(1);
}
/* lcm(p-1, q-1) */
if (mp_lcm(&pminus, &qminus, &lcm) != MP_OKAY) {