Mercurial > dropbear
comparison genrsa.c @ 478:d4f32c3443ac dbclient-netcat-alike
propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2)
to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 14 Sep 2008 06:47:51 +0000 |
parents | 657c045054ab |
children | b50f0107e505 76097ec1a29a |
comparison
equal
deleted
inserted
replaced
296:6b41e2cbf071 | 478:d4f32c3443ac |
---|---|
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); |