Loading openssl-sys/src/ssl.rs +4 −4 Original line number Diff line number Diff line Loading @@ -512,12 +512,12 @@ cfg_if! { } cfg_if! { if #[cfg(ossl300)] { pub unsafe fn SSL_get_peer_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_int { SSL_ctrl(ssl, SSL_CTRL_GET_PEER_TMP_KEY, 0, key as *mut c_void) as c_int pub unsafe fn SSL_get_peer_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long { SSL_ctrl(ssl, SSL_CTRL_GET_PEER_TMP_KEY, 0, key as *mut c_void) } pub unsafe fn SSL_get_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_int { SSL_ctrl(ssl, SSL_CTRL_GET_TMP_KEY, 0, key as *mut c_void) as c_int pub unsafe fn SSL_get_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long { SSL_ctrl(ssl, SSL_CTRL_GET_TMP_KEY, 0, key as *mut c_void) } } } Loading openssl/src/lib.rs +10 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ #[doc(inline)] pub use ffi::init; use libc::c_int; use libc::{c_int, c_long}; use crate::error::ErrorStack; Loading Loading @@ -212,6 +212,15 @@ fn cvt(r: c_int) -> Result<c_int, ErrorStack> { } } #[inline] fn cvt_long(r: c_long) -> Result<c_long, ErrorStack> { if r <= 0 { Err(ErrorStack::get()) } else { Ok(r) } } #[inline] fn cvt_n(r: c_int) -> Result<c_int, ErrorStack> { if r < 0 { Loading openssl/src/ssl/mod.rs +3 −3 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ use crate::x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef}; #[cfg(any(ossl102, libressl261))] use crate::x509::verify::X509VerifyParamRef; use crate::x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509}; use crate::{cvt, cvt_n, cvt_p, init}; use crate::{cvt, cvt_long, cvt_n, cvt_p, init}; use bitflags::bitflags; use cfg_if::cfg_if; use foreign_types::{ForeignType, ForeignTypeRef, Opaque}; Loading Loading @@ -3455,7 +3455,7 @@ impl SslRef { pub fn peer_tmp_key(&self) -> Result<PKey<Public>, ErrorStack> { unsafe { let mut key = ptr::null_mut(); match cvt(ffi::SSL_get_peer_tmp_key(self.as_ptr(), &mut key)) { match cvt_long(ffi::SSL_get_peer_tmp_key(self.as_ptr(), &mut key)) { Ok(_) => Ok(PKey::<Public>::from_ptr(key)), Err(e) => Err(e), } Loading @@ -3471,7 +3471,7 @@ impl SslRef { pub fn tmp_key(&self) -> Result<PKey<Public>, ErrorStack> { unsafe { let mut key = ptr::null_mut(); match cvt(ffi::SSL_get_tmp_key(self.as_ptr(), &mut key)) { match cvt_long(ffi::SSL_get_tmp_key(self.as_ptr(), &mut key)) { Ok(_) => Ok(PKey::<Public>::from_ptr(key)), Err(e) => Err(e), } Loading openssl/src/ssl/test/mod.rs +2 −2 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ fn state() { // return P-384 keys, and the peer and local keys are different. #[test] #[cfg(ossl300)] fn peer_temp_key_p384() { fn peer_tmp_key_p384() { let mut server = Server::builder(); server.ctx().set_groups_list("P-384").unwrap(); let server = server.build(); Loading @@ -350,7 +350,7 @@ fn peer_temp_key_p384() { // temp key sent in the initial key share. #[test] #[cfg(ossl300)] fn peer_temp_key_rsa() { fn peer_tmp_key_rsa() { let mut server = Server::builder(); server.ctx().set_cipher_list("RSA").unwrap(); // RSA key exchange is not allowed in TLS 1.3, so force the connection Loading Loading
openssl-sys/src/ssl.rs +4 −4 Original line number Diff line number Diff line Loading @@ -512,12 +512,12 @@ cfg_if! { } cfg_if! { if #[cfg(ossl300)] { pub unsafe fn SSL_get_peer_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_int { SSL_ctrl(ssl, SSL_CTRL_GET_PEER_TMP_KEY, 0, key as *mut c_void) as c_int pub unsafe fn SSL_get_peer_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long { SSL_ctrl(ssl, SSL_CTRL_GET_PEER_TMP_KEY, 0, key as *mut c_void) } pub unsafe fn SSL_get_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_int { SSL_ctrl(ssl, SSL_CTRL_GET_TMP_KEY, 0, key as *mut c_void) as c_int pub unsafe fn SSL_get_tmp_key(ssl: *mut SSL, key: *mut *mut EVP_PKEY) -> c_long { SSL_ctrl(ssl, SSL_CTRL_GET_TMP_KEY, 0, key as *mut c_void) } } } Loading
openssl/src/lib.rs +10 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ #[doc(inline)] pub use ffi::init; use libc::c_int; use libc::{c_int, c_long}; use crate::error::ErrorStack; Loading Loading @@ -212,6 +212,15 @@ fn cvt(r: c_int) -> Result<c_int, ErrorStack> { } } #[inline] fn cvt_long(r: c_long) -> Result<c_long, ErrorStack> { if r <= 0 { Err(ErrorStack::get()) } else { Ok(r) } } #[inline] fn cvt_n(r: c_int) -> Result<c_int, ErrorStack> { if r < 0 { Loading
openssl/src/ssl/mod.rs +3 −3 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ use crate::x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef}; #[cfg(any(ossl102, libressl261))] use crate::x509::verify::X509VerifyParamRef; use crate::x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509}; use crate::{cvt, cvt_n, cvt_p, init}; use crate::{cvt, cvt_long, cvt_n, cvt_p, init}; use bitflags::bitflags; use cfg_if::cfg_if; use foreign_types::{ForeignType, ForeignTypeRef, Opaque}; Loading Loading @@ -3455,7 +3455,7 @@ impl SslRef { pub fn peer_tmp_key(&self) -> Result<PKey<Public>, ErrorStack> { unsafe { let mut key = ptr::null_mut(); match cvt(ffi::SSL_get_peer_tmp_key(self.as_ptr(), &mut key)) { match cvt_long(ffi::SSL_get_peer_tmp_key(self.as_ptr(), &mut key)) { Ok(_) => Ok(PKey::<Public>::from_ptr(key)), Err(e) => Err(e), } Loading @@ -3471,7 +3471,7 @@ impl SslRef { pub fn tmp_key(&self) -> Result<PKey<Public>, ErrorStack> { unsafe { let mut key = ptr::null_mut(); match cvt(ffi::SSL_get_tmp_key(self.as_ptr(), &mut key)) { match cvt_long(ffi::SSL_get_tmp_key(self.as_ptr(), &mut key)) { Ok(_) => Ok(PKey::<Public>::from_ptr(key)), Err(e) => Err(e), } Loading
openssl/src/ssl/test/mod.rs +2 −2 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ fn state() { // return P-384 keys, and the peer and local keys are different. #[test] #[cfg(ossl300)] fn peer_temp_key_p384() { fn peer_tmp_key_p384() { let mut server = Server::builder(); server.ctx().set_groups_list("P-384").unwrap(); let server = server.build(); Loading @@ -350,7 +350,7 @@ fn peer_temp_key_p384() { // temp key sent in the initial key share. #[test] #[cfg(ossl300)] fn peer_temp_key_rsa() { fn peer_tmp_key_rsa() { let mut server = Server::builder(); server.ctx().set_cipher_list("RSA").unwrap(); // RSA key exchange is not allowed in TLS 1.3, so force the connection Loading