]> git.rm.cloudns.org Git - xonotic/d0_blind_id.git/commitdiff
use is_prime_fasttest for the quick primality test
authorRudolf Polzer <divverent@alientrap.org>
Thu, 2 Sep 2010 07:57:55 +0000 (09:57 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 2 Sep 2010 07:57:55 +0000 (09:57 +0200)
d0_bignum-openssl.c

index 9feba372ce4c61fef80308dad08fbc1db18b35b6..c8316906f6b9a0b2d9327cbf852221934b6d2819 100644 (file)
@@ -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)