12885 Commits

Author SHA1 Message Date
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
Brian Smith
ff3febd530 AEAD/Polyfill: Implement ArraySplitMap and construct nonces with it.
This is a step towards eliminating the `unsafe` code in `ChunksFixed`.

chacha nonce
2023-10-13 11:29:41 -07:00
Brian Smith
75c620a5f1 ChaCha20 Polyfill: Remove ChunksFixedMut.
It is only used in one place so it isn't justified.
2023-10-13 10:38:21 -07:00
Brian Smith
f8cad224b5 AES: Remove use of ArrayEncoding.
Take a step towards reducing `unsafe` by eliminating another use of
`ArrayEncoding`.
2023-10-11 12:33:22 -07:00
Brian Smith
b1147381c9 Generalize array_flatten into an ArrayFlatten trait. 2023-10-11 12:33:22 -07:00
Brian Smith
faf347a24c AES-GCM: DRY Iv -> Block conversion. 2023-10-11 12:33:22 -07:00
Brian Smith
e6085e717f AEAD: Remove all use of ring::endian and u64 from Block.
In particular, eliminate the use of `ArrayEncoding::as_byte_array` as
we work towards removing that function because it uses `unsafe`.

Where `Block` is used in parameters to C/assembly code, I verified that
the C/assembly code uses `uint8_t *` as the function type (meaning
`uint8_t[16]`) in the BoringSSL headers. Until recently the stuff in
GCM was using `uint64_t` or a union containing `uint64_t`, which is why
block was previously defined in terms of `BigEndian<u64>`.
2023-10-11 11:35:05 -07:00
Brian Smith
797a6eece9 remove From<[u64; 2]> for Block 2023-10-11 10:14:39 -07:00
Brian Smith
e0eb70d848 Remove From<Block> for [u64; 2]. 2023-10-11 10:14:39 -07:00
Brian Smith
8a6d6f4dbe GCM: Remove use of Into<[BigEndian<u64>; 2]>.
Take a step towards removing the `u64` functionality from `Block`.
2023-10-11 10:14:39 -07:00
Brian Smith
d30dda0745 Remove LittleEndian usage from Poly1305 and delete LittleEndian.
This is a step towards eliminating `unsafe` usage in `ring::endian` by
eliminating one use of `ArrayEncoding::as_byte_array`.

Since this is the only usage of `LittleEndian`, it is removed
completely.

This simple `array_flatten` polyfill will be useful for multiple
improvements towards eliminating the unsafe code in `endian`.
2023-10-10 23:45:12 -07:00
Brian Smith
7cc44151d5 Remove use of ring::endian from aead::chacha20_poly1305_openssh.
This is a step towards removing `ArrayEncoding::as_byte_array()`.
2023-10-10 23:14:53 -07:00