Base: codex-main originale (prima del fork aKode)
This commit is contained in:
26
codex-rs/utils/rustls-provider/tests/preinstalled.rs
Normal file
26
codex-rs/utils/rustls-provider/tests/preinstalled.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use codex_utils_rustls_provider::ensure_rustls_crypto_provider;
|
||||
|
||||
const EMPTY_ALGORITHMS: rustls::crypto::WebPkiSupportedAlgorithms =
|
||||
rustls::crypto::WebPkiSupportedAlgorithms {
|
||||
all: &[],
|
||||
mapping: &[],
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn ensure_provider_preserves_preinstalled_provider() {
|
||||
let mut provider = rustls::crypto::aws_lc_rs::default_provider();
|
||||
provider.signature_verification_algorithms = EMPTY_ALGORITHMS;
|
||||
assert!(provider.install_default().is_ok());
|
||||
|
||||
ensure_rustls_crypto_provider();
|
||||
|
||||
let Some(provider) = rustls::crypto::CryptoProvider::get_default() else {
|
||||
panic!("preinstalled rustls provider should still be installed");
|
||||
};
|
||||
assert!(
|
||||
!provider
|
||||
.signature_verification_algorithms
|
||||
.supported_schemes()
|
||||
.contains(&rustls::SignatureScheme::ECDSA_NISTP521_SHA512)
|
||||
);
|
||||
}
|
||||
16
codex-rs/utils/rustls-provider/tests/provider.rs
Normal file
16
codex-rs/utils/rustls-provider/tests/provider.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use codex_utils_rustls_provider::ensure_rustls_crypto_provider;
|
||||
|
||||
#[test]
|
||||
fn ensure_provider_installs_ecdsa_p521_sha512_support() {
|
||||
ensure_rustls_crypto_provider();
|
||||
|
||||
let Some(provider) = rustls::crypto::CryptoProvider::get_default() else {
|
||||
panic!("rustls provider should be installed");
|
||||
};
|
||||
assert!(
|
||||
provider
|
||||
.signature_verification_algorithms
|
||||
.supported_schemes()
|
||||
.contains(&rustls::SignatureScheme::ECDSA_NISTP521_SHA512)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user