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

api(bindings/s2n-tls)!: remove public testing feature #4623

Merged
merged 5 commits into from
Jun 30, 2024
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
6 changes: 1 addition & 5 deletions bindings/rust/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ edition = "2021"
publish = false

[dependencies]
s2n-tls = { path = "../s2n-tls", features = ["testing"] }
s2n-tls = { path = "../s2n-tls"}
s2n-tls-sys = { path = "../s2n-tls-sys" }
criterion = { version = "0.3", features = ["html_reports"] }
anyhow = "1"

[[bench]]
name = "handshake"
harness = false

[[bench]]
name = "s2nc"
harness = false
Expand Down
26 changes: 0 additions & 26 deletions bindings/rust/integration/benches/handshake.rs

This file was deleted.

2 changes: 0 additions & 2 deletions bindings/rust/s2n-tls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ unstable-ktls = ["s2n-tls-sys/unstable-ktls"]
quic = ["s2n-tls-sys/quic"]
fips = ["s2n-tls-sys/fips"]
pq = ["s2n-tls-sys/pq"]
testing = ["bytes"]

[dependencies]
bytes = { version = "1", optional = true }
errno = { version = "0.3" }
libc = "0.2"
s2n-tls-sys = { version = "=0.2.8", path = "../s2n-tls-sys", features = ["internal"] }
Expand Down
4 changes: 2 additions & 2 deletions bindings/rust/s2n-tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ pub mod security;

pub use s2n_tls_sys as ffi;

#[cfg(any(feature = "testing", test))]
pub mod testing;
#[cfg(test)]
mod testing;
42 changes: 0 additions & 42 deletions bindings/rust/s2n-tls/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub trait Context {

pub enum Mode {
Client,
Server,
}

#[derive(Debug)]
Expand Down Expand Up @@ -128,33 +127,11 @@ impl<Server: Connection, Client: Connection> Pair<Server, Client> {
}
}

pub fn poll_send(&mut self, sender: Mode, buf: &[u8]) -> Poll<Result<()>> {
let result = match sender {
Mode::Client => self.client.0.poll_action(&mut self.client.1, |conn| {
connection::Connection::poll_send(conn, buf)
}),
Mode::Server => self.server.0.poll_action(&mut self.server.1, |conn| {
connection::Connection::poll_send(conn, buf)
}),
};
self.server.1.transfer(&mut self.client.1);
match result {
Poll::Ready(result) => {
result?;
Ok(()).into()
}
Poll::Pending => Poll::Pending,
}
}

pub fn poll_recv(&mut self, receiver: Mode, buf: &mut [u8]) -> Poll<Result<()>> {
let result = match receiver {
Mode::Client => self.client.0.poll_action(&mut self.client.1, |conn| {
connection::Connection::poll_recv(conn, buf)
}),
Mode::Server => self.server.0.poll_action(&mut self.server.1, |conn| {
connection::Connection::poll_recv(conn, buf)
}),
};
match result {
Poll::Ready(result) => {
Expand Down Expand Up @@ -294,25 +271,6 @@ pub fn tls_pair(config: crate::config::Config) -> Pair<Harness, Harness> {
Pair::new(server, client)
}

pub fn establish_connection(config: crate::config::Config) {
// create and configure a server connection
let mut server = crate::connection::Connection::new_server();
server
.set_config(config.clone())
.expect("Failed to bind config to server connection");
let server = Harness::new(server);

// create a client connection
let mut client = crate::connection::Connection::new_client();
client
.set_config(config)
.expect("Unable to set client config");
let client = Harness::new(client);

let pair = Pair::new(server, client);
poll_tls_pair(pair);
}

pub fn poll_tls_pair(mut pair: Pair<Harness, Harness>) -> Pair<Harness, Harness> {
loop {
match pair.poll() {
Expand Down
4 changes: 0 additions & 4 deletions bindings/rust/s2n-tls/src/testing/s2n_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ impl Harness {
pub fn connection(&self) -> &Connection {
&self.connection
}

pub fn connection_mut(&mut self) -> &mut Connection {
&mut self.connection
}
}

impl super::Connection for Harness {
Expand Down
Loading