Skip to content

Commit

Permalink
Add ossl111 cfg flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskagami committed Jan 1, 2025
1 parent 58b418a commit 2137c18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,16 +554,18 @@ impl NameType {
}
}

#[cfg(ossl111)]
enum CustomExtCbType {
Add,
Parse,
}

static INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
static CUSTOM_EXT_INDEXES: Lazy<Mutex<HashMap<u64, c_int>>> =
Lazy::new(|| Mutex::new(HashMap::new()));
static SSL_INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
static SESSION_CTX_INDEX: OnceCell<Index<Ssl, SslContext>> = OnceCell::new();
#[cfg(ossl111)]
static CUSTOM_EXT_INDEXES: Lazy<Mutex<HashMap<u64, c_int>>> =
Lazy::new(|| Mutex::new(HashMap::new()));

fn try_get_session_ctx_index() -> Result<&'static Index<Ssl, SslContext>, ErrorStack> {
SESSION_CTX_INDEX.get_or_try_init(Ssl::new_ex_index)
Expand Down Expand Up @@ -1842,13 +1844,15 @@ impl SslContext {
}
}

#[cfg(ossl111)]
fn get_custom_ext_cb_key(ext_type: u16, cb_type: CustomExtCbType) -> u64 {
match cb_type {
CustomExtCbType::Add => ext_type as u64,
CustomExtCbType::Parse => ext_type as u64 | 0x8000_0000_0000_0000,
}
}

#[cfg(ossl111)]
fn cached_custom_ext_ex_index<T>(key: u64) -> Index<SslContext, T>
where
T: 'static + Sync + Send,
Expand Down

0 comments on commit 2137c18

Please sign in to comment.