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

Extend signing key algorithm support #23

Merged
merged 4 commits into from
May 3, 2024
Merged
Changes from 1 commit
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
74 changes: 74 additions & 0 deletions rustls-libssl/tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,80 @@ fn server() {
assert_eq!(openssl_output, rustls_output);
}

fn server_with_key_algorithm(key_type: &str, sig_algs: &str, version_flag: &str) {
fn connect(key_type: &str, sig_algs: &str, version_flag: &str) {
Command::new("openssl")
.env("LD_LIBRARY_PATH", "")
.args([
"s_client",
"-connect",
"localhost:5556",
cpu marked this conversation as resolved.
Show resolved Hide resolved
"-sigalgs",
sig_algs,
"-CAfile",
&format!("test-ca/{key_type}/ca.cert"),
"-verify",
"1",
version_flag,
])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();
}

let mut openssl_server = KillOnDrop(Some(
Command::new("tests/maybe-valgrind.sh")
.env("LD_LIBRARY_PATH", "")
.args([
"target/server",
"5556",
&format!("test-ca/{key_type}/server.key"),
&format!("test-ca/{key_type}/server.cert"),
"unauth",
"none",
])
.stdout(Stdio::piped())
.spawn()
.unwrap(),
));
wait_for_stdout(openssl_server.0.as_mut().unwrap(), b"listening\n");
connect(key_type, sig_algs, version_flag);

let openssl_output = print_output(openssl_server.take_inner().wait_with_output().unwrap());

let mut rustls_server = KillOnDrop(Some(
Command::new("tests/maybe-valgrind.sh")
.args([
"target/server",
"5556",
&format!("test-ca/{key_type}/server.key"),
&format!("test-ca/{key_type}/server.cert"),
"unauth",
"none",
])
.stdout(Stdio::piped())
.spawn()
.unwrap(),
));
wait_for_stdout(rustls_server.0.as_mut().unwrap(), b"listening\n");
connect(key_type, sig_algs, version_flag);

let rustls_output = print_output(rustls_server.take_inner().wait_with_output().unwrap());
assert_eq!(openssl_output, rustls_output);
}

#[test]
#[ignore]
fn server_key_algorithms() {
server_with_key_algorithm("rsa", "rsa_pss_rsae_sha256", "-tls1_3");
server_with_key_algorithm("rsa", "rsa_pss_rsae_sha384", "-tls1_3");
server_with_key_algorithm("rsa", "rsa_pss_rsae_sha512", "-tls1_3");
server_with_key_algorithm("rsa", "rsa_pkcs1_sha256", "-tls1_2");
server_with_key_algorithm("rsa", "rsa_pkcs1_sha384", "-tls1_2");
server_with_key_algorithm("rsa", "rsa_pkcs1_sha512", "-tls1_2");
}

const NGINX_LOG_LEVEL: &str = "info";

#[test]
Expand Down