2841 Commits

Author SHA1 Message Date
Brian Smith
9e0819f7ee Remove support for AMD XOP.
AMD dropped XOP in Ryzen.
2017-05-02 14:31:03 -10:00
Brian Smith
3ebdd8c6a3 Remove non-SSE2 code from 32-bit x86 SHA-2. 2017-04-30 19:34:19 -10:00
Brian Smith
92466b427b Remove non-SSE2 and AVX2 code from 32-bit x86 poly1305. 2017-04-30 19:34:19 -10:00
Brian Smith
0df8522638 Remove non-SSE2 32-bit x86 x86 bn_mul_mont() code. 2017-04-30 19:34:18 -10:00
Brian Smith
aaac30f7e0 Remove non-SSE2 32-bit x86 P-256 code. 2017-04-30 19:34:17 -10:00
Brian Smith
60867f2642 Remove GFp/err.h and clean up leftover unused bits. 2017-04-27 16:06:22 -10:00
Brian Smith
d5d285177f Remove GFp_BN_get_positive_u64(). 2017-04-27 15:05:44 -10:00
Brian Smith
c86906bc68 Remove GFp_BN_bin2bn(). 2017-04-27 14:44:34 -10:00
Brian Smith
d18eb07d3f Remove GFp_BN_set_word(). 2017-04-26 17:24:44 -10:00
Brian Smith
d7d2199620 Replace GFp_BN_is_odd(). 2017-04-26 17:24:44 -10:00
Brian Smith
3ee3b63ee0 Replace GFp_BN_is_one(). 2017-04-26 17:24:43 -10:00
Brian Smith
68fa32053f Replace GFp_BN_is_zero(). 2017-04-26 17:24:42 -10:00
Brian Smith
c1ab3fe08f Remove now-unused BIGNUM internal constants. 2017-04-26 17:24:42 -10:00
Brian Smith
08ec11041e Replace GFp_BN_ucmp(). 2017-04-26 17:24:41 -10:00
Brian Smith
aa6dcd5b55 Replace GFp_BN_usub(). 2017-04-26 17:24:40 -10:00
Brian Smith
f2e5be3c00 Replace GFp_BN_uadd(). 2017-04-26 17:17:52 -10:00
Brian Smith
8c1d54b353 Replace GFp_BN_mod_sub_quick(). 2017-04-26 17:17:52 -10:00
Brian Smith
bff4a74a1f Replace GFp_BN_mod_add_quick(). 2017-04-26 17:12:28 -10:00
Brian Smith
caab9f0efe Update limbs.c copyright line. 2017-04-26 13:39:26 -10:00
Brian Smith
adc3d11305 Fix non-Windows build. 2017-04-25 16:49:24 -10:00
Brian Smith
94f73dfd5c Replace GFp_BN_num_bits() with a simpler Rust equivalent. 2017-04-25 16:18:14 -10:00
Brian Smith
f4237ce57b GFp_BN_mod_exp_mont_consttime: Have caller pass the exponent bit length.
This is a step towards doing the bit length calculation in Rust.
2017-04-25 16:18:13 -10:00
Brian Smith
08abb57578 RSA: Move more of the calculation of n0 to Rust. 2017-04-25 13:13:39 -10:00
Brian Smith
b7e81ab569 RSA: Calculate RR in Rust. 2017-04-25 13:13:37 -10:00
Brian Smith
40a16e4ab2 Make GFp_BN_get_positive_u64() static. 2017-04-25 00:13:07 -10:00
Brian Smith
f9528db33e Replace crypto/bn/random.c with Rust code. 2017-04-25 00:10:02 -10:00
Brian Smith
0f8fe6ef36 Remove GFp_BN_equal_consttime(). 2017-04-24 23:38:50 -10:00
Brian Smith
44cbfa9ebf Remove BIGNUM::neg: BIGNUMs are now always nonnegative/unsigned.
Note that in each place where the value of `neg` was changed for some
`BIGNUM`, either it is set to zero (not negative), the same value as
another `BIGNUM`'s `neg` value, or to the XOR of two `BIGNUM`'s `neg`
values. Thus, there was no way the `neg` flag could ever be set to a
nonzero value.
2017-04-24 23:04:31 -10:00
Brian Smith
e90ba18b5f Remove GFp_BN_abs_is_word().
Inline the necessary logic into the one caller, `GFp_BN_is_one()`.
2017-04-24 22:48:09 -10:00
Brian Smith
a5a764fe94 Remove the now-unused GFp_BN_cmp(). 2017-04-24 22:45:22 -10:00
Brian Smith
4c541a070d Remove GFp_BN_cmp_word().
`GFp_BN_cmp_word()` uses `GFp_BN_cmp()`, which we are aiming to remove.
2017-04-24 22:45:21 -10:00
Brian Smith
f4ccd334a6 Replace uses of GFp_BN_cmp() with GFp_BN_ucmp() where equivalent.
Note that all these uses already verify that the inputs aren't negative
beforehand, so there was no advantage to them using `GFp_BN_cmp()` over
`GFp_BN_ucmp()`.
2017-04-24 22:45:20 -10:00
Brian Smith
aa325730f1 Remove GFp_BN_sub().
Inline the necessary logic into `GFp_BN_sub`'s lone caller and
remove `GFp_BN_sub`.
2017-04-24 22:44:28 -10:00
Brian Smith
0dc12ef70f Replace confusing use of GFp_BN_mod_sub_quick().
`GFp_BN_mod_sub_quick()` is documented to require its non-modulus
operands to be less than the modulus, but in this case we were passing
the modulus itself as one of them. Avoid doing that, and add assertions
regarding the range of the inputs to `GFp_BN_mod_sub_quick()`.

Also, this makes it clearer that the function isn't constant-time yet.
2017-04-24 22:43:42 -10:00
Brian Smith
a6b339b78c Remove GFp_BN_add.
Replace the use of GFp_BN_add with direct usage of the specific case
needed.
2017-04-24 21:50:37 -10:00
Brian Smith
efdffc91db Remove now-unused BIGNUM functions, and bn_test.cc (the last C++ use).
These functions can be removed thanks to the new modular inversion
implementation.
2017-04-24 16:29:37 -10:00
Brian Smith
50fff6ca7a Return int instead of pointer from GFp_bn_wexpand. 2017-04-24 13:10:50 -10:00
Joe Ranweiler
6d6aeb6a4f Port Curve25519 point encoding to Rust.
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2017-04-23 21:52:21 -10:00
Joe Ranweiler
39b35d3fda Move Curve25519 operations into their own module.
This supports both the short-term oxidization of Curve25519 operations
and the longer-term unification with the NIST EC code, whose module
structure we now mirror more closely.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2017-04-23 21:50:02 -10:00
Brian Smith
ff71d521ff Use "GFp/" instead of "openssl/" for #includes.
Avoid any potential conflicts with OpenSSL header files by using a
different namespace.
2017-04-19 14:56:44 -10:00
Brian Smith
11bcedea2d Fix stylistic and similar issues in ring::rand's OS integration. 2017-04-16 18:27:26 -10:00
Brian Smith
91d73acbee Use Linux kernel headers' value of SYS_getrandom when available. 2017-04-16 18:27:26 -10:00
Brian Smith
3896e21bba Use libc's __errno_location() and EINTR instead of defining our own.
We need to link to libc anyway since we call its syscall(2), so just do
it through the libc crate. When we remove the syscall(2) dependency
then we'll also remove this libc crate dependency.
2017-04-16 18:27:26 -10:00
Peter Reid
63069777b5 Convert random chunk generation from C to Rust
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2017-04-16 18:27:26 -10:00
Brian Smith
88aebc4c0d Remove GFp_BN_one() 2017-04-16 17:57:34 -10:00
Brian Smith
52039c8fd9 Remove unused BORINGSSL_NO_STATIC_INITIALIZER and NEED_CPUID. 2017-04-16 12:08:00 -10:00
Brian Smith
42d40a890b Only use __cpuid() with MSVC, not all Windows-targetting compilers. 2017-04-11 15:07:16 -10:00
Brian Smith
2ff814b6b8 Only use _xgetbv() with MSVC, not all Windows-targeting compilers.
At least some Windows-targeting compilers don't have `_xgetbv()`. MSVC
x86-64 doesn't have inline asm, and its 32-bit inline asm does not use
GCC syntax, so we need to retain the MSVC-specific code path.
2017-04-11 14:39:14 -10:00
Brian Smith
d51e389673 Remove now-unused GFp_RAND_bytes. 2017-04-07 15:41:06 -10:00
itn3000
2e499aa916 Remove non-ascii characters for MSVC compilation. 2017-04-05 16:46:12 -10:00