From 521a162295af4fed90e6c740a35c0907d955c6f6 Mon Sep 17 00:00:00 2001 From: Joe Birr-Pixton Date: Mon, 12 Aug 2024 17:31:05 +0100 Subject: [PATCH] Implement `SSL_set_max_early_data` --- rustls-libssl/build.rs | 1 + rustls-libssl/src/entry.rs | 9 +++++++++ rustls-libssl/src/lib.rs | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/rustls-libssl/build.rs b/rustls-libssl/build.rs index 28e0b7b..54a44b5 100644 --- a/rustls-libssl/build.rs +++ b/rustls-libssl/build.rs @@ -195,6 +195,7 @@ const ENTRYPOINTS: &[&str] = &[ "SSL_set_connect_state", "SSL_set_ex_data", "SSL_set_fd", + "SSL_set_max_early_data", "SSL_set_msg_callback", "SSL_set_num_tickets", "SSL_set_options", diff --git a/rustls-libssl/src/entry.rs b/rustls-libssl/src/entry.rs index b11f54e..937e519 100644 --- a/rustls-libssl/src/entry.rs +++ b/rustls-libssl/src/entry.rs @@ -912,6 +912,15 @@ entry! { } } +entry! { + pub fn _SSL_set_max_early_data(ssl: *mut SSL, max_early_data: u32) -> c_int { + try_clone_arc!(ssl) + .get_mut() + .set_max_early_data(max_early_data); + C_INT_SUCCESS + } +} + entry! { pub fn _SSL_set_alpn_protos( ssl: *mut SSL, diff --git a/rustls-libssl/src/lib.rs b/rustls-libssl/src/lib.rs index 10a97da..ff28608 100644 --- a/rustls-libssl/src/lib.rs +++ b/rustls-libssl/src/lib.rs @@ -831,6 +831,10 @@ impl Ssl { self.num_tickets = num } + fn set_max_early_data(&mut self, max: u32) { + self.max_early_data = max; + } + fn clear_options(&mut self, clear: u64) -> u64 { self.raw_options &= !clear; self.raw_options