Skip to content

Commit

Permalink
[bindings] Add private key callback (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart authored Mar 1, 2023
1 parent 8062414 commit 274f321
Show file tree
Hide file tree
Showing 9 changed files with 645 additions and 20 deletions.
1 change: 1 addition & 0 deletions bindings/rust/s2n-tls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ pin-project-lite = "0.2"
[dev-dependencies]
bytes = { version = "1" }
futures-test = "0.3"
openssl = { version = "0.10" }
3 changes: 3 additions & 0 deletions bindings/rust/s2n-tls/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub use async_cb::*;
mod client_hello;
pub use client_hello::*;

mod pkey;
pub use pkey::*;

/// Convert the connection pointer provided to a callback into a Connection
/// and Context useable with the Rust bindings.
///
Expand Down
19 changes: 8 additions & 11 deletions bindings/rust/s2n-tls/src/callbacks/async_cb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl ConnectionFuture for OptionalFuture {
#[derive(PartialEq)]
enum MarkDone {
ClientHello,
// None,
None,
}

pin_project! {
Expand Down Expand Up @@ -141,14 +141,11 @@ impl AsyncCallback {
CallbackResult::Success
}

// pub(crate) fn trigger(
// future: ConnectionFutureResult,
// conn: &mut Connection,
//) -> CallbackResult {
// let future = OptionalFuture::new(future);
// let cleanup = MarkDone::None;
// let callback = AsyncCallback { future, cleanup };
// conn.set_async_callback(callback);
// CallbackResult::Success
//}
pub(crate) fn trigger(future: ConnectionFutureResult, conn: &mut Connection) -> CallbackResult {
let future = OptionalFuture::new(future);
let cleanup = MarkDone::None;
let callback = AsyncCallback { future, cleanup };
conn.set_async_callback(callback);
CallbackResult::Success
}
}
Loading

0 comments on commit 274f321

Please sign in to comment.