Mercurial > dropbear
comparison genrsa.c @ 477:657c045054ab
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)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 12 Sep 2008 17:48:33 +0000 |
parents | c9483550701b |
children | b50f0107e505 76097ec1a29a |
comparison
equal
deleted
inserted
replaced
474:f33b0898aaa6 | 477:657c045054ab |
---|---|
60 if (mp_set_int(key->e, RSA_E) != MP_OKAY) { | 60 if (mp_set_int(key->e, RSA_E) != MP_OKAY) { |
61 fprintf(stderr, "rsa generation failed\n"); | 61 fprintf(stderr, "rsa generation failed\n"); |
62 exit(1); | 62 exit(1); |
63 } | 63 } |
64 | 64 |
65 /* PuTTY doesn't like it if the modulus isn't a multiple of 8 bits, | |
66 * so we just generate them until we get one which is OK */ | |
67 getrsaprime(key->p, &pminus, key->e, size/2); | 65 getrsaprime(key->p, &pminus, key->e, size/2); |
68 do { | 66 getrsaprime(key->q, &qminus, key->e, size/2); |
69 getrsaprime(key->q, &qminus, key->e, size/2); | |
70 | 67 |
71 if (mp_mul(key->p, key->q, key->n) != MP_OKAY) { | 68 if (mp_mul(key->p, key->q, key->n) != MP_OKAY) { |
72 fprintf(stderr, "rsa generation failed\n"); | 69 fprintf(stderr, "rsa generation failed\n"); |
73 exit(1); | 70 exit(1); |
74 } | 71 } |
75 } while (mp_count_bits(key->n) % 8 != 0); | |
76 | 72 |
77 /* lcm(p-1, q-1) */ | 73 /* lcm(p-1, q-1) */ |
78 if (mp_lcm(&pminus, &qminus, &lcm) != MP_OKAY) { | 74 if (mp_lcm(&pminus, &qminus, &lcm) != MP_OKAY) { |
79 fprintf(stderr, "rsa generation failed\n"); | 75 fprintf(stderr, "rsa generation failed\n"); |
80 exit(1); | 76 exit(1); |