summaryrefslogtreecommitdiffhomepage
path: root/genrsa.c
diff options
context:
space:
mode:
authorSteffen Jaeckel <s_jaeckel@gmx.de>2019-09-16 15:50:38 +0200
committerMatt Johnston <matt@ucc.asn.au>2019-09-16 21:50:38 +0800
commit615ed4e46a52b6bfe0bfc581b8c2fbcc6cc488d1 (patch)
tree12b2ba29ae4c42fc65d64d43968c5d03ab3f4452 /genrsa.c
parentfa116e983b4931010e1082dd5c8bf38bbc77718c (diff)
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
* make key-generation compliant to FIPS 186.4 * fix includes in tommath_class.h * update fuzzcorpus instead of error-out * fixup fuzzing make-targets * update Makefile.in * apply necessary patches to ltm sources * clean-up not required ltm files * update to vanilla ltm 1.1.0 this already only contains the required files * remove set/get double
Diffstat (limited to 'genrsa.c')
-rw-r--r--genrsa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/genrsa.c b/genrsa.c
index e9aca76..39c112e 100644
--- a/genrsa.c
+++ b/genrsa.c
@@ -95,6 +95,7 @@ static void getrsaprime(mp_int* prime, mp_int *primeminus,
mp_int* rsa_e, unsigned int size_bytes) {
unsigned char *buf;
+ int trials;
DEF_MP_INT(temp_gcd);
buf = (unsigned char*)m_malloc(size_bytes);
@@ -108,8 +109,9 @@ static void getrsaprime(mp_int* prime, mp_int *primeminus,
bytes_to_mp(prime, buf, size_bytes);
- /* find the next integer which is prime, 8 round of miller-rabin */
- if (mp_prime_next_prime(prime, 8, 0) != MP_OKAY) {
+ /* find the next integer which is prime */
+ trials = mp_prime_rabin_miller_trials(mp_count_bits(prime));
+ if (mp_prime_next_prime(prime, trials, 0) != MP_OKAY) {
fprintf(stderr, "RSA generation failed\n");
exit(1);
}