Commit Graph

2675 Commits

Author SHA1 Message Date
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
Christian Poveda 63ddf03a7c add `encrypted_payload_len` to `MessageEncrypter` 2023-11-16 19:15:54 +00:00
Dirkjan Ochtman c15768989c Update semver-compatible versions (again) 2023-11-14 19:23:54 +00:00
Daniel McCarney 1bf56c0e56 lib: export crate::error::OtherError
The `error::Error` enum was updated with a `Error::Other` variant that
holds an `error::OtherError` instance. We neglected to export the
`OtherError` type, so this variant ends up opaque. This commit exports
the type so that crate-external users can instantiate an `Error::Other`
variant as needed.
2023-11-14 19:18:24 +00:00
Daniel McCarney ccb79947a4 Cargo: update semver compatible dependencies 2023-11-13 13:52:08 +00:00
Joseph Birr-Pixton 42cf372405 General smoke-test for `max_fragment_size`
`test_client_mtu_reduction` and `test_server_mtu_reduction` already exist
but only check client/server behaviour in (relative) isolation.

This test just checks handshaking and bidirectional data flow over
a matrix of key types, TLS versions, and max_fragment_sizes.
2023-11-10 17:44:32 +00:00
Joseph Birr-Pixton e3925b18e6 Use `BorrowedCursor` & `BorrowedBuf` from core::io 2023-11-10 16:11:42 +00:00
Joseph Birr-Pixton d3ab8f030b Opt in to feature(core_io_borrowed_buf)
This is needed for `BorrowedBuf` now, even if via the std::io reexport.
2023-11-10 16:11:42 +00:00
Daniel McCarney 9fc145a3df server/handy: import HashMap directly 2023-11-09 18:26:12 +00:00
Daniel McCarney 557da04188 client: derive Debug for Resumption
All of the fields of `Resumption` are now `Debug` friendly, so we can
derive `Debug` instead of implementing it by hand.
2023-11-09 18:26:12 +00:00
Daniel McCarney 4196a01099 client: derive Debug for ClientConfig
All of the fields of `ClientConfig` are now `Debug` friendly, so we can
derive `Debug` instead of implementing it by hand.
2023-11-09 18:26:12 +00:00
Daniel McCarney 66524008a7 server: derive Debug for ServerConfig
All of the `ServerConfig` fields are now `Debug` friendly, so we can
drop the custom impl and derive `Debug`.
2023-11-09 18:26:12 +00:00
Daniel McCarney 875636e6ba client: derive Debug for AlwaysResolvesClientCert
Since `sign::CertifiedKey` has a `Debug` bound now we can derive
`Debug` for `AlwaysResolvesClientCert` instead of implementing it by
hand.
2023-11-09 18:26:12 +00:00
Daniel McCarney 2f6373b2a5 internal: derive Debug for FixedSignatureSchemeSigningKey
Since the `sign::SigningKey` trait has a `Debug` bound we can derive
`Debug` here instead of doing it manually.
2023-11-09 18:26:12 +00:00
Daniel McCarney 7f8a332a23 server: add Debug bound to StoresServerSessions
This commit adds a `Debug` bound to the `StoresServerSessions` trait in
addition to `Send` and `Sync`. Types implementing this trait are updated
to either derive `Debug` or implement it by hand as appropriate.
2023-11-09 18:26:12 +00:00
Daniel McCarney 7a3542f9a2 server: add Debug bound to ResolvesServerCert
This commit adds a `Debug` bound to the `ResolvesServerCert` trait in
addition to `Send` and `Sync`. Types implementing this trait are updated
to either derive `Debug` or implement it by hand as appropriate.
2023-11-09 18:26:12 +00:00