Skip to content

Commit

Permalink
switch back to use tongsuo 8.3 for performance reason
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Feb 19, 2024
1 parent 5439958 commit e5c76ed
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openssl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ aws-lc-sys = { version = "0.13.0", optional = true, features = ["ssl"] }
bindgen = { version = "0.69.0", optional = true, features = ["experimental"] }
cc = "1.0.61"
openssl-src = { version = "300.1.2", optional = true }
tongsuo-src = { version = "840.2.0", optional = true }
tongsuo-src = { version = "833", optional = true }
pkg-config = "0.3.9"
vcpkg = "0.2.8"

Expand Down
3 changes: 3 additions & 0 deletions openssl-sys/build/expando.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ RUST_CONF_OPENSSL_NO_OCSP
RUST_OPENSSL_IS_BORINGSSL
#endif

#ifdef BABASSL_VERSION_NUMBER
RUST_OPENSSL_IS_TONGSUO
#endif
#ifdef TONGSUO_VERSION_NUMBER
RUST_OPENSSL_IS_TONGSUO

Expand Down
4 changes: 4 additions & 0 deletions openssl-sys/src/handwritten/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,15 @@ cfg_if! {
pub fn SSL_CTX_use_sign_PrivateKey_file(ctx: *mut SSL_CTX, file: *const c_char, type_: c_int) -> c_int;
pub fn SSL_CTX_enable_ntls(ctx: *mut SSL_CTX);
pub fn SSL_CTX_disable_ntls(ctx: *mut SSL_CTX);
#[cfg(ossl300)]
pub fn SSL_CTX_enable_force_ntls(ctx: *mut SSL_CTX);
#[cfg(ossl300)]
pub fn SSL_CTX_disable_force_ntls(ctx: *mut SSL_CTX);
pub fn SSL_enable_ntls(s: *mut SSL);
pub fn SSL_disable_ntls(s: *mut SSL);
#[cfg(ossl300)]
pub fn SSL_enable_force_ntls(s: *mut SSL);
#[cfg(ossl300)]
pub fn SSL_disable_force_ntls(s: *mut SSL);
pub fn SSL_CTX_enable_sm_tls13_strict(ctx: *mut SSL_CTX);
pub fn SSL_CTX_disable_sm_tls13_strict(ctx: *mut SSL_CTX);
Expand Down
2 changes: 2 additions & 0 deletions openssl/src/ssl/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ impl SslAcceptor {
#[cfg(tongsuo)]
pub fn tongsuo_tlcp() -> Result<SslAcceptorBuilder, ErrorStack> {
let mut ctx = ctx(SslMethod::ntls_server())?;
ctx.enable_ntls();
#[cfg(ossl300)]
ctx.enable_force_ntls();
// the EC curves should always be SM2
ctx.set_cipher_list(
Expand Down
8 changes: 4 additions & 4 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,13 +852,13 @@ impl SslContextBuilder {
unsafe { ffi::SSL_CTX_disable_ntls(self.as_ptr()) }
}

#[cfg(tongsuo)]
#[cfg(all(tongsuo, ossl300))]
#[corresponds(SSL_CTX_enable_force_ntls)]
pub fn enable_force_ntls(&mut self) {
unsafe { ffi::SSL_CTX_enable_force_ntls(self.as_ptr()) }
}

#[cfg(tongsuo)]
#[cfg(all(tongsuo, ossl300))]
#[corresponds(SSL_CTX_disable_force_ntls)]
pub fn disable_force_ntls(&mut self) {
unsafe { ffi::SSL_CTX_disable_force_ntls(self.as_ptr()) }
Expand Down Expand Up @@ -2853,13 +2853,13 @@ impl SslRef {
unsafe { ffi::SSL_disable_ntls(self.as_ptr()) }
}

#[cfg(tongsuo)]
#[cfg(all(tongsuo, ossl300))]
#[corresponds(SSL_enable_force_ntls)]
pub fn enable_force_ntls(&mut self) {
unsafe { ffi::SSL_enable_force_ntls(self.as_ptr()) }
}

#[cfg(tongsuo)]
#[cfg(all(tongsuo, ossl300))]
#[corresponds(SSL_disable_force_ntls)]
pub fn disable_force_ntls(&mut self) {
unsafe { ffi::SSL_disable_force_ntls(self.as_ptr()) }
Expand Down

0 comments on commit e5c76ed

Please sign in to comment.