Style nit. Output parameters should be prefixed with out_. Change-Id: I7ba9ef6f666301140127fdf5d747cfe3755cf53e Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/37788 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/bn/prime.c b/crypto/fipsmodule/bn/prime.c index 29eff26..c030c9e 100644 --- a/crypto/fipsmodule/bn/prime.c +++ b/crypto/fipsmodule/bn/prime.c
@@ -594,10 +594,10 @@ return bn_trial_division(&prime, bn) && !BN_is_word(bn, prime); } -int BN_primality_test(int *is_probably_prime, const BIGNUM *w, +int BN_primality_test(int *out_is_probably_prime, const BIGNUM *w, int iterations, BN_CTX *ctx, int do_trial_division, BN_GENCB *cb) { - *is_probably_prime = 0; + *out_is_probably_prime = 0; // To support RSA key generation, this function should treat |w| as secret if // it is a large prime. Composite numbers are discarded, so they may return @@ -609,13 +609,13 @@ if (!BN_is_odd(w)) { // The only even prime is two. - *is_probably_prime = BN_is_word(w, 2); + *out_is_probably_prime = BN_is_word(w, 2); return 1; } // Miller-Rabin does not work for three. if (BN_is_word(w, 3)) { - *is_probably_prime = 1; + *out_is_probably_prime = 1; return 1; } @@ -623,7 +623,7 @@ // Perform additional trial division checks to discard small primes. uint16_t prime; if (bn_trial_division(&prime, w)) { - *is_probably_prime = BN_is_word(w, prime); + *out_is_probably_prime = BN_is_word(w, prime); return 1; } if (!BN_GENCB_call(cb, 1, -1)) { @@ -771,7 +771,7 @@ // Step 4.6. We did not see z = w-1 before z = 1, so w must be composite. // (For any prime, the value of z immediately preceding 1 must be -1. // There are no non-trivial square roots of 1 modulo a prime.) - *is_probably_prime = 0; + *out_is_probably_prime = 0; ret = 1; goto err; } @@ -783,7 +783,7 @@ } assert(uniform_iterations >= (crypto_word_t)iterations); - *is_probably_prime = 1; + *out_is_probably_prime = 1; ret = 1; err: