Commit Graph

2690 Commits

Author SHA1 Message Date
Dirkjan Ochtman e3edaef807 Rename SignError to InvalidKeyError 2023-11-22 15:22:12 +00:00
Jorge Aparicio a54c8ecbe3 CI: run clippy on the entire workspace 2023-11-22 15:06:37 +00:00
Jorge Aparicio 0c556c03ab fix clippy warnings in ci-bench 2023-11-22 15:06:37 +00:00
Jorge Aparicio 65ade3c440 turn CertificatePayload type alias into a newtype 2023-11-22 14:20:39 +00:00
Jacob Hoffman-Andrews db64448ddd Doc: replace "nb." with "Note:"
"nota bene" (mark well) is jargon that we don't need.
2023-11-22 14:14:37 +00:00
Jacob Hoffman-Andrews 96d1691b35 doc: update docs for SigningKey
Explain why the implementors section for SigningKey is empty, where
SigningKey comes from, and what it is consumed by.

Update the functions that document encodings for loading private keys so
they are more specific and concrete.
2023-11-22 14:07:54 +00:00
Joseph Birr-Pixton 1db4506dcf Update front page docs for crypto providers 2023-11-21 19:15:40 +00:00
Joseph Birr-Pixton 7595236ddf Expand documentation for `CryptoProvider` and associated 2023-11-21 19:15:40 +00:00
Joseph Birr-Pixton b4e71864b4 Remove misleading/outdated comments 2023-11-21 19:15:40 +00:00
Joseph Birr-Pixton c1e34d1c81 Outlaw and test `export_keying_material` with empty output
This is not useful.
2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton beae45c35d Support aws-lc-rs in integration-level benchmarks 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton ad4ec7775b Make it easier to feature-gate entire bench program 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton c8c46bea4d Run bogo against both ring and aws-lc-rs providers 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 3d90b0b9e1 aws_lc_rs::tls13: Use TlsRecord{Open,Seal}ingKey API
Because this API is not available for chacha20-poly1305, we keep the old
aead::UnboundKey implementation for use by that.
2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 2291523d2e Rename `Tls13MessageEncrypter` -> `AeadMessageEncrypter` 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 644dfdc934 Split off tls13 module for aws-lc-rs 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 0189d67fcc aws_lc_rs::tls12: Use TlsRecordOpeningKey API 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton f6d7298d30 aws_lc_rs::tls12: Use TlsRecordSealingKey API 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton f0a6ec1110 Make receiver of `cipher::Message{En,De}crypter` mutable
This is necessary if implementations want to keep state between calls --
(eg, *ring*'s `aead::OpeningKey`).  The next commit takes advantage
of this.
2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton b7fc13791f Remove crypto::aws_lc_rs::hmac
This became unused outside of tests, so isn't really paying its rent.
2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 87ceb611fd Use aws-lc-rs API for TLS1.2 PRF 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 9931adfdc7 Split off tls12 module for aws-lc-rs 2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton b4680e6a00 Remove `ring_shim::digest_output_len`
aws-lc-rs 1.5 tracked this API change.
2023-11-21 09:58:03 +00:00
Joseph Birr-Pixton 96f16712c9 Take aws-lc-rs 1.5 2023-11-21 09:58:03 +00:00
Dirkjan Ochtman b8b13274ca quic: tighten headlines for connection new() methods 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman 9713e86d34 quic: match prevailing style of error messages 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman c14a35f4fd Use filter_map() instead of filter().map() 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman fbdf5dafdc quic: deduplicate code for building keys 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman 94a2084f42 quic: use higher-level interface for make_packet_key() 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman 9169e71552 quic: remove limits from PacketKey interface
Since these are now unconditionally available on the Tls13CipherSuite,
there doesn't seem to be much point in keeping this API (which appears
be unused).
2023-11-21 08:48:18 +00:00
Dirkjan Ochtman 7ee370a415 Tighten docstring headlines for suite limits 2023-11-21 08:48:18 +00:00
Dirkjan Ochtman df9ed5bca4 Simplify progression to TLS 1.3 traffic states 2023-11-21 08:48:18 +00:00
Daniel McCarney 8173b77bb0 crypto: doc-hide the HPKE module
The bits and pieces we're landing for HPKE support aren't ready for
broad use yet. To avoid confusion before the 0.22 release this commit
adds a `#[doc(hidden)]` attribute to the `crypto/hpke.rs` mod.
2023-11-20 22:16:36 +00:00
Daniel McCarney 42cda4658f client: remove deprecated with_single_cert
We deprecated `ClientConfig` builder's `with_single_cert` in 0.21.4,
encouraging use of `with_client_auth_cert`. This commit removes the
deprecated fn ahead of the 0.22.0 release.
2023-11-20 20:00:59 +00:00
Joseph Birr-Pixton 26541d5bb1 Use cargo-minimal-versions
This hides a bunch of mess underlying `cargo update -Z direct-minimal-versions`:
mainly the ability to exclude workspace crates with publish=false from
version resolution (`--ignore-private` flag).
2023-11-20 11:22:25 +00:00
Joseph Birr-Pixton 076090d4bd Switch to checking direct-minimal-versions
Of `-Z minimal-versions` it is said:

> Note: It is not recommended to use this feature. Because it enforces minimal
> versions for all transitive dependencies, its usefulness is limited since not
> all external dependencies declare proper lower version bounds.

`-Z direct-minimal-versions` appears to be its replacement, which means our
CI is checking things only within our control.
2023-11-20 11:22:25 +00:00
Dirkjan Ochtman 765cfd214b ci-bench: update itertools to 0.12 2023-11-20 09:02:07 +00:00
Dirkjan Ochtman 84a599ff76 Update semver-compatible dependencies 2023-11-20 09:02:07 +00:00
Joseph Birr-Pixton a3bf6ba24a bogo_shim.rs: fully support aws-lc-rs provider
This was only partially ported, but built due to feature unification
from other crates in the workspace.

Unconditionally use a provider, and wrap certificate signature
operations rather than using (ring-only) `default_verify_tls12_signature`
et al.
2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton cd81f32592 quic: give helpful error if used with unsuitable suite
Now Tls13CipherSuite can omit QUIC support, detect and error
on the case that all the configured suites are TLS1.3-capable
but QUIC-incapable.
2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton c26548337e Filter cipher suite offer and acceptance for QUIC
In QUIC connections, we shouldn't offer or accept cipher suites
that have `Tls13CipherSuite::quic` as `None`.  So introduce
`usable_for_protocol` on `SupportedCipherSuite`, and
use it to extend `reduce_given_version` into `reduce_given_version_and_protocol`.
2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton fdd1f8dd4f Move key usage limits up into `CipherSuiteCommon` 2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton cfec92ce70 Make Tls13CipherSuite::quic optional and public
The goal is to make it possible for provider-example to exist
without implementing (eg) QUIC header protection.

This introduces some knock-on requirements for other types/functions
to be the public, so `quic::Algorithm` can be implemented outside
the crate.
2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton 538cb78f83 Abolish quic crate feature
This reveals that bogo_shim fails to build for `--no-default-features --features tls12`.
Feature gate the entire program on `ring | aws-lc-rs`.
2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton 13550cf013 Make it easier to feature-gate entire bogo_shim example 2023-11-17 19:27:21 +00:00
Joseph Birr-Pixton e5a1822298 quic: simplify `packet_key`/`header_protection_key` trait
If we put the key derivation on "our" side of the trait, we avoid
publicising low-level key schedule functions like hkdf_expand_label
& hkdf_expand_label_aead_key, and quic::Version.

Instead we just provide the `AeadKey` and `Iv`, which makes these
interfaces very similar to those in `Tls13AeadAlgorithm`.
2023-11-17 19:27:21 +00:00
Steve Fan e5a4f13741 add server example for example provider 2023-11-17 17:26:43 +00:00
Joseph Birr-Pixton e3e1d8352b provider-example: normalise import order/grouping 2023-11-17 17:26:43 +00:00
Daniel McCarney b7a6091ab4 provider-example: HPKE provider w/ hpke-rs & rust-crypto
This commit implements the Rustls HPKE provider traits using hpke-rs[0]
with the rust-crypto backend.

Since HPKE is not yet used in Rustls (but will be for ECH support),
a unit test based on the RFC 9180 test vectors is added.

Likely in the future we will want to move this test somewhere outside of
the provider-example crate and use it to test a *ring* HPKE
implementation using the same test vector data.

[0]: https://github.com/franziskuskiefer/hpke-rs
2023-11-16 19:32:49 +00:00
Daniel McCarney b4f0bd96a2 crypto: add HPKE module and traits
This commit introduces a trait for a hybrid public key encryption (HPKE)
provider. HPKE is specified in RFC 9180[0], and is a pre-requisite for
implementing encrypted client hello (ECH).

Implementations of this trait can use the cryptographic provider of
their choice to provide HPKE using existing primitives from the crypto
provider.

We've tailored the HPKE trait in Rustls to just what is required for
ECH, e.g. it doesn't support modes other than the unauthenticated 'base'
mode, and it only offers the "single-shot" APIs.

[0]: https://www.rfc-editor.org/rfc/rfc9180
2023-11-16 19:32:49 +00:00