Commit Graph

2199 Commits

Author SHA1 Message Date
Daniel McCarney cf6aa80cbf Cargo: version 0.21.9 -> 0.21.10 2023-12-08 13:46:40 +00:00
Daniel McCarney 4ee33ae942 version: allow manual_non_exhaustive
We've addressed this lint's findings in `main`. For the 0.21.x release
stream, allow the finding and leave the code unchanged for minimal
semver impact.
2023-12-08 13:46:40 +00:00
Geoffroy Couprie f628518b16 remove the TLS 1.2 session ticket on DecryptError
if for some reason the recorded session ticket is invalid or decoded
incorrectly by the server, we can get into a case where the resumption
handshake happens, and right after the ChangeCipherSpec message, the
server sends an encrypted handhsake message using the invalid ticket,
and the client rejects it with the BadRecordMAC alert.
Unfortunately, if the calling code retries the connection, if it will
try again with the same ticket and obtain the same result.
This commit makes sure that if we fail to decrypt the first message, we
will remove the session ticket for this server, to start from cratch on
the next connection.
2023-12-08 13:46:40 +00:00
Daniel McCarney bbd9abca10 Cargo: v0.21.8 -> v0.21.9 2023-11-16 15:23:46 +00:00
Joseph Birr-Pixton 5edc126bcf Use `BorrowedCursor` & `BorrowedBuf` from core::io 2023-11-16 15:23:46 +00:00
Joseph Birr-Pixton 7abd73f7ec Opt in to feature(core_io_borrowed_buf)
This is needed for `BorrowedBuf` now, even if via the std::io reexport.
2023-11-16 15:23:46 +00:00
Daniel McCarney c34477a068 Cargo: 0.21.7 -> 0.21.8 2023-10-24 13:32:34 +00:00
Daniel McCarney 8cf2594dcb sign: fix clippy get-first warning 2023-10-24 13:32:34 +00:00
Robsdedude ecc6cded2a Flush writers before potentially expecting a response 2023-10-24 13:32:34 +00:00
Daniel McCarney 53adb9d2eb docs: adjust *ring* platform compatibility
Updated the README/lib.rs notes about *ring* platform compatibility to
fold in suggestions from Brian Smith.
2023-10-24 13:32:34 +00:00
Daniel McCarney d5d62499f2 upgrade to ring 0.17 2023-10-24 13:32:34 +00:00
Daniel McCarney a659652de0 tls12/tls13: make hash_algorithm crate internal
The `Tls12CipherSuite::hash_algorithm` and
`Tls13CipherSuite::hash_algorithm` functions were meant to be crate
internal, since their return type leaks the `ring::digest::Algorithm`
type. As written today these fns make updates to `*ring*` a breaking
change for the Rustls API.

This commit switches the visibility of both functions to be
crate-internal. Strictly speaking this is a breaking change, but we
don't expect there to be consumers of these functions and it unblocks
a *ring* update that would otherwise be breaking on its own.
2023-10-24 13:32:34 +00:00
Daniel McCarney 3ed39adc3d upgrade to webpki 0.101.7
Brings in the ring 0.17 update.
2023-10-24 13:32:34 +00:00
Dirkjan Ochtman 3e4a72e396 Docstrings on expressions are not a thing 2023-10-24 13:32:34 +00:00
Dirkjan Ochtman e26d1d82ae Bump MSRV to 1.61 2023-10-24 13:32:34 +00:00
Dirkjan Ochtman ab7b0e7a4f Drop rust-version metadata for internal crates 2023-10-24 13:32:34 +00:00
Joseph Birr-Pixton 7bc1dcddd8 Fix new nightly clippy lints
- several `clippy::slow_vector_initialization`
- one `clippy::redundant_guards`
2023-10-24 13:32:34 +00:00
Joseph Birr-Pixton 396478cde1 fuzz: remove unused webpki dependency 2023-10-24 13:32:34 +00:00
Daniel McCarney c9cfe34996 Cargo: bump version v0.21.6 -> v0.21.7. 2023-08-28 20:35:16 +00:00
Joseph Birr-Pixton 41515eabfb client: detect HRR with incorrect session_id
See comment for justification from RFC.
2023-08-28 20:35:16 +00:00
Joseph Birr-Pixton 8bf4671732 Regression test for echoing session id in HRR 2023-08-28 20:35:16 +00:00
Joseph Birr-Pixton 0cc2ad54cd server: echo client's session_id in HRR 2023-08-28 20:35:16 +00:00
Dirkjan Ochtman 0eeac58fb8 Clarify that building configs is not actually expensive
The actually expensive part is mostly the gathering of certificates
from the platform trust root store, and it would be better to document
that in the relevant API (that is, in rustls-native-certs). Apart
from that, I believe that the use of `Arc`-wrapped types is also an
effective signal that the wrapped types should be reused where possible.
2023-08-24 16:37:09 +00:00
Dirkjan Ochtman 9d4ac865c3 Store an Arc<RootCertStore> in WebPkiVerifier 2023-08-24 16:37:09 +00:00
Daniel McCarney 40e4b5d642 Cargo: bump version 0.21.5 -> 0.21.6 2023-08-02 12:15:12 +00:00
Daniel McCarney ea71de282d deps: update to webpki-roots 0.25, fix deprecations.
Updates the rustls project and rustls-examples project to use
webpki-roots 0.25.0 instead of 0.24.0, fixes associated deprecations.
2023-08-02 12:15:12 +00:00
Daniel McCarney 2b97c8dc20 verify: avoid deprecated webpki methods.
webpki 0.101.2 deprecated some methods/types that must be updated.
2023-08-02 12:15:12 +00:00
Daniel McCarney 2ac3cec0e1 anchors: deprecate add_server_trust_anchors.
The `RootCertStore` type is used for both client and server trust
anchors. This commit deprecates the inappropriately named
`add_server_trust_anchors` fn and adds a new `add_trust_anchors` fn to
use in its place.
2023-08-02 12:15:12 +00:00
Dirkjan Ochtman 4b8be56b2b Fix up nightly clippy issue with incorrect comment 2023-08-02 12:15:12 +00:00
Joseph Birr-Pixton 080909789b Correct/allow unnecessarily &mut function args
allow unknown-lints on stable clippy, otherwise it warns about us
allowing lints that were introduced on nightly.
2023-08-02 12:15:12 +00:00
Joseph Birr-Pixton 841c6a37c0 client::builder: fix PhantomData clippy lint 2023-08-02 12:15:12 +00:00
Daniel McCarney 21a54ba4c2 ci: add a cargo-semver-checks action.
This commit updates the `build.yml` GitHub actions workflow to
additionally include a step that checks semver compatibility w/
cargo-semver-checks[0].

Notably this check passing is necessary but not sufficient for knowing
that we're maintaining semver: if this tool produces a finding we know
we aren't matching semver, but if it doesn't, we may still be breaking
semver in a way the tool can't detect.

[0]: https://github.com/obi1kenobi/cargo-semver-checks
2023-07-11 12:27:14 -04:00
Daniel McCarney fd79e0485d ci: add 32-bit cross compile check.
This commit brings over the 32-bit cross compilation check step from
`main` into the `rel-0.21` branch.
2023-07-11 12:27:14 -04:00
Daniel McCarney b1808ac5a8 cargo: prepare 0.21.5 release. 2023-07-10 14:48:23 -04:00
Daniel McCarney 6ff5b778d0 Revert "Take `IntoIterator` in `add_parsable_certificates()`"
This reverts commit 7924f00a81.

It turns out to not be as semver compatible as we thought.
2023-07-10 14:48:23 -04:00
Daniel McCarney f613c9f060 cargo: prepare 0.21.4 release.
Updates Cargo.toml version 0.21.3 -> 0.21.4
2023-07-10 12:11:07 -04:00
Joseph Birr-Pixton 11e9386845 Prepare to move release notes to github releases 2023-07-10 12:11:07 -04:00
Joseph Birr-Pixton 4a9f375aac RELEASING.md: restructure, use github releases 2023-07-10 12:11:07 -04:00
dAxpeDDa 7924f00a81 Take `IntoIterator` in `add_parsable_certificates()` 2023-07-10 12:11:07 -04:00
Daniel McCarney 6fedb3558b client: `with_single_cert` -> `with_client_auth_cert`
This commit renames the `ClientConfig` builder's `with_single_cert`
function to be called `with_client_auth_cert`. The old
`with_single_cert` function is left as an alias for
`with_client_auth_cert` and marked as deprecated to encourage users to
switch to the new name.

I believe this offers better symmetry with the `with_no_client_auth`
function that's used to disable client authentication, and more clearly
conveys the purpose of this function is for providing a client
authentication certificate.
2023-07-10 12:11:07 -04:00
Daniel McCarney 208d7679ac deps: update webpki-roots 0.23.0 -> 0.24.0 2023-07-10 12:11:07 -04:00
Daniel McCarney da5be06c28 error: use automatic link for RFC 5280 ref.
Fixes:
```
warning: this URL is not a hyperlink
   --> rustls/src/error.rs:427:15
    |
427 |     /// [^1]: https://www.rfc-editor.org/rfc/rfc5280#section-5.3.1
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://www.rfc-editor.org/rfc/rfc5280#section-5.3.1>`
    |
    = note: bare URLs are not automatically turned into clickable links
    = note: `#[warn(rustdoc::bare_urls)]` on by default
```
2023-07-10 12:11:07 -04:00
Daniel McCarney 3e909541fc lib: export CertRevocationListError enum.
The top level `Error::InvalidCertRevocationList` was
exported, but not its inner `CertRevocationListError` enum. This should
be done to match other enums (e.g. the `Error::InvalidCertificate`'s
exported `CertificateError` enum).
2023-07-10 12:11:07 -04:00
Daniel McCarney e99b3d19b3
cargo: update version 0.21.2 -> 0.21.3 2023-07-05 11:36:25 -04:00
Daniel McCarney 27907af200 docs: update README changelog for 0.21.3.
Includes:

* CRL feature for the client verifiers.
* Certificate validation helpers when using `dangerous_configuration`
  feature.
2023-07-05 11:34:11 -04:00
Daniel McCarney 8c15432da3 tests: integration test for revoked client certs.
This commit introduces `api.rs` integration tests that verify
a server configured with client authentication (mandatory or optional),
and a CRL that specifies a client cert as revoked, will correctly return
a revoked error for that client cert.

In addition to the test CRL data generated in a previous commit this
work requires `rustls-pemfile` >= 1.0.3 to use unreleased CRL support in
the `rustls-pemfile` crate. The rustls dev-dependency and the rustls
example dependency on this crate are adjusted accordingly.
2023-07-05 11:34:11 -04:00
Daniel McCarney e3a8bdd1c8 test-ca: regenerate certs, keys, crls.
Generated with:

```
cd test-ca
./build-a-pki.sh
git add .
```
2023-07-05 11:34:11 -04:00
Daniel McCarney 2856e8dcd4 test-ca: generate demo CRLs for client certs.
This commit updates the `build-a-pki.sh` script to generate example
certificate revocation lists (CRLs) that mark each of the client
certificates as revoked. These can be used by server tests to ensure CRL
validation works as expected.

The process of generating CRLs using `openssl` is... well... not
great...

It can't be done without using `openssl ca`, which in turn requires
using an `openssl.cnf` with all the associated warts. I've done my best
to create the absolute minimum configuration that can be used for our
purposes.

Using `openssl ca` also requires writing some intermediate state. The
script is updated to create/delete this state through the process of
generating the CRLs. This should be sufficient for our needs. Blech.
2023-07-05 11:34:11 -04:00
Daniel McCarney 24720e3c96 verify: AllowAnyAuthenticatedClient CRLs.
This commit introduces a `crls: Vec<webpki::OwnedCertRevocationList>>`
field to the `AllowAnyAuthenticatedClient` implementation of
`ClientCertVerifier` in preparation of supporting revocation checking of
client certs with CRLs.

Each impl gets a builder-style `with_crls` method that can be used to
augment the verifier with CRLs to use for client cert revocation status
checking.

The constructed cert revocation lists are provided to webpki at cert
verification time to use for revocation lookup.

The `tlsserver-mio` example is updated with a `--crl` flag to the
that can be used to optionally provide a series of DER encoded CRLs to
use for client certificate revocation checking.
2023-07-05 11:34:11 -04: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