11023 Commits

Author SHA1 Message Date
Brian Smith
1ab2d161fc Merge BoringSSL d4f877e: Reference the newer ChaCha20-Poly1305 RFC. 2021-08-17 18:59:16 -07:00
Brian Smith
32561b0b4f
Merge pull request #1357 from briansmith/b/unfix-nightly
Revert "CI: Use nightly-2021-08-13 to work around regression in latest Rust nightly."
2021-08-17 16:22:30 -07:00
Brian Smith
415672e028
Merge pull request #1356 from briansmith/b/merge-boringssl
Merge BoringSSL through commit 1cf78cd
2021-08-17 16:08:39 -07:00
Brian Smith
8e2b42d470 Revert "CI: Use nightly-2021-08-13 to work around regression in latest Rust nightly."
This reverts commit c8ca693ff7e6c619e1f2dd8ea915c335836af3a8 so we'll use the latest
nightly in CI. The rustc bug was fixed.
2021-08-17 15:27:11 -07:00
Brian Smith
44faff6129 Ignore BoringSSL 8c31179..1cf78cd. 2021-08-17 15:25:40 -07:00
Jeremy Soller
cc908a734b Add redox to LINUX_ABI 2021-08-16 12:54:43 -07:00
Jeremy Soller
dae1918124 Use /dev/urandom for SecureRandom on Redox 2021-08-16 12:54:43 -07:00
Brian Smith
ace62da913 Require cc-rs 1.0.69 or later to improve aarch64-pc-windows-msvc compatibility.
Alexander Ovchinnikov (@Alovchin91) wrote:
> [C]ould you please also upgrade cc to 1.0.69? This version contains fixes to
> find MSVC tools on Windows ARM.
2021-08-16 12:53:56 -07:00
Alexander Ovchinnikov
ceb5b90f6e Enable building and running on Windows ARM64
I agree to license my contributions to each file under the terms given at the top of each file I changed.

Co-authored-by: Marc-André Moreau <marcandre.moreau@gmail.com>
2021-08-16 12:28:42 -07:00
Brian Smith
fb108ef041 rand: Get rid of warning about kSecRandomDefault case.
This isn't actually a global so I'm surprised this lint bothers with it.
2021-08-16 09:04:22 -07:00
Brian Smith
8fe3633ab9 build.rs: Refactor preassembly in package process in preparation for aarch64-pc-windows-msvc. 2021-08-15 16:01:32 -07:00
Brian Smith
539ac049a8 Upgrade spin to the latest version. 2021-08-15 15:30:54 -07:00
Brian Smith
c8ca693ff7 CI: Use nightly-2021-08-13 to work around regression in latest Rust nightly. 2021-08-15 14:34:56 -07:00
Brian Smith
b88024a96b build.rs: Replace Target::env with Target::is_musl.
Make the limited role of the `env` part of the target triple more clear.
2021-08-13 17:39:15 -07:00
Brian Smith
31e9f68406 build.rs: Refactor away Target::is_git to clarify logic.
Localize the use of the "is git" check to a single place and use more
descriptive variables for the various effects that this check has.

As a nice side effect, the loosly-typed `warnings_are_errors` parameters
that were threaded through functions are now gone.
2021-08-13 12:29:34 -07:00
Brian Smith
9f13827bc5 Fix build using VS2019's clang or clang-cl for i686-pc-windows-msvc.
Using clang-cl (MSVC command line syntax):
```
$ which clang-cl
/c/apps-x86/Microsoft Visual Studio/2019/BuildTools/VC/Tools/Llvm/bin/clang-cl
$ clang-cl --version
clang version 12.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\apps-x86\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
$ rm -Rf target/i686-pc-windows-msvc
$ CC=clang-cl cargo -vv test --target=i686-pc-windows-msvc
$ CC=clang-cl cargo -vv test --release --target=i686-pc-windows-msvc
```

Using clang (GCC command line syntax):
```
$ which clang
/c/apps-x86/Microsoft Visual Studio/2019/BuildTools/VC/Tools/Llvm/bin/clang
$ clang --version
clang version 12.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\apps-x86\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
$ rm -Rf target/i686-pc-windows-msvc
$ CC=clang cargo -vv test --target=i686-pc-windows-msvc
$ CC=clang cargo -vv test --release --target=i686-pc-windows-msvc
```
2021-08-13 10:04:47 -07:00
Brian Smith
fef3498628 Fix build when using VS2019's clang-cl 12 targeting x86_64-pc-windows-msvc.
The deleted `#define`s were dead code correctly identified as such by clang.

```
$ clang-cl --version
clang version 12.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\apps-x86\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
```
2021-08-13 10:04:47 -07:00
Brian Smith
0cc09321fd Fix build when using VS2019's provided Clang 12 targeting x86_64-pc-windows-msvc.
```
$ which clang
/c/apps-x86/Microsoft Visual Studio/2019/BuildTools/VC/Tools/Llvm/bin/clang
$ clang --version
clang version 12.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\apps-x86\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
$ CC=clang cargo -vv test --target=x86_64-pc-windows-msvc
$ CC=clang cargo -vv test --release --target=x86_64-pc-windows-msvc
```
2021-08-13 10:04:47 -07:00
Brian Smith
f43c0a9f65 build.rs: Don't assume MSVC targets are compiled with MSVC. 2021-08-13 10:04:47 -07:00
Brian Smith
7f5cd78190 build.rs: Remove unneeded logic to filter out .S files for -msvc
targets.

There is no case where we have .S files for -msvc targets, so this
filter doesn't filter anything out. IIRC, this is stale code from when
the situation was different in the past.

This reduces the amount of logic that is specific to "-msvc" targets and
makes the work to support clang and clang-cl for Windows, and to support
AAarch64 Windows, easier to review.
2021-08-13 10:04:47 -07:00
Brian Smith
31a32711c3 build.rs: Always use ".o" for object files.
Take a step towards supporting clang as the C compiler for -msvc
targets.
2021-08-13 08:18:14 -07:00
Brian Smith
b21ccc97a2 build.rs: Use cc-rs's built-in logic for warnings-as-errors.
Take a step towards supporting Clang as the compiler for -msvc targets.
2021-08-12 20:16:25 -07:00
Brian Smith
56561bc0c2 kSecRandomDefault is NULL.
Make it a `const` instead of referencing the value in the system library
to save a relocation.
2021-08-09 15:50:38 -07:00
Brian Smith
fe67830da1 Use cargo-audit 0.15.0.
Fix the build failure.
2021-08-02 21:55:40 -07:00
Brian Smith
be3443f5c6 Appease Clippy 1.54. 2021-08-02 21:46:17 -07:00
Brian Smith
1bf024dacf Run doctests in CI/CD. 2021-07-20 14:14:56 -07:00
Brian Smith
188cc043f7 Use untrusted 0.9. 2021-07-13 15:54:42 -07:00
Brian Smith
a7e73c3558 Test benchmarks in CI/CD. 2021-07-06 17:27:36 -07:00
ComplexSpaces
b23e560b27 Port crypto-bench AEAD benchmarks to *ring*
I agree to license my contributions to each file under the terms given
at the top of each file I changed.

Add AEAD decryption benchmarks
2021-07-06 15:27:26 -07:00
Brian Smith
ec0d08d0ce Increase Codecov patch coverage threshhold to reduce false positive failures. 2021-06-26 15:29:31 -07:00
Brian Smith
cc3861f385 Stop using PartialEq/Eq implementations for untrusted::Input.
Prepare for the removal of the `PartialEq`/`Eq` implementations from
`untrusted`. The goal of such removal is to make timing leaks more
obvious, and to make the absense of timing leaks more clear.
2021-06-25 13:08:54 -07:00
Brian Smith
908eaf0322 Remove src/rsa/convert_nist_rsa_test_vectors.py from Cargo crate.
It isn't useful for it to be in the crate, as it isn't used in any part of the
build or tests.
2021-06-24 14:53:04 -07:00
Brian Smith
1ca07dd267 Cargo.toml: Use globs for *.rs and *_tests.txt so we don't have to list each one. 2021-06-24 14:53:04 -07:00
Brian Smith
8f5fd8dad5 README.md: Remove outdated remark about using #[bench]. 2021-06-24 12:58:33 -07:00
Brian Smith
1e18a1c292 RSA: Move verification::Key to public::Key.
Take a step towards having RSA keys support encryption/decryption
in addition to signing/verification.

No functional changes are intended.

Some documentation was moved around.
2021-06-24 12:58:14 -07:00
Brian Smith
b7c6ffb4b8 io::der tests: Add some test cases for larger positive integers. 2021-06-24 12:57:07 -07:00
Brian Smith
159c96c696 io::der tests: DRY integer tests. 2021-06-24 12:57:07 -07:00
Joel Galenson
ae1e9dd64e Add missing test file to Cargo's includes.
This should allow tests to pass on the crates.io release.
2021-06-23 09:58:34 -07:00
Brian Smith
195fe9c745 io::der tests: Add additional test case for missing requried leading zero. 2021-06-17 19:25:53 -07:00
Brian Smith
3caf38474f io::der Tests: Add comment clarifying one test input. 2021-06-17 19:25:53 -07:00
Brian Smith
647f0d4270 io::der: Clarify logic in integer tests.
The `let _ =` stuff makes it look like we're ignoring the result. It
isn't clear that `with_bad_i` was doing the check we needed. Merge
`with_good_i` and `with_bad_i` into one `with_i` and move the checks to
the calling code.
2021-06-17 18:02:10 -07:00
Brian Smith
f41a56d3ef io::der: Simplify big_endian_without_leading_zero() uses.
`big_endian_without_leading_zero_as_input().as_slice_less_safe()` is
equivalent to `big_endian_without_leading_zero()`. Simplify users of the
former to use the latter.

This facilitates moving the unit tests to integration tests.
2021-06-16 11:45:18 -07:00
Brian Smith
22273dfb2c io::der:: Simplify ASN.1 integer parsing.
Simplify the integer parsing code. Instead of jumping through hoops to use
the `untrusted` API for validating the syntax, take advantage of slice
patterns, which weren't available at the time the original code was written.

Eliminate redundancy in checking for non-zero values when parsing positive
integers.
2021-06-16 10:55:37 -07:00
Brian Smith
7649badf49 Make io::Positive parsing API more robust.
Use normal error handling instead of panicking. That is, don't require/assume that the caller
of `io::Positive::new_non_empty_without_leading_zeros()` already validated the input. This
adds redundant error checking when it is used by `io::der`, but will simplify (future)
callers outside of `io::der`.

Rename the function.
2021-06-11 13:20:52 -07:00
Brian Smith
d9a362e573 Reduce constraints on RsaPublicKeyComponents.
Follow the Rust convention of having minimal constraints on type
definitions.
2021-06-10 16:24:20 -07:00
Brian Smith
d32c304b3d Factor RsaPublicKeyComponents out of rsa::verification. 2021-06-03 11:33:11 -07:00
Brian Smith
796323f56b RSA: Fix module-level doc comment. 2021-05-13 20:03:13 -07:00
Brian Smith
54f1da865d RSA internals: Reduce visibility of items in rsa.
Prepare for a future where the `rsa` module is public. (Currently this is a no-op
since `rsa` isn't public.)
2021-05-13 20:03:13 -07:00
Brian Smith
71fb684401 RSA internals: Stop re-exporting rsa::padding items from rsa.
Prepare for making the `rsa` module public.
2021-05-13 19:47:52 -07:00
Brian Smith
8498bdc958 RSA internals: Clean up use of arithmetic::bigint. 2021-05-13 19:01:59 -07:00