Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

track rustls alpha.6 #368

Merged
merged 1 commit into from
Nov 29, 2023
Merged
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
16 changes: 8 additions & 8 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ read_buf = ["rustls/read_buf"]

[dependencies]
# Keep in sync with RUSTLS_CRATE_VERSION in build.rs
rustls = { version = "=0.22.0-alpha.4", features = [ "ring" ]}
rustls-webpki = "0.102.0-alpha.6"
pki-types = { package = "rustls-pki-types", version = "0.2.1", features = ["std"] }
rustls = { version = "=0.22.0-alpha.6", features = [ "ring" ]}
pki-types = { package = "rustls-pki-types", version = "0.2.3", features = ["std"] }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes to 0.2.3 instead of staying at 0.2.2 because we're using the ServerName::to_str method that's only available in 0.2.3+

webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.8", features = ["std"] }
libc = "0.2"
sct = "0.7"
rustls-pemfile = { version = "2.0.0-alpha.1" }
rustls-pemfile = "=2.0.0-alpha.2"
log = "0.4.17"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::Write;
use std::{env, fs, path::PathBuf};

// Keep in sync with Cargo.toml.
const RUSTLS_CRATE_VERSION: &str = "0.22.0-alpha.4";
const RUSTLS_CRATE_VERSION: &str = "0.22.0-alpha.6";

fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
Expand Down
13 changes: 4 additions & 9 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::borrow::Cow;
use std::convert::TryInto;
use std::ffi::CStr;
use std::fmt::{Debug, Formatter};
Expand Down Expand Up @@ -79,7 +78,7 @@ impl ServerCertVerifier for NoneVerifier {
&self,
_end_entity: &CertificateDer,
_intermediates: &[CertificateDer],
_server_name: &rustls::ServerName,
_server_name: &pki_types::ServerName<'_>,
_ocsp_response: &[u8],
_now: UnixTime,
) -> Result<ServerCertVerified, rustls::Error> {
Expand Down Expand Up @@ -255,16 +254,12 @@ impl ServerCertVerifier for Verifier {
&self,
end_entity: &CertificateDer,
intermediates: &[CertificateDer],
server_name: &rustls::ServerName,
server_name: &pki_types::ServerName<'_>,
ocsp_response: &[u8],
_now: UnixTime,
) -> Result<ServerCertVerified, rustls::Error> {
let cb = self.callback;
let server_name: Cow<'_, str> = match server_name {
rustls::ServerName::DnsName(n) => n.as_ref().into(),
rustls::ServerName::IpAddress(ip) => ip.to_string().into(),
_ => return Err(rustls::Error::General("unknown name type".to_string())),
};
let server_name = server_name.to_str();
let server_name: rustls_str = match server_name.as_ref().try_into() {
Ok(r) => r,
Err(NulByte {}) => return Err(rustls::Error::General("NUL byte in SNI".to_string())),
Expand Down Expand Up @@ -555,7 +550,7 @@ impl rustls_client_config {
Ok(s) => s,
Err(std::str::Utf8Error { .. }) => return rustls_result::InvalidDnsNameError,
};
let server_name: rustls::ServerName = match server_name.try_into() {
let server_name: pki_types::ServerName = match server_name.try_into() {
Ok(sn) => sn,
Err(_) => return rustls_result::InvalidDnsNameError,
};
Expand Down