diff options
author | Felix Laurie von Massenbach <felix@erbridge.co.uk> | 2014-05-27 00:37:03 +0100 |
---|---|---|
committer | Ben Laurie <ben@links.org> | 2014-06-01 15:31:26 +0100 |
commit | b0513819e043b13692c9e923adf5aafa26cddec0 (patch) | |
tree | 2d84e04d840d932c7858e5de5df10c6db6e55010 /apps/speed.c | |
parent | b359642ffd0ae9dff8e1eb7d871356c99b093f57 (diff) |
Add a method to generate a prime that is guaranteed not to be divisible by 3 or 5.
Possibly some reduction in bias, but no speed gains.
Diffstat (limited to 'apps/speed.c')
-rw-r--r-- | apps/speed.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/speed.c b/apps/speed.c index 885784ee1d..84d0829ad2 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -2041,6 +2041,29 @@ int MAIN(int argc, char **argv) BN_free(rnd); } + + if (prime_doit[D_PRIME_COPRIME]) + { + BIGNUM *rnd = BN_new(); + BIGNUM *add = BN_new(); + BN_CTX *ctx = BN_CTX_new(); + + BN_set_word(add, 2); + prime_print_message(prime_names[D_PRIME_COPRIME], + prime_c[D_PRIME_COPRIME]); + + Time_F(START); + for (count=0, run=1; COND(prime_c[D_PRIME_COPRIME]); count++) + bn_probable_prime_dh_coprime(rnd, 1024, add, NULL, ctx); + + d=Time_F(STOP); + prime_print_result(D_PRIME_COPRIME, count, d); + + BN_CTX_free(ctx); + BN_free(add); + BN_free(rnd); + + } RAND_pseudo_bytes(buf,36); #ifndef OPENSSL_NO_RSA |