180 Commits

Author SHA1 Message Date
ComplexSpaces
2896a014de Add open_in_place_separate_tag API to LessSafeKey
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2021-09-16 13:24:26 -07:00
Brian Smith
1ab2d161fc Merge BoringSSL d4f877e: Reference the newer ChaCha20-Poly1305 RFC. 2021-08-17 18:59:16 -07:00
Brian Smith
be3443f5c6 Appease Clippy 1.54. 2021-08-02 21:46:17 -07:00
Jack O'Connor
fcbeeabb8b implement Clone for LessSafeKey
OpeningKey and SealingKey intentionally avoid implementing Clone,
because they're attached to a fixed nonce sequence that should be
unique. LessSafeKey isn't attached to a nonce sequence, though, and
making it Clone lets callers avoid repeating key setup work.
2021-05-04 15:20:02 -07:00
Brian Smith
2accae1e7a ECDSA: Add RNG as an input parameter to EcdsaKeyPair::from_pkcs8.
Resolve an old TODO now that we can make breaking API changes.
2021-05-04 15:17:54 -07:00
Brian Smith
2b4d07c177 AEAD tests: Fix warning for non-wasm32 targets. 2021-04-29 16:07:38 -07:00
Brian Smith
9accd874cb WebAssembly: Reduce boilerplate for running tests in WebAssembly.
Skip `digest_tests.rs` since it doesn't get built by wasm-bindgen
correctly when we do this.
2021-04-20 18:22:20 -07:00
Brian Smith
9385c6d014 Use Self more. 2021-03-22 16:11:07 -07:00
Brian Smith
e48c324695 AEAD tests: Add tests for seal_in_place_separate_tag(). 2021-02-24 05:14:07 +00:00
Brian Smith
29b5727bc1 AEAD test: Add tests for open_in_place(). 2021-02-24 05:14:07 +00:00
Brian Smith
e49a8da4e5 AEAD tests: Further refactor tests to reduce repetition. 2021-02-24 05:14:07 +00:00
Brian Smith
16e1b77f3b AEAD tests: Split test_aead into multiple functions. 2021-02-24 05:14:07 +00:00
Brian Smith
ffa5a9f88f AEAD tests: Refactor to reduce boilerplate. 2021-02-24 05:14:07 +00:00
Brian Smith
0664f59420 AEAD tests: Remove unnecessary prefixes in some test functions. 2021-02-24 05:14:07 +00:00
Brian Smith
930b97b0c9 AEAD: Make Aad implement common traits if the underlying type does. 2021-02-24 00:49:15 +00: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
d2ff5d1b3e Tests: Remove unneeded use of Result. 2021-02-11 11:20:16 -08:00
Brian Smith
f2488d6118 Agreement: Stop requiring the KDF to return a Result.
Many (most?) KDFs are infallible, so optimize for that case. If the KDF
is fallible then the result will be `Ok(Err(_))` which is messy.

This eliminates the `error_value` parameter.
2021-02-04 19:06:25 -08:00
Brian Smith
d93b954901 Remove definitions of deprecated Error::description()/cause(). 2021-02-04 17:07:41 -08:00
Brian Smith
27200d4596 Ed25519 malleability tests: Add control test case. 2020-12-17 20:55:22 -08:00
Brian Smith
01a2e429ae Merge BoringSSL 3094902: Get closer to Ed25519 boundary conditions. 2020-12-17 20:55:22 -08:00
Brian Smith
a25271beb0 Ed25519 malleability test: Add control case. 2020-12-17 20:55:22 -08:00
Brian Smith
6e3c8a331e Ed25519 Tests: Import Ed25519 malleability test case from BoringSSL. 2020-12-17 20:55:22 -08:00
Brian Smith
47dfb4814f Ed25519 Tests: Refactor tests to prepare for more complete testing of invalid signatures. 2020-12-17 20:55:22 -08:00
Brian Smith
b9d7d089d9 Remove #![forbid(warnings)]; reply on Clippy in CI/CD instead.
The newest Rust Nightly is getting stricter about `forbid(warnings)`
which breaks the build.

Use "deny" instead of "forbid". And only deny when running Clippy in
CI/CD, so that when hacking on *ring* we don't have to deal with
warnings right away; we now only have to deal with them when we're ready
to submit a change to be merged.
2020-12-03 17:40:33 -08:00
Brian Smith
1cfafdcab7 ECDSA tests: Tell clippy to allow an intetionally redundant clone. 2020-12-03 17:40:33 -08:00
Brian Smith
d57c8d56a2 Signature tests: Remove redundant clones found by Clippy. 2020-12-03 17:40:33 -08:00
Brian Smith
d58e2dadde Agreement tests: Make clippy happy about an assertion. 2020-12-03 17:40:33 -08:00
Brian Smith
a2fec64d10 AEAD tests: Use Vec::resize() to make Clippy happy. 2020-12-03 17:40:33 -08:00
Brian Smith
4be97e91e2 Revert "Remove definitions of deprecated Error::description() ..."
This reverts commit f06811a150fcded1555911678bbca6dcb5440cda because it changed the
pulic API in a non-backward-compatible way.
2020-11-18 16:20:48 -08:00
Brian Smith
cb45bf0ddc Constant-time tests: Take Clippy's op_ref advice. 2020-11-11 16:46:41 -08:00
Brian Smith
8015140fa6 Constant-time tests: Replace clone with copy. 2020-11-11 16:46:41 -08:00
Brian Smith
524c37bace ECDSA/ED25519 tests: Improve Copy/Clone tests based on Clippy's feedback. 2020-11-11 16:46:41 -08:00
Brian Smith
bd7f4ca82d AEAD tests: Take Clippy's advice regarding op_ref. 2020-11-11 16:46:41 -08:00
Brian Smith
aa7a962f9f Constant-time tests: Remove useless clone. 2020-11-11 16:46:41 -08:00
Brian Smith
3de43630d9 ED25519 tests: Remove useless static lifetime annotation. 2020-11-11 16:46:41 -08:00
Brian Smith
5fe025b16e AEAD tests: Remove useless let () =. 2020-11-11 16:46:41 -08:00
Brian Smith
ded14f067e Agreement Tests: Remove unneeded lifetime annotations. 2020-11-11 16:46:41 -08:00
Brian Smith
898a93f632 Tests: Silence some Clippy warnings. 2020-11-11 16:46:41 -08:00
Brian Smith
bc2d01adfb Agreement tests: Address clippy::needless_return. 2020-11-11 16:46:41 -08:00
Brian Smith
f06811a150 Remove definitions of deprecated Error::description() and
`Error::cause()`.
2020-06-19 11:50:49 -05:00
Brian Smith
432670f135 Implement ECDSA nonce hardening to pretect against bad PRNG. 2020-05-29 21:43:35 -05:00
Brian Smith
e8bdd5b7b1 Make RSA work for WebAssembly targets when the "wasm32_c" feature is enabled.
Run the RSA and signature tests in WebAssembly.

Implement Elem*Elem multiplication for platforms for which we have no assembly
language implementation of it. Refactor the code to accomodate this.

`elem_reduced` was infallible previously as it always ensured the prerequisites
for the reduction were met. Make this clear in the return type, as a side-effect
of the refactoring needed for implementing the multiplication.

This implementation is far from efficient. More work needs to be done to make it
faster.
2020-05-29 21:07:20 -05:00
Brian Smith
0d5ab53e50 Simplify wasm32 test conditional uses. 2020-05-28 11:12:37 -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
Brian Smith
42f110abe5 Clean up conditional compilation logic w.r.t wasm_bindgen_test.
When I wrote the tests, `#[cfg_attr(not(target_arch = "wasm32"), test)]` seemed
to be necessary, but now `#[test]` works.
2020-05-27 14:59:52 -05:00
Brian Smith
12c02bfa04 Add tests specifically for constant_time::verify_slices_are_equal. 2020-05-27 14:59:52 -05:00
Marek Vavrusa
f376d70669 Regenerated tests for rsa_pkcs1_sign_tests, rsa_pkcs1_verify_tests
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2020-04-28 11:23:00 -05:00
Marek Vavrusa
5b3dc70fc3 Add support for verifying 1024-bit RSA SHA-512 signatures
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2020-04-28 11:23:00 -05:00