Skip to content
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
3 changes: 1 addition & 2 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ pub fn named_group_to_nid(group: NamedGroup) -> Option<c_int> {
FFDHE4096 => Some(NID_FFDHE4096),
FFDHE6144 => Some(NID_FFDHE6144),
FFDHE8192 => Some(NID_FFDHE8192),
Unknown(id) => Some(TLSEXT_NID_UNKNOWN | id as c_int),
_ => None,
other => Some(TLSEXT_NID_UNKNOWN | u16::from(other) as c_int),
}
}

Expand Down
28 changes: 26 additions & 2 deletions tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,25 @@ fn client_real_world() {
let openssl_output = Command::new("tests/maybe-valgrind.sh")
.env("LD_LIBRARY_PATH", "")
.env("NO_ECHO", "1")
.args(["target/client", "example.com", "443", "default"])
.args(["target/client", "jbp.io", "443", "default"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_output = Command::new("tests/maybe-valgrind.sh")
.env("NO_ECHO", "1")
.args(["target/client", "example.com", "443", "default"])
.args(["target/client", "jbp.io", "443", "default"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let openssl_output = openssl_output
.replace_stdout_line("negotiated group NID: ", "negotiated group NID: <varies>");
let rustls_output = rustls_output
.replace_stdout_line("negotiated group NID: ", "negotiated group NID: <varies>");

assert_eq!(openssl_output, rustls_output);
}

Expand Down Expand Up @@ -818,6 +823,25 @@ fn print_output(out: Output) -> PrettyOutput {
#[derive(PartialEq)]
struct PrettyOutput(Output);

impl PrettyOutput {
fn replace_stdout_line(mut self, prefix: &str, replace_with: &str) -> Self {
let mut out = String::new();
for line in String::from_utf8(self.0.stdout)
.expect("stdout should be valid utf8")
.lines()
{
match line.starts_with(prefix) {
true => out.push_str(replace_with),
false => out.push_str(line),
}
out.push('\n');
}

self.0.stdout = out.into_bytes();
self
}
}

impl fmt::Debug for PrettyOutput {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Output")
Expand Down