12885 Commits

Author SHA1 Message Date
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
Brian Smith
8a123d5900 0.17.1. 2023-10-06 16:55:46 -07:00
Brian Smith
f69e1e831f 0.17.1-alpha.1. 2023-10-06 16:55:46 -07:00
Tom Dryer
2afc921340 Allow accessing signature::UnparsedPublicKey bytes
Implement `AsRef<[u8]>` for `signature::UnparsedPublicKey`, making it
possible to access the bytes of the public key. For consistency, I did
the same for `agreement::UnparsedPublicKey`, although it already has a
`bytes` method. `agreement::PublicKey` already uses the `AsRef<[u8]>`
approach.

Also, add missing `Debug` implementation for
`signature::UnparsedPublicKey`.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2023-10-06 11:07:03 -07:00
Brian Smith
789ba2093b CI: Use fail-fast: false for coverage jobs.
Frequently lately one coverage job has been failing per job. Instead of
re-running the whole matrix again, make it so we just need to run the
(usually) one job that failed.
2023-10-06 10:31:10 -07:00
Jiahao XU
2e0655867b Fix fn cc in build.rs
Do not convert `Path`/`OsStr` to `String` in `cc`, instead creates an
`OsString` and push to it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 10:06:22 -07:00
Jiahao XU
ccb1e9eb58 Use Path::display instead of Path::to_str in fn cc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 10:06:22 -07:00
Jiahao XU
d949e6ffc7 Ret PathBuf instead of String for fn compile
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 10:06:22 -07:00
Jiahao XU
a65da9d260 Fix getting CARGO_MANIFEST_DIR: Use env::var_os
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 10:06:22 -07:00
Jiahao XU
d8aca487de Fix retrieveing OUT_DIR in build.rs
Use `env::var_os` instead of `env::var` to handle non utf-8 path
correctly.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 10:06:22 -07:00
Brian Smith
a2ca505bb0 Enable FE25519_ADX X25519 on x86-64 except Windows. 2023-10-06 09:54:59 -07:00
Brian Smith
af7c37f8af Enable FE25519_ADX Curve25519 base point mult. except on Windows. 2023-10-06 09:54:59 -07:00
Brian Smith
5aa224c4bc Import constant_time_conditional_memcpy from BoringSSL.
Previously we didn't need it. Now we do.
2023-10-06 09:54:59 -07:00
Brian Smith
fa6631463c build.rs: Skip .S files on x86 and x86-64 Windows.
So far .S files are only used on non-x86, non-x86_64 targets. That
will change soon, so prepare for that by filtering them out so that
we don't feed them to MSVC.
2023-10-06 09:54:59 -07:00
Brian Smith
244a1dee00 Remove doc/link-to-readme.md.
The intended effect was to redirect people reading about *ring* on
crates.io to the GitHub-hosted README.md. However, the unintended effect
was that docs.rs is broken for the 0.17.0 release.
2023-10-05 22:45:41 -07:00
Brian Smith
6a6f1fa0b1 CI: Remove s390x and powerpc64le from test matrix.
They are still in `coverage`.
2023-10-05 22:28:47 -07:00
Brian Smith
91b0d90f2c build.rs: Use OsStr/OsString more to handle non-Unicode paths. 2023-10-05 21:34:57 -07:00
Brian Smith
3a650b3354 build.rs: Don't try to set linker flags since we're not linking.
First, we were passing `-Wl,--gc-sections` to the compiler regardless
of whether it is MSVC, which didn't make any sense on its own.

But, even more generally, it doesn't make sense for us to try to tell
the linker what to do when we aren't actually linking. (We're building
static libraries of the C and assembly code.)
2023-10-05 20:10:52 -07:00
Brian Smith
414e7a32ff build.rs: Don't try to manually set -fPIC.
cc-rs's documentation says that it already handles this automatically,
which is why we'd already removed it for other targets.
2023-10-05 20:10:52 -07:00
Brian Smith
12d8178ab6 build.rs: Clarify compiler configuration.
Clarify which parts of the build script modify the compiler
configuration (`configure_cc`) and which don't (`cc`). Ensure that the
configuration is only done once per library, instead of once per source
file, as each `cc` invocation can reuse the configuration work done by
a single `configure_cc` call.
2023-10-05 20:10:52 -07:00
Brian Smith
c2910b0af4 build.rs: Remove empty and useless LD_FLAGS. 2023-10-05 20:10:52 -07:00
Brian Smith
9d2abfcf52 build.rs: Set compiler C and CPP (preprocessor) flags in one place.
Apparently it is OK to set `-std=c1x` even when compiling assembly
code, so just set it no matter what we're compiling. This simplifies
the code and allows future simplification.

It's not clear why certain warnings were separated from the others.
Combine them too, for the same reasons.
2023-10-05 10:17:08 -07:00
pkubaj
7218f22bc6 Fix powerpc64 detection
Both powerpc64 and powerpc define __powerpc__. Also remove endianness check for powerpc64* since it's not necessary.
2023-10-05 07:27:37 -07:00
Brian Smith
096a99f426 Benchmarks: Add X25519 benchmark. 2023-10-04 20:59:49 -07:00
Brian Smith
5a5f6d71c6 NFC: Reduce scope of #[allow(unused_variables)] in X25519. 2023-10-04 11:26:12 -07:00
Brian Smith
38b9bb7de0 Reorganize, simplify, and clarify BUILDING.md. 2023-10-03 14:23:46 -07:00
Luis Cruz
8387c3953e Add apple tvos support 2023-10-03 11:54:18 -07:00
Brian Smith
c8e4b23af8 Don't hard-code use of static CRT in GitHub Actions AArch64 Windows build. 2023-10-03 09:13:53 -07:00
Brian Smith
49b47eabfa Use Visual Studio 2022 in GitHub Actions for AArch64 Windows. 2023-10-03 09:13:53 -07:00
Brian Smith
c4a6ec8662 ECC: Better encapsulate Curve25519 base point multiplication.
Combine some `unsafe` blocks and create a more logical interface.
2023-10-02 15:18:28 -07:00
Brian Smith
52582adbce CI: Remove PowerPC and s390x jobs from test-features. Add PowerPC to test.
Add the powerpc-unknown-linux-gnu target to `test`. Remove PowerPC and
s390x targets from `test-features` because they slow down CI too much.
2023-10-02 14:15:12 -07:00
Brian Smith
d34858a918 0.17.0. 2023-10-02 01:18:18 -07:00