Commit Graph

3129 Commits

Author SHA1 Message Date
Jorge Aparicio 034d6cf5c9 no-std: rm ClientConnection 2024-02-27 14:31:05 +00:00
Jorge Aparicio 771419f68e no-std: rm ServerConnection 2024-02-27 14:31:05 +00:00
Christian Poveda 730a0fc599 no-std: rm Connection 2024-02-27 14:31:05 +00:00
Jorge Aparicio b02ae65965 no-std: rm Stream* 2024-02-27 14:31:05 +00:00
Jorge Aparicio 7a79ea03e8 no-std: rm KeyLogFile 2024-02-27 14:31:05 +00:00
Jorge Aparicio 83ace0d35f no-std: remove ClientSessionMemoryCache
default Resumption to disabled
2024-02-27 14:31:05 +00:00
Jorge Aparicio df9c28caa2 no-std: add TimeProvider to ServerConfig
no-std users must use the new ServerConfig::builder_with_details(),
which requires a `TimeProvider` to be provided up-front.

For std builds, the `ServerConfig` uses the `DefaultTimeProvider`
for existing, other `ServerConfig::builder*` functions.
2024-02-27 14:31:05 +00:00
Jorge Aparicio 0cbe92bd6d no-std: rm TicketSwitcher
will be back in phase II
2024-02-27 14:31:05 +00:00
Jorge Aparicio 956062816c no-std: remove field from `OtherError` 2024-02-27 14:31:05 +00:00
Jorge Aparicio 96b217bb22 no-std: add TimeProvider to ClientConfig
For no-std users, the new `ClientConfig::builder_with_details()` must
be used, which requires a `TimeProvider` implementation up-front.

For std builds, the `ClientConfig` uses the `DefaultTimeProvider` for
existing `ClientConfig::builder*` functions.
2024-02-27 14:31:05 +00:00
Christian Poveda e3ebc82389 no_std: rm use of `std` in `builder` 2024-02-27 14:31:05 +00:00
Jorge Aparicio 1553549329 add std feature
Since aws-lc-rs doesn't support no-std it's moved from the default
features to the std features.

Similarly we must tweak our `once_cell` usage to provide the
`race` feature for builds without `std`.

See the upstream[0] docs section on "Does this crate support no_std?"
for some important caveats.

[0]: https://docs.rs/once_cell/latest/once_cell/
2024-02-27 14:31:05 +00:00
Dirkjan Ochtman 29c3a7421d Create abstraction for duplicate detection 2024-02-27 14:20:14 +00:00
Dirkjan Ochtman 4f71a2b82e Replace enum value getters with From impl 2024-02-27 14:20:14 +00:00
Dirkjan Ochtman d09e6e4069 Use enum to_array() in more places 2024-02-27 14:20:14 +00:00
Dirkjan Ochtman 0dd873a41c Rename get_array() to to_array() 2024-02-27 14:20:14 +00:00
Joseph Birr-Pixton a31c5da2e5 OutboundChunks: remove array constructor
This was only used for test code; just use the slice one.
2024-02-26 18:50:13 +00:00
Joseph Birr-Pixton a943e07058 Assorted docs nits 2024-02-26 18:50:13 +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
Eloi DEMOLIS 6031a0d7a8 provider-example: BufferAdapter->DecryptBufferAdapter
The previous commit introduced an `EncryptBufferAdapter` alongside
`BufferAdapter`. This commit renames `BufferAdapter` to
`DecryptBufferAdapter` to better represent its purpose.
2024-02-26 16:36:05 +00:00
Eloi DEMOLIS 7055ef047c Create type PrefixedPayload for OpaqueMessage
PrefixedPayload holds a Vec<u8> with a 5 bytes padding before the
actual OpaqueMessage's payload. They will be filled when encoding the
OpaqueMessage avoiding an allocation and a copy.

Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
2024-02-26 16:36:05 +00:00
Eloi DEMOLIS fcbe43dde6 message: switch HEADER_SIZE from u16 to usize 2024-02-26 16:36:05 +00:00
Eloi DEMOLIS 7b9ba05a0c macros: generalize enum_builder, generate get_array 2024-02-26 16:36:05 +00:00
Eloi DEMOLIS b6a22bfa0b provider-example: tidy up cipher:: type prefixes 2024-02-26 16:36:05 +00:00
Daniel McCarney 8e95ae1967 ci: skip docs deploy for forks 2024-02-23 16:32:17 +00:00
Joseph Birr-Pixton ca4f9bbe6f Take semver compatible updates
- aes v0.8.3 -> v0.8.4
- anstream v0.6.11 -> v0.6.12
- anyhow v1.0.79 -> v1.0.80
- aws-lc-fips-sys v0.12.1 -> v0.12.3
- aws-lc-sys v0.13.0 -> v0.13.2
- bumpalo v3.14.0 -> v3.15.3
- cc v1.0.83 -> v1.0.86
- event-listener v5.0.0 -> v5.1.0
- hermit-abi v0.3.5 -> v0.3.6
- openssl v0.10.63 -> v0.10.64
- openssl-sys v0.9.99 -> v0.9.101
- pkg-config v0.3.29 -> v0.3.30
- polling v3.4.0 -> v3.5.0
- ryu v1.0.16 -> v1.0.17
- semver v1.0.21 -> v1.0.22
- serde v1.0.196 -> v1.0.197
- serde_derive v1.0.196 -> v1.0.197
- serde_json v1.0.113 -> v1.0.114
- syn v2.0.48 -> v2.0.50
- unicode-normalization v0.1.22 -> v0.1.23
- windows-targets v0.52.0 -> v0.52.3
- windows_aarch64_gnullvm v0.52.0 -> v0.52.3
- windows_aarch64_msvc v0.52.0 -> v0.52.3
- windows_i686_gnu v0.52.0 -> v0.52.3
- windows_i686_msvc v0.52.0 -> v0.52.3
- windows_x86_64_gnu v0.52.0 -> v0.52.3
- windows_x86_64_gnullvm v0.52.0 -> v0.52.3
- windows_x86_64_msvc v0.52.0 -> v0.52.3
2024-02-23 08:50:06 +00:00
Thom Wiggers 124f31123c Use `end_entity` variable when verifying CertificateVerify
The function very nicely constructs the `end_entity` variable, use it
throughout instead of selecting it again.

This makes it so that we use the position of `end_entity` in the chain
only once, and it makes it more clear that we're using the
previously-verified certificate.
2024-02-21 13:36:43 +00:00
Daniel McCarney fdf71f8ed0 Cargo: bump semver compat deps
* clap v4.5.0 -> v4.5.1
* rustls-pemfile v2.0.0 -> v2.1.0
* rustls-pki-types v1.2.0 -> v1.3.0
* ring v0.17.7 -> v0.17.8
* aws-lc-rs v1.6.1 -> v1.6.2
2024-02-19 22:08:52 +00:00
Joseph Birr-Pixton 114ae6f643 Inline `choose_ciphersuite_preferring_client` and co
Test the behaviour of `ServerConfig::ignore_client_order` at
the public API level.
2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton 651b5a4f14 Select key exchange group and cipher suite together
This is complex because the choice of usable cipher suites depends
on selected protocol version, and the set of mutually supported
key exchange groups.  Then, the usable set of key exchange groups
depends on the actually-selected cipher suite.
2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton d23e58c3db Prefer `supported_groups` extension in kx group choice
Prior to this, we preferred to avoid a `HelloRetryRequest` when
any supported `KeyShare` was supplied.  But as [1] describes,
this means a client which sends a `KeyShare` for a less-preferred
group would end up using that, rather than a more-preferred group
supported by both peers.

[1]: https://www.ietf.org/archive/id/draft-davidben-tls-key-share-prediction-00.html#name-downgrades
2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton e178646af5 test_client_rejects_hrr_with_varied_session_id: tighten
By ignoring everything not precisely expected, these ran the risk
of incorrectly passing.  eg, `assert_server_requests_retry_and_echoes_session_id`
would pass if the server sent a `ServerHello`.
2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton 30438654f3 tests/api.rs: minor formatting corrections 2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton 9e4fd799d1 Pass through key exchange errors
In 3355e06f9 we generalised the error type here, but we didn't
get rid of code that discarded the information-less error.
2024-02-19 19:36:13 +00:00
Joseph Birr-Pixton cf619616d2 Remove unused `trait BorrowedPlainMessage`
There are no uses of this trait inside the crate, so remove it
and transfer the used parts into the `OutboundMessage` inherent impl.
2024-02-19 15:16:32 +00:00
Joseph Birr-Pixton 40a56fcca6 Simplify tests that inject alerts 2024-02-19 15:16:32 +00:00
Joseph Birr-Pixton f6cd567fc2 Improve linking to per-process default provider docs 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton 3a52829b17 ClientCertVerifierBuilder docs nits 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton 96dc28de32 Add manual section for FIPS 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton 3f0e0fc66f Fix broken link to `CryptoProvider` 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton 33d4f01e16 features.rs: label which are extensible 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton e2f1e604c4 features.rs: remove punctuation from list 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton 581b14d605 features.rs: de-duplicate 0rtt item 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton e2c5276cac Update manual::features and refer to it 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton a76614b719 Fix stray list in "Examples" section 2024-02-19 11:05:47 +00:00
Joseph Birr-Pixton fe0c345254 Publish pre-release documentation via github-pages 2024-02-19 11:05:47 +00:00
Eloi DEMOLIS cf09842ca5 Move is_valid_ccs as a method of InboundMessage
Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
2024-02-16 09:10:13 +00:00
Eloi DEMOLIS 2f02ddc21b Create type OutboundChunks for OutboundMessage
The ConnectionCommon<T>::write_vectored was implemented by processing
each chunk, fragmenting them and wrapping each fragment in a
OutboundMessage before encrypting and sending it as separate TLS frames.
For very fragmented payloads this generates a lot of very small payloads
with most of the data being TLS headers.

OutboundChunks can contain an arbitrary amount of fragmented chunks.
This allows write_vectored to process all its chunks at once,
fragmenting it in place if needed and wrapping it in a OutboundMessage.
All the chunks are merged in a contiguous vector (taking atvantage of an
already existent copy) before being encrypted and sent as a single TLS
frame.

Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
Co-Authored-By: Emmanuel Bosquet <bjokac@gmail.com>
2024-02-16 09:10:13 +00:00
Eloi DEMOLIS 9af53f25f9 Split BorrowedPlainMessage in inbound and outbound types
Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
2024-02-16 09:10:13 +00:00
Daniel McCarney 1cdb10f8b4 examples: ignore interrupted syscalls for mio poll
While in general these examples shouldn't be written to handle errors,
the long-running MIO poll operation is especially prone to returning
interrupted syscall errors when a debugger is attached.

This commit updates each MIO example to ignore this class of error
rather than panicing, improving the debugging experience.
2024-02-15 14:59:33 +00:00