Mercurial > dropbear
diff genrsa.c @ 1655:f52919ffd3b1
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
author | Steffen Jaeckel <s_jaeckel@gmx.de> |
---|---|
date | Mon, 16 Sep 2019 15:50:38 +0200 |
parents | 750ec4ec4cbe |
children | 1051e4eea25a |
line wrap: on
line diff
--- a/genrsa.c Wed May 15 21:59:45 2019 +0800 +++ b/genrsa.c Mon Sep 16 15:50:38 2019 +0200 @@ -95,6 +95,7 @@ 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 @@ 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); }