12846 Commits

Author SHA1 Message Date
Brian Smith
9dd6141f91 NFC EC: Reduce scope of constant ONE. 2023-10-19 13:12:12 -07:00
Brian Smith
c3fda8b4dd 0.17.5. 2023-10-18 20:58:28 -07:00
Brian Smith
a86b7fabb9 0.17.5-alpha.1. 2023-10-18 20:58:28 -07:00
Brian Smith
27aa5386a0 EC P-384: Use array types for crossing Rust<->C boundary.
Avoid using the P384_POINT type on the C side. It seems to work for all
the targets we support, for P-384, but this pattern probably doesn't
work in general. Especially due to alignment issues for 32-bit targets,
it is doubtful it would work for P-521.
2023-10-18 11:39:04 -07:00
Brian Smith
327831e6b3 P-256 nistz: Use arrays instead of P256_POINT in boundary functions.
Better match the Rust declarations of these functions. Prepare to
support more target platforms and more weird things (like P-521) that
by avoiding any kind of alignment assumptions at the language
boundary (or elsewhere).
2023-10-18 11:39:04 -07:00
Brian Smith
159f52c769 Eliminate gathering during table construction.
When `elem_exp_consttime` replaced `BN_mod_exp_mont_consttime` I did
not fully understand the way the table was constructed in the original
function. Recent BoringSSL changes clarify the table construction. Do
it the same way, to restore performance to what it was previously.

This addresses the `// TODO: Optimize this to avoid gathering`.
2023-10-18 11:14:38 -07:00
Brian Smith
19fe19124b bigint elem_exp_consttime: Get rid of entry/entry_mut indexing.
When this code was written, it wasn't clear which assembly language
functions took a pointer to the entire state vs. just a pointer to
the accumulator (etc.). Now upstream clarified things and we can
clarify this code.
2023-10-18 11:14:38 -07:00
Brian Smith
d4bf41eb00 bigint elem_exp_consttime: Add some clarifying comments. 2023-10-18 11:14:38 -07:00
Brian Smith
9a49f379e3 P-256 ECDSA verification: Clarify multiplication.
Move more of the logic for the nistz256 multiplication into Rust.
2023-10-18 09:49:30 -07:00
Brian Smith
6283ca087f P-256 ECDSA verification: Use optimized nistz256 verification.
Import the optimized nistz256 verification from BoringSSL.
2023-10-18 09:49:30 -07:00
Brian Smith
dbfbba4f1a Import ecp_nistz256_points_mul_public from BoringSSL.
From BoringSSL commit 8d71d244c0debac4079beeb02b5802fde59b94bd.

Comment it out until it is modified to work.
2023-10-18 09:49:30 -07:00
Brian Smith
30665a9759 NFC P-256: Add twin_mul method to PublicScalarOps.
Allow each curve to provide its own `twin_mul` implementation. For now,
use the same implementation we've been using.
2023-10-18 09:49:30 -07:00
Brian Smith
2a0e495903 NFC EC: DRY oneRR_mod_n.
Avoid repeating the value of `oneRR_mod_n` twice in each file.
2023-10-17 10:47:15 -07:00
Vlad Krasnov
20672b2b09 Replace limbs initializer with const from_hex
The current macro initializer is not uniform across architectures,
and doesn't work when the number of 64bit limbs is not exactly half
that of 32bit limbs, (i.e. 521 bit).
This change replaces all limbs! initializers with a new const
function with hex string initializers, which is more portable and
more ergonomic.
2023-10-16 23:18:30 -07:00
Brian Smith
057de0ff98 0.17.4. 2023-10-15 20:57:03 -07:00
Brian Smith
e0bc21f51a 0.17.4-alpha.1. 2023-10-15 12:48:10 -07:00
Brian Smith
ae376cb94e rand: Sort target_os list. 2023-10-15 12:48:10 -07:00
Brian Smith
f56cc4190d rand: Remove redundant target_os = "wasi".
It's already included as part of the `all(target_arch = "wasm32" ...)`
below.
2023-10-15 12:48:10 -07:00
tema2
4aa1b14dcf use default rand impl for hermit since getrand has it for 8 month 2023-10-15 09:00:58 -07:00
Brian Smith
9d4bb22ef8 build.rs: Sort non-MSVC C compiler flags alphabetically.
All the `-W...` flags make do difference in packaged releases,
but `-fvisibility=hidden` is a big deal, so don't hide it after
all the warning stuff.
2023-10-14 22:03:50 -07:00
Brian Smith
8909e6eddf build.rs: Don't enable MSVC SDL warnings.
They hardly matter for this codebase any more.
2023-10-14 22:03:50 -07:00
Brian Smith
65941d014f build.rs: Don't override Windows exception/RTTI/C++ compiler flags.
Use whatever cc-rs does by default. This shouldn't impact us as we
don't use C++.
2023-10-14 22:03:50 -07:00
Brian Smith
2201721cd3 build.rs: Let cc-rs choose the hardening flags, if any.
Now that we have almost no C code in *ring* there's little
need for these extra hardening flags.
2023-10-14 22:03:50 -07:00
Brian Smith
89172b4ff6 rand: Clarify wasm32-logic logic.
Require `target_arch = "wasm32"` for `target_os = "wasi"`.
2023-10-14 18:29:44 -07:00
Brian Smith
c32f7a23d8 Digest tests: Don't disable tests for wasm32 targets. 2023-10-14 18:29:44 -07:00
Brian Smith
65aa65d49a NFC: Don't treat wasm32 differently w.r.t. dead-code warnings. 2023-10-14 18:29:44 -07:00
Brian Smith
1c476cd20c AEAD tests: Address wasm32-wasi build warning & clarify use. 2023-10-14 16:50:18 -07:00
Brian Smith
2986d15484 Use -nostdlibinc for wasm32-wasi like wasm32-unknown-unknown. 2023-10-14 16:50:18 -07:00
Brian Smith
8348897d92 CI: Add wasm32-wasi to CI. 2023-10-14 16:50:18 -07:00
JanKaul
2019d8482f Add support for wasm32-wasi.
[The files changed in this commit were part of the original PR. The
original PR also changed other files, but those changes were removed.]
2023-10-14 16:50:18 -07:00
Brian Smith
da23dc037e Use small Curve25519 for wasm32 & other non-{aarch64,x86_64}.
Enable `ring::agreement` for wasm32 targets using the small
implementation of Curve25519.

Use the small Curve25519 implementation of Curve25519 (and
P-256) for all targets except for Aarch64 and x86-64.

Besides being smaller, the small implementations are likely
more resistant to compiler-introduced side-channels, which
is especially important for the wasm32 virtual machine and
other targets that we don't QA as thoroughly as AAarch64
and x86-64.

Bring in the previously-removed definition of `fe_mul_llt`
from BoringSSL as of commit
8d71d244c0debac4079beeb02b5802fde59b94bd.
2023-10-14 16:49:57 -07:00
Brian Smith
0f8386dce2 CI: Don't test benchmarks in test and test-features jobs.
Benchmarks require Rust 1.65 or later currently due to benchmark-only
dependencies.

Also, benchmarks add a lot of downloading/build time because they have
many more dependencies. So, skipping them in these jobs makes them
faster.
2023-10-14 11:54:52 -07:00
Brian Smith
06e5d3b9e1 CI: Run tests for armv7-unknown-linux-musleabihf. 2023-10-13 17:56:01 -07:00
Brian Smith
99ab6db360 Add arm-unknown-linux-gnueabi testing to CI.
Replace arm-unknown-linux-gnueabihf in `test` since we already have
another gnueabihf target.
2023-10-13 17:45:30 -07:00
andoalon
08413016bf Don't manually specify optimization flags for MSVC (cc-rs takes care)
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2023-10-13 16:56:03 -07:00
Brian Smith
e7aedb26c6 Change documentation & unnecessary qualification warnings.
Don't warn during `cargo build` or `cargo test`, but deny them
in `mk/clippy.sh` so that they are caught in CI. Limit `cargo build`
warnings to things that matter during the edit/test cycle.
2023-10-13 16:11:25 -07:00
Brian Smith
ce184528d1 NFC: Remove outdated comment about old behavior of derive(...). 2023-10-13 16:11:25 -07:00
Brian Smith
f78a8418fa Remove some superfluous warning allow(...) overrides. 2023-10-13 16:11:25 -07:00
Brian Smith
bafde9dba7 Clippy: Move lint configuration to lib.rs. 2023-10-13 16:11:25 -07:00
Brian Smith
ff2cc71e94 Require wasm-bindgen-test 0.3.37.
This is the minimum we've tested.
2023-10-13 15:07:44 -07:00
Brian Smith
aa01858787 Require getrandom 0.2.10.
This is the minimum we've tested.
2023-10-13 15:07:44 -07:00
Brian Smith
90879811aa Require spin 0.9.8.
This is the minimum we've tested.
2023-10-13 15:07:44 -07:00
Brian Smith
801ebce7e2 Require cc-rs 1.0.83.
This is the minimum we've tested.
2023-10-13 15:07:44 -07:00
Brian Smith
dac669b648 Require at least libc 0.2.148.
This is the minimum that we've tested.
2023-10-13 15:07:44 -07:00
Brian Smith
8edeead004 Minimize scope of clippy::upper_case_acronyms. 2023-10-13 15:03:55 -07:00
Brian Smith
691a4dbb31 mk/clippy.sh: Remove --allow entries for lints that aren't triggered. 2023-10-13 15:03:55 -07:00
Brian Smith
3eb07737f1 build.rs: Address clippy::ptr_arg. 2023-10-13 15:03:55 -07:00
Brian Smith
64cd0b997e Remove target-dir workaround for Clippy cache issues.
For a long while this hasn't been needed. See
https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-152
2023-10-13 15:03:31 -07:00
Brian Smith
83719c4c0f AEAD/Polyfill: Use ArraySplitMap instead of ChunksFixed.
This is a step towards eliminating the `unsafe` code in `ChunksFixed`.
2023-10-13 11:29:41 -07:00
Brian Smith
32f209e0fd ChaCha20: Use ArraySplitMap to construct Iv.
This is a step towards eliminating the `unsafe` in `chunks_fixed()`.
2023-10-13 11:29:41 -07:00