Skip to content

Commit b762f51

Browse files
committed
error: map InvalidEncryptedClientHello errors
We added `rustls_result` entries for these, but weren't mapping them correctly, always returning `RUSTLS_RESULT_GENERAL` errors for anything that was a `rustls::EncryptedClientHello(_)` instance.
1 parent 67b97b8 commit b762f51

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

librustls/src/error.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ pub(crate) fn map_error(input: Error) -> rustls_result {
432432
Error::InconsistentKeys(InconsistentKeys::KeyMismatch) => InconsistentKeysKeysMismatch,
433433
Error::InconsistentKeys(InconsistentKeys::Unknown) => InconsistentKeysUnknown,
434434

435+
Error::InvalidEncryptedClientHello(err) => map_ech_error(err),
436+
435437
_ => General,
436438
}
437439
}
@@ -461,6 +463,21 @@ pub(crate) fn map_crl_error(err: CertRevocationListError) -> rustls_result {
461463
}
462464
}
463465

466+
pub(crate) fn map_ech_error(err: EncryptedClientHelloError) -> rustls_result {
467+
use rustls_result::*;
468+
469+
match err {
470+
EncryptedClientHelloError::InvalidConfigList => {
471+
InvalidEncryptedClientHelloInvalidConfigList
472+
}
473+
EncryptedClientHelloError::NoCompatibleConfig => {
474+
InvalidEncryptedClientHelloNoCompatibleConfig
475+
}
476+
EncryptedClientHelloError::SniRequired => InvalidEncryptedClientHelloSniRequired,
477+
_ => General,
478+
}
479+
}
480+
464481
pub(crate) fn map_verifier_builder_error(err: VerifierBuilderError) -> rustls_result {
465482
match err {
466483
VerifierBuilderError::NoRootAnchors => {

0 commit comments

Comments
 (0)