Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/crypto/src/rustls_impl/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ impl ServerCertVerifier for Verifier {
cert: &CertificateDer<'_>,
dss: &rustls::DigitallySignedStruct,
) -> core::result::Result<HandshakeSignatureValid, rustls::Error> {
// Pin the CertificateVerify signature scheme to ECDSA P-384/SHA-384,
// consistent with the cipher suite and key-exchange group pinned in
// `crypto_provider()`. Reject any other scheme so the handshake
// transcript can only be bound with the expected algorithm.
if dss.scheme != rustls::SignatureScheme::ECDSA_NISTP384_SHA384 {
return Err(rustls::Error::PeerIncompatible(
rustls::PeerIncompatible::NoSignatureSchemesInCommon,
));
}
verify_tls13_signature(
message,
cert,
Expand All @@ -316,9 +325,7 @@ impl ServerCertVerifier for Verifier {
}

fn supported_verify_schemes(&self) -> Vec<rustls::SignatureScheme> {
default_provider()
.signature_verification_algorithms
.supported_schemes()
vec![rustls::SignatureScheme::ECDSA_NISTP384_SHA384]
}
}

Expand Down Expand Up @@ -347,6 +354,15 @@ impl ClientCertVerifier for Verifier {
cert: &CertificateDer<'_>,
dss: &rustls::DigitallySignedStruct,
) -> core::result::Result<HandshakeSignatureValid, rustls::Error> {
// Pin the CertificateVerify signature scheme to ECDSA P-384/SHA-384,
// consistent with the cipher suite and key-exchange group pinned in
// `crypto_provider()`. Reject any other scheme so the handshake
// transcript can only be bound with the expected algorithm.
if dss.scheme != rustls::SignatureScheme::ECDSA_NISTP384_SHA384 {
return Err(rustls::Error::PeerIncompatible(
rustls::PeerIncompatible::NoSignatureSchemesInCommon,
));
}
verify_tls13_signature(
message,
cert,
Expand All @@ -370,9 +386,7 @@ impl ClientCertVerifier for Verifier {
}

fn supported_verify_schemes(&self) -> Vec<rustls::SignatureScheme> {
default_provider()
.signature_verification_algorithms
.supported_schemes()
vec![rustls::SignatureScheme::ECDSA_NISTP384_SHA384]
}

fn root_hint_subjects(&self) -> &[rustls::DistinguishedName] {
Expand Down
Loading