is -prime. The following tests are performed until one of them shows that -B

is composite; if B

passes all these tests, it is considered -prime. - -BN_is_prime_fasttest_ex(), when called with B, -first attempts trial division by a number of small primes; -if no divisors are found by this test and B is not B, -B is called. -If B, this test is skipped. - -Both BN_is_prime_ex() and BN_is_prime_fasttest_ex() perform a Miller-Rabin -probabilistic primality test with B iterations. If -B, a number of iterations is used that -yields a false positive rate of at most 2^-64 for random input. -The error rate depends on the size of the prime and goes down for bigger primes. -The rate is 2^-80 starting at 308 bits, 2^-112 at 852 bits, 2^-128 at 1080 bits, -2^-192 at 3747 bits and 2^-256 at 6394 bits. - -When the source of the prime is not random or not trusted, the number -of checks needs to be much higher to reach the same level of assurance: -It should equal half of the targeted security level in bits (rounded up to the -next integer if necessary). -For instance, to reach the 128 bit security level, B should be set to -64. - -If B is not B, B is called -after the j-th iteration (j = 0, 1, ...). B is a -pre-allocated B (to save the overhead of allocating and +BN_check_prime(), BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() +and BN_is_prime_fasttest() test if the number B

is prime. +The functions tests until one of the tests shows that B

is composite, +or all the tests passed. +If B

passes all these tests, it is considered a probable prime. + +The test performed on B

are trial division by a number of small primes +and rounds of the of the Miller-Rabin probabilistic primality test. + +The functions do at least 64 rounds of the Miller-Rabin test giving a maximum +false positive rate of 2^-128. +If the size of B