Skip to content
Closed
Show file tree
Hide file tree
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
96 changes: 41 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ subtle = { version = "2.5.0", default-features = false }
time = { version = "0.3.6", default-features = false }
tikv-jemallocator = "0.6"
tokio = { version = "1.34", features = ["io-util", "macros", "net", "rt"]}
webpki = { package = "rustls-webpki", version = "0.102.8", features = ["alloc"], default-features = false }
webpki = { package = "rustls-webpki", version = "0.103.13", features = ["alloc"], default-features = false }
webpki-roots = "0.26"
x25519-dalek = { version = "2", features = ["static_secrets"] }
x509-parser = "0.16"
Expand Down
2 changes: 1 addition & 1 deletion rustls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ zlib-rs = { workspace = true, optional = true }
default = ["aws_lc_rs", "logging", "std", "tls12"]
std = ["webpki/std", "pki-types/std", "once_cell/std"]
logging = ["log"]
aws_lc_rs = ["dep:aws-lc-rs", "webpki/aws_lc_rs"]
aws_lc_rs = ["dep:aws-lc-rs", "webpki/aws-lc-rs"]
aws-lc-rs = ["aws_lc_rs"] # Alias because Cargo features commonly use `-`
brotli = ["dep:brotli", "dep:brotli-decompressor", "std"]
ring = ["dep:ring", "webpki/ring", "dep:x25519-dalek"]
Expand Down
3 changes: 1 addition & 2 deletions rustls/src/crypto/aws_lc_rs/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use alloc::vec::Vec;
use alloc::{format, vec};
use core::fmt::{self, Debug, Formatter};

use pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer, SubjectPublicKeyInfoDer};
use webpki::alg_id;
use pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer, SubjectPublicKeyInfoDer, alg_id};

use super::ring_like::rand::SystemRandom;
use super::ring_like::signature::{self, EcdsaKeyPair, Ed25519KeyPair, KeyPair, RsaKeyPair};
Expand Down
3 changes: 1 addition & 2 deletions rustls/src/crypto/ring/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use alloc::vec::Vec;
use alloc::{format, vec};
use core::fmt::{self, Debug, Formatter};

use pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer, SubjectPublicKeyInfoDer};
use webpki::alg_id;
use pki_types::{PrivateKeyDer, PrivatePkcs8KeyDer, SubjectPublicKeyInfoDer, alg_id};

use super::ring_like::rand::{SecureRandom, SystemRandom};
use super::ring_like::signature::{self, EcdsaKeyPair, Ed25519KeyPair, KeyPair, RsaKeyPair};
Expand Down
37 changes: 27 additions & 10 deletions rustls/src/webpki/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,26 @@ fn pki_error(error: webpki::Error) -> Error {
use webpki::Error::*;
match error {
BadDer | BadDerTime | TrailingData(_) => CertificateError::BadEncoding.into(),
CertNotValidYet => CertificateError::NotValidYet.into(),
CertExpired | InvalidCertValidity => CertificateError::Expired.into(),
CertNotValidYet { .. } => CertificateError::NotValidYet.into(),
CertExpired { .. } | InvalidCertValidity => CertificateError::Expired.into(),
UnknownIssuer => CertificateError::UnknownIssuer.into(),
CertNotValidForName => CertificateError::NotValidForName.into(),
CertNotValidForName(_) => CertificateError::NotValidForName.into(),
CertRevoked => CertificateError::Revoked.into(),
UnknownRevocationStatus => CertificateError::UnknownRevocationStatus.into(),
CrlExpired => CertificateError::ExpiredRevocationList.into(),
CrlExpired { .. } => CertificateError::ExpiredRevocationList.into(),
IssuerNotCrlSigner => CertRevocationListError::IssuerInvalidForCrl.into(),

InvalidSignatureForPublicKey
| UnsupportedSignatureAlgorithm
| UnsupportedSignatureAlgorithmForPublicKey => CertificateError::BadSignature.into(),
| UnsupportedSignatureAlgorithmForPublicKey
| UnsupportedSignatureAlgorithmForPublicKeyContext(_)
| UnsupportedSignatureAlgorithmContext(_) => CertificateError::BadSignature.into(),

InvalidCrlSignatureForPublicKey
| UnsupportedCrlSignatureAlgorithm
| UnsupportedCrlSignatureAlgorithmForPublicKey => {
| UnsupportedCrlSignatureAlgorithmForPublicKey
| UnsupportedCrlSignatureAlgorithmForPublicKeyContext(_)
| UnsupportedCrlSignatureAlgorithmContext(_) => {
CertRevocationListError::BadSignature.into()
}

Expand All @@ -90,7 +94,9 @@ fn crl_error(e: webpki::Error) -> CertRevocationListError {
match e {
InvalidCrlSignatureForPublicKey
| UnsupportedCrlSignatureAlgorithm
| UnsupportedCrlSignatureAlgorithmForPublicKey => CertRevocationListError::BadSignature,
| UnsupportedCrlSignatureAlgorithmForPublicKey
| UnsupportedCrlSignatureAlgorithmForPublicKeyContext(_)
| UnsupportedCrlSignatureAlgorithmContext(_) => CertRevocationListError::BadSignature,
InvalidCrlNumber => CertRevocationListError::InvalidCrlNumber,
InvalidSerialNumber => CertRevocationListError::InvalidRevokedCertSerialNumber,
IssuerNotCrlSigner => CertRevocationListError::IssuerInvalidForCrl,
Expand Down Expand Up @@ -118,6 +124,7 @@ fn parse_crls(
}

mod tests {
use alloc::vec;
#[test]
fn pki_crl_errors() {
use super::{pki_error, CertRevocationListError, CertificateError, Error};
Expand All @@ -132,7 +139,12 @@ mod tests {
Error::InvalidCertRevocationList(CertRevocationListError::BadSignature),
);
assert_eq!(
pki_error(webpki::Error::UnsupportedCrlSignatureAlgorithmForPublicKey),
pki_error(webpki::Error::UnsupportedCrlSignatureAlgorithmForPublicKeyContext(
webpki::UnsupportedSignatureAlgorithmForPublicKeyContext {
signature_algorithm_id: vec![],
public_key_algorithm_id: vec![],
}
)),
Error::InvalidCertRevocationList(CertRevocationListError::BadSignature),
);

Expand Down Expand Up @@ -161,7 +173,12 @@ mod tests {
BadSignature,
),
(
webpki::Error::UnsupportedCrlSignatureAlgorithmForPublicKey,
webpki::Error::UnsupportedCrlSignatureAlgorithmForPublicKeyContext(
webpki::UnsupportedSignatureAlgorithmForPublicKeyContext {
signature_algorithm_id: vec![],
public_key_algorithm_id: vec![],
},
),
BadSignature,
),
(webpki::Error::InvalidCrlNumber, InvalidCrlNumber),
Expand Down Expand Up @@ -189,7 +206,7 @@ mod tests {
),
];
for t in testcases {
assert_eq!(crl_error(t.0), t.1);
assert_eq!(crl_error(t.0.clone()), t.1);
}

assert!(matches!(
Expand Down