387 Commits

Author SHA1 Message Date
Brian Smith
539ac049a8 Upgrade spin to the latest version. 2021-08-15 15:30:54 -07:00
Brian Smith
188cc043f7 Use untrusted 0.9. 2021-07-13 15:54:42 -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
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
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
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
d32c304b3d Factor RsaPublicKeyComponents out of rsa::verification. 2021-06-03 11:33:11 -07:00
Brian Smith
7c9927e6b1 Cargo.toml: Clarify version number.
0.17.0-alpha.9 was released off the b/0.17.0-alpha.9 branch. Similarly for
0.17.0-alpha.10 on the b/0.17.0-alpha.10 branch.

Having the version number on the main branch say "0.17.0-alpha.9" or any
version number like that is confusing and misleading. We have to have a
version number, so use one that's clearer while we work on finishing
0.17.0.
2021-05-04 16:17:34 -07:00
Brian Smith
e898b00d53 Build: Derive FFI symbol prefix and FFI lib prefix from Cargo.toml "links".
Now "links" in Cargo.toml is the only thing that needs to be manually modified
when the prefix changes.

build.rs enforces that the package name and version are consistent with the
"links" field.
2021-05-03 16:28:56 -07:00
Brian Smith
badca90d14 Simplify assembly pre-generation mechanism.
Eliminate the extra Cargo.toml that was used just for this feature. It was
too error-prone to keep it in sync with the real Cargo.toml. Having one
Cargo.toml will allow us to reliably use the `CARGO_MANIFEST_LINKS` value
to keep the symbol prefix in sync with the `links` field in Cargo.toml in
the near future.
2021-05-03 13:36:20 -07:00
Brian Smith
7886603cee Use some variant of "ring core" instead of "GFp" as a prefix for everything.
"GFp_" isn't in the code at all anymore.
2021-05-02 22:09:07 -07:00
Brian Smith
384f7d056b Replace manual FFI symbol prefixing with automatic symbol prefixing.
Revert the names used in the BoringSSL C/asm code to the names used in
BoringSSL. This substantially reduces the diff between *ring* and
BoringSSL for these files.

Use a variant of BoringSSL's symbol prefixing machinery to semi-
automatically prefix FFI symbols with the `GFp_` prefix. The names aren't
all exactly the same as before, because previously we *replaced* a
symbol's original prefix with the `GFp_` prefix; now we're prepending
`GFp_`. In the future we'll use a different prefix entirely.

This paves the way for using different prefixes for each version so that
multiple versions of *ring* can be linked into an executable at once.
2021-05-02 22:09:07 -07:00
Brian Smith
2a6b7484dc Internals: Polyfill array_map. 2021-03-22 21:59:51 -07:00
Brian Smith
e8620224e6 AEAD: Move each key type into its own submodule.
Encapsulate each key type in its own module.
2021-02-24 20:15:26 -08:00
Brian Smith
64e9a5490a AEAD: Move LessSafeKey code into a submodule. 2021-02-24 20:15:26 -08:00
Brian Smith
c6d8f58ad0 Add a Rust ChaCha20 implementation.
See the comments in fallback.rs for more details on the origin.
2021-02-23 18:39:36 +00:00
Brian Smith
501fc4eeaa Replace *ring*'s P-256 arithmetic with BoringSSL's P-256 arithmetic.
Use Fiat Crypto for non-x86_64 platforms, like BoringSSL. Continue
using the nistz256 code on Windows, differently from BoringSSL.

Make *ring* more consistent with BoringSSL.
2021-02-10 12:20:26 -08:00
Brian Smith
275551e2db Separate Counter and Iv for AES-CTR & ChaCha20; clarify alignment.
Ensure we're always passing in u32-aligned values to `GFp_ChaCha20_ctr32`.

Get rid of the attempt to abstract away the difference between ChaCha20
and AES-CTR w.r.t. counters and IVs. The abstraction wasn't actually used
by any shared code. The AES-CTR (GCM) code does endian conversion in the
assembly so endian conversion cannot easily be deferred to later. For
ChaCha20, it makes more sense to do endian conversion at the time of
`Counter`/`Iv` construction. Despite the slight duplication of logic in
having two `Counter` types and two `Iv` types, this is actually a net
reduction of code. If we ever have a third implementation of these types
we can apply the Rule of Three to factor out the commonality.
2021-02-09 08:53:09 -08:00
Brian Smith
5186d53e6b Remove reference to removed module polyfill::convert. 2021-02-09 07:24:26 -08:00
Brian Smith
27a045642a Dependencies: Require latest libc. 2021-02-01 16:19:08 -08:00
Brian Smith
62d90f7d50 Dependencies: Require latest cc-rs. 2021-02-01 16:19:08 -08:00
Brian Smith
9cc0d45f4d 0.16.20. 2021-02-01 13:14:08 -08:00
Brian Smith
a0017634b2 Merge branch 'main' into b/merge-boringssl-integrated-chacha-x86_64 2021-01-26 14:29:23 -08:00
Vlad Krasnov
34424d829d Enable the integrated assembly x86-64 ChaCha20-Poly1305 implementation from BoringSSL 2021-01-26 10:12:14 -08:00
Brian Smith
628acbeff5 Document all features in docs.rs. 2021-01-07 15:00:13 -08:00
Brian Smith
8a49b70789 0.16.19 2020-12-01 16:40:40 -08:00
Michael Neumann
432909280d Fix compilation on DragonFly
This superseeds issue #966.

Tested-on: DragonFly 5.8.1
2020-11-30 11:06:34 -08:00
Brian Smith
b7af159154 0.16.18. 2020-11-26 11:55:14 -08:00
Brian Smith
5efd675f51 Fix BSD --no-default-features build.
`once_cell` is a required, not optional, dependency, on these platforms.
2020-11-24 01:05:14 -08:00
Brian Smith
6c0346954b 0.16.17. 2020-11-23 15:22:47 -08:00
Brian Smith
8888f95e21 Require libc 0.2.80 or later.
0.2.80 is the version I used to test *ring* 0.16.16.

Rumors are that libc 0.2.73 had changes to support aarch64-apple-darwin.
2020-11-18 11:35:31 -08:00
Brian Smith
1ea08f2646 Require once_cell 1.5.2 or later.
This is the version I used to test *ring* 0.16.16.
2020-11-18 11:35:31 -08:00
Brian Smith
3cb597782b Update the cc dependency to 1.0.62.
Apparently 1.0.60 has changes specifically to support aarch64-apple-darwin.
2020-11-18 11:35:31 -08:00
Brian Smith
4ad0b814ef 0.16.16. 2020-11-18 01:18:46 -08:00
Brian Smith
9d0f731ca9 0.16.16-alpha.1 2020-11-18 01:18:46 -08:00
Brian Smith
f19c4f626b Remove dead crypto/fipsmodule/modes/internal.h. 2020-11-17 23:55:28 -08:00
Brian Smith
49065e846e cpu.rs: Clarify conditions under which runtime CPU feature detection is done.
Clarify that, on ARM/Aarch64, runtime feature detection is done only for Linux (including
Android) and Fuchsia. Reduce some of the duplication between Linux and Fuchsia; probably we should
do more later.
2020-11-17 16:46:33 -08:00
Brian Smith
bbf935c17b Switch Poly1305 implementation to the BoringSSL implementation.
Previously the OpenSSL implementation was being used. Switch to the BoringSSL
version.

Switching to the BoringSSL implementation will make it easier to refactor the CPU feature
detection, which is important for upcoming ports.

This switch will also implicitly add support for BTI and pointer authentication for
Poly1305.

This is based on BoringSSL 63d06626d3a104868eee622e8e56d9f2dd643366.
2020-11-17 10:19:30 -08:00
Brian Smith
3ac3e8b020 CI/CD: Test wasm32-unknown-unknown in GitHub Actions.
Bump the wasm-bindgen-test dependency version to be compatible with
the latest wasm-bindgen-cli version.
2020-11-10 17:12:46 -08:00
francescocarzaniga
3dbfb785a8 Update Cargo.toml
Add illumos support.
2020-10-12 17:27:06 -07:00
Brian Smith
796ef8e83a Split aead::nonce into aead::{counter, iv, nonce}. 2020-07-05 12:36:03 -05:00
Brian Smith
1e971371d2 0.16.15 2020-06-16 18:26:52 -05:00
Brian Smith
7f5bc42d3f Add doc/link-to-readme.md to the published crate.
Cargo may start requiring the readme to be in the published crate.
2020-06-15 16:06:04 -05:00
Brian Smith
ef7cf3bfc5 Merge BoringSSL 47b1e39: Tidy up third_party/fiat. 2020-06-02 14:02:26 -05:00
Brian Smith
dbd606f142 0.16.4. 2020-05-30 01:00:07 -05:00
Brian Smith
fae863956b bigint: Replace GFp_bn_mul_add_word with GFp_limbs_mul_add_limb.
Replace `GFp_bn_mul_add_word` with a clearer, simpler implementation.
The new `GFp_limbs_mul_add_limb` avoid explicit branches at the C code
level, unlike the code it replaces. (Obviously, even with the new
"branchless" code the compiler might be able to synthesize branches.)
2020-05-29 21:07:20 -05:00
Brian Smith
0e7fdf5e91 Split ASSERT into dev_assert_secret and debug_assert_nonsecret. 2020-05-29 13:23:29 -05:00
Brian Smith
0c5f61b14f Merge BoringSSL c556d87: Add aes_nohw.c fallback AES implementation.
Add the BoringSSL aes_nohw implementation with minimal changes needed to
build. Enable the AES-GCM AEAD tests for wasm32 targets gated on the "wasm_c"
feature.
2020-05-28 10:51:03 -05:00
Brian Smith
10c4b68e63 Add new "wasm32_c" feature to enable more functionality for wasm32 targets. 2020-05-27 14:59:52 -05:00