12766 Commits

Author SHA1 Message Date
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
Brian Smith
19c0d1e527 NFC: Safety: Remove endian::FromByteArray.
Remove one `unsafe` from `ring::endian` by completely removing `FromByteArray`.
2023-10-10 22:46:06 -07:00
Brian Smith
2e8363b433 0.17.3. 2023-10-09 21:45:25 -07:00
Brian Smith
a076d28b82 0.17.3-alpha.1. 2023-10-09 21:45:25 -07:00
Brian Smith
d1e42e30fd Remove #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
...for compatibility with compilers that don't know about
`unused-but-set-parameter`.
2023-10-09 21:03:42 -07:00
Brian Smith
5cd7ecc579 Use OPENSSL_STATIC_ASSERT instead of static_assert.
More compatibility.
2023-10-09 21:03:42 -07:00
Brian Smith
639ab71e64 Use CRYPTO_memcmp name the same as BoringSSL.
*ring* defined a function named `OPENSSL_memcmp` that did what
`CRYPTO_memcmp` does in BoringSSL, and BoringSSL has a different
function called `OPENSSL_memcmp`. *ring* doesn't need
`OPENSSL_memcmp` so sync the `CRYPTO_memcmp` stuff with BoringSSL.

This eliminates unnecessary differences from BoringSSL.
2023-10-09 15:17:19 -07:00
Brian Smith
9c7b114272 build.rs: Remove -fno-strict-aliasing from the C compiler configuration.
Enable further compiler optimizations.

BoringSSL does not include `-fno-strict-aliasing` in its builds.
2023-10-09 11:54:35 -07:00
Brian Smith
3181d96968 Curve25519: Conservatively force noinline on ADX code paths.
See https://github.com/rust-lang/rust/issues/116573.
2023-10-09 11:52:48 -07:00
Brian Smith
bbfb0cdba9 build.rs: Remove -pedantic-errors from compiler configuration.
Our policy is to set warnings-as-errors only when buildingt from Git,
not when building from a packaged release. This flag is another aspect
of warnings-as-errors.
2023-10-08 21:15:23 -07:00
Brian Smith
29fb82717c Arithmetic Tests: Remove superfluous use of libstd/alloc.
arithmetic/montgomery is used in code that doesn't require `alloc`, so
make its integration test also not require `alloc`.
2023-10-08 20:02:11 -07:00
Brian Smith
667768269c AEAD benchmark: Remove superfluous use of libstd. 2023-10-08 20:02:11 -07:00
Brian Smith
8f042cef71 CI: Improve feature testing.
`dev_urandom_fallback` presently does nothing, so don't bother adding
it as a matrix dimension.

Because `dev_urandom_fallback` does nothing,
`--no-default-features --features=alloc` is effectively the same as the
default feature set, so don't add it as a matrix dimension.

`--all-features` is no longer appropriate after the ARM hardware feature
disabling features were added, so replace it with what we really want,
`--features=std,slow_tests`.

In the coverage section, `--features=alloc,dev_urandom_fallback,std` is
the same as `--features=std` since `alloc and `urandom_fallback` are
default features.
2023-10-08 17:54:54 -07:00
Brian Smith
42936aa198 Bench: Use criterion.rs 0.5.1. 2023-10-06 23:33:24 -07:00
Brian Smith
fa5d6bd6ac Move benchmarks to a new ring-bench crate.
Move the Criterion.rs dependency out of *ring* into a new `ring-benches`
crate. This speeds up many build scenerios by eliminating a bunch of
dependencies from *ring*'s dependency tree for `cargo test`.
2023-10-06 21:54:05 -07:00
Brian Smith
19c5094cd0 Remove #![doc(html_root_url)].
Documentation isn't hosted on briansmith.org anymore.
2023-10-06 21:37:59 -07:00
Brian Smith
f3273afc0a build.rs: Use cc-rs in a more canonical way in most cases. 2023-10-06 17:45:28 -07:00
Brian Smith
f85335da98 build.rs: Treat sources uniformly, and distinct from object files. 2023-10-06 17:45:28 -07:00
Brian Smith
f6d9efd5b3 0.17.2. 2023-10-06 16:55:46 -07:00
Brian Smith
bebaa473f6 Cargo.toml: Add "third_party/fiat/curve25519_64_adx.h". 2023-10-06 16:55:46 -07:00