boringssl/crypto/bn
David Benjamin a684152a2f Downgrade BN_kronecker to bn_jacobi and unexport.
We only ever compute it for odd (actually, prime) modulus as part of
BN_mod_sqrt.

If we cared, we could probably drop this from most binaries. This is
used to when modular square root needs Tonelli-Shanks.  Modular square
root is only used for compressed coordinates. Of our supported curves
(I'm handwaiving away EC_GROUP_new_curve_GFp here[*]), only P-224 needs
the full Tonelli-Shanks algorithm (p is 1 mod 8). That computes the
Legendre symbol a bunch to find a non-square mod p. But p is known at
compile-time, so we can just hard-code a sample non-square.

Sadly, BN_mod_sqrt has some callers outside of crypto/ec, so there's
also that. Anyway, it's also not that large of a function.

[*] Glancing through SEC 2 and Brainpool, secp224r1 is the only curve
listed in either document whose prime is not either 3 mod 4 or 5 mod 8.
Even 5 mod 8 is rare: only secp224k1. It's unlikely anyone would notice
if we broke annoying primes. Though OpenSSL does support "WTLS" curves
which has an additional 1 mod 8 case.

Change-Id: If36aa78c0d41253ec024f2d90692949515356cd1
Reviewed-on: https://boringssl-review.googlesource.com/15425
Reviewed-by: Adam Langley <agl@google.com>
2017-04-27 20:29:47 +00:00
..
asm Enable RSA AVX2 code. 2017-03-08 17:28:12 +00:00
add.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
bn_asn1.c Rename the BIGNUM ASN.1 functions. 2016-01-27 22:37:44 +00:00
bn_test.cc Tidy up primality code. 2017-04-21 19:04:21 +00:00
bn_tests.txt bn/asm/x86_64-mont5.pl: fix carry bug in bn_sqr8x_internal. 2017-01-26 18:29:44 +00:00
bn.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
check_bn_tests.go Fix mixed comment markers. 2016-08-01 14:52:39 +00:00
CMakeLists.txt Downgrade BN_kronecker to bn_jacobi and unexport. 2017-04-27 20:29:47 +00:00
cmp.c Add BN_is_pow2, BN_mod_pow2, and BN_nnmod_pow2. 2017-02-09 22:40:12 +00:00
convert.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
ctx.c Avoid needless C gymnastics. 2017-04-21 22:51:47 +00:00
div.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
exponentiation.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
gcd.c Remove BN_FLG_CONSTTIME. 2017-01-12 02:00:44 +00:00
generic.c Fix up macros. 2016-10-18 18:28:23 +00:00
internal.h Downgrade BN_kronecker to bn_jacobi and unexport. 2017-04-27 20:29:47 +00:00
jacobi.c Downgrade BN_kronecker to bn_jacobi and unexport. 2017-04-27 20:29:47 +00:00
montgomery_inv.c Calculate Montgomery RR without division. 2016-12-16 17:41:01 +00:00
montgomery.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
mul.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
prime.c Update BN_enhanced_miller_rabin_primality_test to enforce preconditions and accept BN_prime_checks. 2017-04-21 22:24:01 +00:00
random.c Move much of rand/ into the FIPS module. 2017-04-21 22:03:18 +00:00
rsaz_exp.c Remove RSAZ-512. 2016-12-14 22:12:50 +00:00
rsaz_exp.h Remove RSAZ-512. 2016-12-14 22:12:50 +00:00
shift.c Return int from bn_wexpand, not BIGNUM*. 2017-04-21 20:07:13 +00:00
sqrt.c Downgrade BN_kronecker to bn_jacobi and unexport. 2017-04-27 20:29:47 +00:00