From 713558993ade63c024d4e7b059901a68bf2ba318 Mon Sep 17 00:00:00 2001 From: Julien Rouviere Date: Thu, 21 Mar 2024 14:38:19 +0100 Subject: [PATCH] Add getters for client hello message --- boring/src/ssl/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/boring/src/ssl/mod.rs b/boring/src/ssl/mod.rs index ff11cf5c..9bfbaf1a 100644 --- a/boring/src/ssl/mod.rs +++ b/boring/src/ssl/mod.rs @@ -2240,6 +2240,16 @@ impl ClientHello<'_> { pub fn version_str(&self) -> &'static str { self.ssl().version_str() } + + /// Returns the raw data of the client hello message + pub fn as_bytes(&self) -> &[u8] { + unsafe { slice::from_raw_parts(self.0.client_hello, self.0.client_hello_len) } + } + + /// Returns the client random data + pub fn random(&self) -> &[u8] { + unsafe { slice::from_raw_parts(self.0.random, self.0.random_len) } + } } /// Information about a cipher.