From: Rudolf Polzer Date: Thu, 2 Sep 2010 07:57:55 +0000 (+0200) Subject: use is_prime_fasttest for the quick primality test X-Git-Tag: xonotic-v0.1.0preview~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0d9c60c64a7628d79882fd8ceb8d3aafc3548688;p=xonotic%2Fd0_blind_id.git use is_prime_fasttest for the quick primality test --- diff --git a/d0_bignum-openssl.c b/d0_bignum-openssl.c index 9feba37..c831690 100644 --- a/d0_bignum-openssl.c +++ b/d0_bignum-openssl.c @@ -309,7 +309,10 @@ BOOL d0_bignum_mod_inv(d0_bignum_t *r, const d0_bignum_t *a, const d0_bignum_t * int d0_bignum_isprime(d0_bignum_t *r, int param) { - return BN_is_prime(&r->z, param, NULL, ctx, NULL); + if(param <= 0) + return BN_is_prime_fasttest(&r->z, 1, NULL, ctx, NULL, 1); + else + return BN_is_prime(&r->z, param, NULL, ctx, NULL); } d0_bignum_t *d0_bignum_gcd(d0_bignum_t *r, d0_bignum_t *s, d0_bignum_t *t, const d0_bignum_t *a, const d0_bignum_t *b)