File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 242242| ` SSL_SESSION_print_keylog ` | | | | |
243243| ` SSL_SESSION_set1_alpn_selected ` | | | | |
244244| ` SSL_SESSION_set1_hostname ` | | | | |
245- | ` SSL_SESSION_set1_id ` | | | :white_check_mark : | |
245+ | ` SSL_SESSION_set1_id ` | | | :white_check_mark : | : white_check_mark : |
246246| ` SSL_SESSION_set1_id_context ` | | :white_check_mark : | :white_check_mark : | :white_check_mark : |
247247| ` SSL_SESSION_set1_master_key ` | | | | |
248248| ` SSL_SESSION_set1_ticket_appdata ` | | | | |
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ const ENTRYPOINTS: &[&str] = &[
211211 "SSL_SESSION_get_time" ,
212212 "SSL_SESSION_get_timeout" ,
213213 "SSL_session_reused" ,
214+ "SSL_SESSION_set1_id" ,
214215 "SSL_SESSION_set1_id_context" ,
215216 "SSL_SESSION_set_time" ,
216217 "SSL_SESSION_set_timeout" ,
Original file line number Diff line number Diff line change @@ -1700,6 +1700,20 @@ entry! {
17001700 }
17011701}
17021702
1703+ entry ! {
1704+ pub fn _SSL_SESSION_set1_id(
1705+ sess: * mut SSL_SESSION ,
1706+ sid: * const c_uchar,
1707+ sid_len: c_uint,
1708+ ) -> c_int {
1709+ let slice = try_slice!( sid, c_uint_into_usize( sid_len) ) ;
1710+ match try_clone_arc!( sess) . get_mut( ) . set_id( slice) {
1711+ Ok ( ( ) ) => C_INT_SUCCESS ,
1712+ Err ( err) => err. raise( ) . into( ) ,
1713+ }
1714+ }
1715+ }
1716+
17031717entry ! {
17041718 pub fn _SSL_SESSION_up_ref( sess: * mut SSL_SESSION ) -> c_int {
17051719 let sess = try_clone_arc!( sess) ;
Original file line number Diff line number Diff line change @@ -357,6 +357,16 @@ impl SslSession {
357357 & self . id . 0
358358 }
359359
360+ pub fn set_id ( & mut self , new_value : & [ u8 ] ) -> Result < ( ) , error:: Error > {
361+ match new_value. len ( ) {
362+ 0 ..=SslSessionLookup :: MAX_LEN => {
363+ self . id = SslSessionLookup :: for_id ( new_value) ;
364+ Ok ( ( ) )
365+ }
366+ _ => Err ( error:: Error :: bad_data ( "excess SSL_SESSION id length" ) ) ,
367+ }
368+ }
369+
360370 pub fn get_creation_time ( & self ) -> u64 {
361371 self . creation_time . 0
362372 }
@@ -425,6 +435,8 @@ impl SslSessionLookup {
425435 pub fn for_id ( id : & [ u8 ] ) -> Self {
426436 Self ( id. to_vec ( ) )
427437 }
438+
439+ const MAX_LEN : usize = 32 ;
428440}
429441
430442pub struct SslContext {
You can’t perform that action at this time.
0 commit comments