summaryrefslogtreecommitdiffhomepage
path: root/genrsa.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2008-09-12 17:48:33 +0000
committerMatt Johnston <matt@ucc.asn.au>2008-09-12 17:48:33 +0000
commit460bf4382257a262fda862f66d6fe97c749f5bb7 (patch)
tree6e83edfab60dad4edf66b4c5e4cb93d89284ba2d /genrsa.c
parentf90f64b5c1a974a77a4bdf4a7ccb3f4d359b9127 (diff)
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
Diffstat (limited to 'genrsa.c')
-rw-r--r--genrsa.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/genrsa.c b/genrsa.c
index 73a7984..7e5ecd5 100644
--- a/genrsa.c
+++ b/genrsa.c
@@ -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) {