Commit Graph

97 Commits

Author SHA1 Message Date
Joseph Birr-Pixton 99abca5e49 Prepare 0.23.8 2024-05-23 12:46:38 +00:00
jasperpatterson 8da353056a Add support for enforcing CRL expiration 2024-05-21 14:32:11 +00:00
Joseph Birr-Pixton e45fec43e1 Prepare 0.23.7 2024-05-17 17:26:06 +00:00
Joseph Birr-Pixton 252b5d360b Prepare 0.23.6 2024-05-16 14:51:31 +00:00
Joseph Birr-Pixton 14cb5d2eac Prepare 0.23.5 2024-04-19 15:01:19 +00:00
Joseph Birr-Pixton 1dee8b1313 Prepare 0.23.4 2024-03-25 14:57:41 +00:00
Joseph Birr-Pixton 5ce0a17128 Prepare 0.23.3 2024-03-20 16:56:05 +00:00
Joseph Birr-Pixton bbef4b3ea7 Prepare 0.23.2 2024-03-13 16:41:33 +00:00
Daniel McCarney 536a0cdc03 fuzz: apply fmt-unstable to fuzz crate 2024-03-04 09:27:43 +00:00
Joseph Birr-Pixton bce2e5e241 Prepare 0.23.1 2024-03-01 15:25:23 +00:00
Joseph Birr-Pixton eb0791bc94 Prepare 0.23.0 2024-02-29 14:57:47 +00:00
Eloi DEMOLIS a8d3857106 Type renaming
Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
2024-02-26 16:36:05 +00:00
Joseph Birr-Pixton 7415b5ff3d Change crate default provider to aws-lc-rs 2024-02-12 10:00:59 +00:00
Joseph Birr-Pixton e7a1b41852 Introduce concept of "process default" provider
One can be installed with `CryptoProvider::install_default`.
First call wins.

The current value can be retrieved with `CryptoProvider::get_default()`.

This can be set from the crate features, if and only if they are unambigious,
by installing the result of `CryptoProvider::from_crate_features()`.

Use this for `ClientConfig::builder` and `ServerConfig::builder` et al.
Naturally, `ClientConfig::builder_with_provider` and co. continue to exist.
2024-02-07 16:02:26 +00:00
Joseph Birr-Pixton 501f91c9e6 Take semver-compatible updated deps 2024-02-07 14:44:59 +00:00
Joseph Birr-Pixton c83b4243b6 Expose FIPS "service indicator"
This means a `ClientConfig` and `ServerConfig` can be asked whether it
is in fips mode, and it answers by asking the same of all its
constituent cryptography.

Take new rustls-webpki and pki-types to ask the same of
`SignatureVerificationAlgorithm`.
2024-02-02 16:57:39 +00:00
Christian Poveda d8abdb3e0a add a Borrowed variant to Payload
Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2024-01-09 17:53:17 +00:00
Christian Poveda d2b95ae772 prepare Codec for non-allocating decoding
Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
2024-01-09 17:53:17 +00:00
Christian Poveda b1c0a29b6a Batch discard operations 2024-01-09 17:53:17 +00:00
Joseph Birr-Pixton 0a61a3ad4a Depend on rustls-webpki 0.102.1 2024-01-04 09:21:59 +00:00
Dirkjan Ochtman 937a51c384 Update semver-compatible dependencies 2023-12-11 10:11:15 +00:00
Jacob Hoffman-Andrews 0963cca28d update examples to use pki_types re-export
We now re-export the rustls-pki-types crate. I think that means
our preferred way for crates to consume pki-types is through the
re-exports.
2023-12-08 09:31:35 +00:00
Daniel McCarney b2cd88697f Cargo: version 0.22 -> 0.23-alpha.0
We're starting to land semver incompatible changes into `main`. This
commit bumps the crate version so that the semver detection job won't
cause spurious failures.
2023-12-06 18:40:20 +00:00
Christian Poveda 17e938c3af Batch discard operations 2023-12-06 18:15:37 +00:00
Jorge Aparicio 4505605c1a make MessageDeframer unbuffered 2023-12-06 18:15:37 +00:00
Joseph Birr-Pixton 4d1b762b53 Bump version to 0.22.0 2023-12-01 19:10:46 +00:00
Joseph Birr-Pixton 381dcf99ee Update dependencies 2023-12-01 19:10:46 +00:00
Daniel McCarney a7191785f6 remove unwrap for protocol versions w/ default provider
When building a client config or a server config using the default
provider we know that the ciphersuites will be compatible with any
choice of protocol version. By having the default `builder` method
configure itself with safe default versions, and offering
a `builder_with_protocol_versions` for customization we can transition
directly to `WantsVerifier` for these default provider builders,
removing a `Result` that will never be an error and making the API more
ergonomic in the common case.
2023-11-30 15:53:39 +00:00
Daniel McCarney b92fd839e3 crypto: rework CryptoProvider as struct
This commit replaces the existing `CryptoProvider` trait with
a `CryptoProvider` struct. This has several advantages:

* it consolidates all of the cryptography related settings into one API
  surface, the `CryptoProvider` struct members. Previously the provider
  had methods to suggest default ciphersuites, key exchanges etc, but
  the builder API methods could override them in confusing ways.
* it allows removing the `WantsCipherSuites` and `WantsKxGroups` builder
  states - the "safe defaults" are automatically supplied by the choice
  of a crypto provider. Customization is achieved by overriding the
  provider's struct fields. Having fewer builder states makes the API
  easier to understand and document.
* it makes customization easier: the end user can rely on "struct update
  syntax"[0] to only specify fields values for the required
  customization, and defer the rest to an existing `CryptoProvider`.

Achieving this requires a couple of additional changes:

* The cipher suite and key exchange groups are now expressed as `Vec`
  elements. This avoids imposing a `&'static` lifetime that would
  preclude runtime customization (e.g. the tls*-mio examples that
  build the list of ciphersuites at runtime based on command line
  flags).
* As a result of the `Vec` members we can no longer offer the concrete
  `CryptoProvider`s as `static` members of their respective modules.
  Instead we add `pub fn default_provider() -> CryptoProvider` methods
  to the `ring` and `aws-lc-rs` module that construct the `CryptoProvider`
  with the safe defaults, ready for further customization.

[0]: https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax
2023-11-30 15:53:39 +00:00
Daniel McCarney 74bd185f6e Cargo: 0.22.0-alpha.5 -> 0.22.0-alpha.6 2023-11-29 21:41:52 +00:00
Daniel McCarney aef3381dea update rustls-webpki to alpha.8, pki-types to 2.2.3
Requires accommodating the new `Debug` bound requirement in the provider
example, and fixing some expected output in a webpki verify test.
2023-11-29 21:41:52 +00:00
Dirkjan Ochtman af80fa35f6 Update semver-compatible dependencies 2023-11-27 14:45:32 +00:00
Dirkjan Ochtman a6233dcc46 Bump rustls version to alpha.5 2023-11-24 14:38:07 +00:00
Dirkjan Ochtman 26ec868b8c Migrate to pki-types ServerName 2023-11-23 21:57:10 +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
Daniel McCarney b776a5778a Cargo: 0.22.0-alpha.3 -> 0.22.0-alpha.4 2023-10-30 15:31:19 +00:00
Daniel McCarney 1ec7b727de Cargo: use rustls-webpki v0.102.0-alpha.6
This version of webpki improves CRL ergonomics. Notable changes:

* use `with_status_policy builder` fn

The upstream crate added a more ergonomic interface we can use in
place of having to keep around a mutable builder and doing our own
matching.

* avoid CRL dyn trait hurdles

The upstream crate made working with CRLs easier by replacing the
`CertRevocationList` trait with an `enum` representation.

Notably this makes working with the `Vec<OwnedCertRevocationList>` that
the webpki verifier builders and verifiers hold much easier: we no long
have to do as many contortions to convert to a `&[&dyn
CertRevocationList]`.
2023-10-30 15:31:19 +00:00
Joe Birr-Pixton b515abfcb3 `AeadKey`: zeroize on drop 2023-10-20 09:04:27 +00:00
Joseph Birr-Pixton 092a6af3db Take rustls-webpki 0.102.0-alpha.4 2023-10-06 15:24:29 +00:00
Dirkjan Ochtman 8e64ed10b9 Upgrade to ring 0.17 2023-10-06 15:24:29 +00:00
Joseph Birr-Pixton 47cae34706 fuzz: remove unused webpki dependency 2023-10-06 10:25:05 +00:00
Dirkjan Ochtman c7970af179 Keep Cargo.lock under version control 2023-09-26 13:38:35 +00:00
Joseph Birr-Pixton 048ff10740 Use dynamic dispatch for `CryptoProvider`
Instead of the type `rustls::crypto:💍:Ring`, the value
`rustls::crypto:💍:RING` implements this, and is more
entertaining to write.

`ServerConfig::builder()` references this by default, and
is equivalent to `ServerConfig::builder_with_provider(crypto:💍:RING)`.
2023-09-19 11:09:38 +00:00
Daniel McCarney 222690db36 deframer: allow plaintext alerts in early 1.3 HS.
Some TLS 1.3 implementations send plaintext alerts (e.g. for an unknown
certificate issuer) early in the handshake.

Trying to decrypt these messages will produce a decrypt error (because
they're plaintext!). We also don't want to allow plaintext alerts to be
received after encrypted records have been exchanged, since this could
allow an active adversary to inject alerts.

As a compromise to support clients that send a plaintext alert before
any encrypted data, we adjust the deframer in this commit to pass
through plaintext alerts iff:

* The message type is alert, (e.g. not application data, etc)
* There have been no encrypted records received yet.
* The message payload is no more than 2 bytes in size (matching an
  expected plaintext alert payload).
* The negotiated protocol version is TLS 1.3 - in TLS 1.2 the CCS
  messages make whether to expect plaintext or not unambiguous. It's
  only for TLS 1.3 that we need the heuristics mentioned above.

This retains protection against plaintext alerts being sent after
encrypted content while still allowing the server to log the correct
alert in the early-handshake condition, instead of a decrypt error.
2023-08-08 15:06:06 +00:00
Daniel McCarney 17a7e17534 crypto: separate module dir, ring sub-module.
For better code organization this commit moves the generic crypto
interface code from `src/crypto.rs` to `src/crypto/lib.rs`.

The *ring* specific code implementing the generic interfaces is moved to
`src/crypto/ring.rs` as a sub-module of `crypto. All imports are
adjusted accordingly.

This has the advantage of leaving `src/crypto/lib.rs` small, and without
any *ring* specific imports. In the future we may choose to feature-gate
the ring sub-module to allow building the crate without a dependency on
ring.
2023-07-18 17:47:43 +00:00
Dirkjan Ochtman e1860c91a8 crypto: parametrize config types with crypto provider 2023-07-18 17:47:43 +00:00
Daniel McCarney ff5d3e32e4 deps: update rustls-webpki.
This commit updates the webpki dependency of rustls to v0.101.0,
the release that adds CRL support.
2023-07-05 11:34:11 -04:00
Joseph Birr-Pixton ae4ca3290b Cease relying on webpki crate for DNS name types
This introduces similar but simplified `DnsName` and
`DnsNameRef` types.

Fuzz the `client::ServerName` type that exposes this
surface.
2023-06-22 11:57:34 +01:00
Daniel McCarney 18f42bba16 fuzz: fix unused Result clippy finding.
```
warning: unused `std::result::Result` that must be used
  --> fuzzers/persist.rs:14:5
   |
14 |     T::read(&mut rdr);
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: this `Result` may be an `Err` variant, which should be handled
```
2023-03-20 16:08:55 +01:00
Daniel McCarney ca5725747a fuzz: cargo fmt updates 2023-03-20 16:08:55 +01:00