Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
verify_client_post_handshake
  • Loading branch information
youknowone committed Oct 25, 2025
commit 97f11dce721afcf81db59906fcb3a1f36b32803b
28 changes: 28 additions & 0 deletions stdlib/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,29 @@ mod _ssl {
}
}

#[pymethod]
fn verify_client_post_handshake(&self, vm: &VirtualMachine) -> PyResult<()> {
#[cfg(ossl111)]
{
let stream = self.stream.read();
let result = unsafe { SSL_verify_client_post_handshake(stream.ssl().as_ptr()) };
if result == 0 {
Err(vm.new_exception_msg(
ssl_error(vm),
"Post-handshake authentication failed".to_owned(),
))
} else {
Ok(())
}
}
#[cfg(not(ossl111))]
{
Err(vm.new_not_implemented_error(
"Post-handshake auth is not supported by your OpenSSL version.".to_owned()
))
}
}

#[cfg(osslconf = "OPENSSL_NO_COMP")]
#[pymethod]
fn compression(&self) -> Option<&'static str> {
Expand Down Expand Up @@ -1609,6 +1632,11 @@ mod _ssl {
fn SSL_get_client_ciphers(ssl: *const sys::SSL) -> *const sys::stack_st_SSL_CIPHER;
}

#[cfg(ossl111)]
unsafe extern "C" {
fn SSL_verify_client_post_handshake(ssl: *const sys::SSL) -> libc::c_int;
}

// OpenSSL BIO helper functions
// These are typically macros in OpenSSL, implemented via BIO_ctrl
const BIO_CTRL_PENDING: libc::c_int = 10;
Expand Down