Skip to content

Commit 97f11dc

Browse files
committed
verify_client_post_handshake
1 parent a262e85 commit 97f11dc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

stdlib/src/ssl.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,29 @@ mod _ssl {
12921292
}
12931293
}
12941294

1295+
#[pymethod]
1296+
fn verify_client_post_handshake(&self, vm: &VirtualMachine) -> PyResult<()> {
1297+
#[cfg(ossl111)]
1298+
{
1299+
let stream = self.stream.read();
1300+
let result = unsafe { SSL_verify_client_post_handshake(stream.ssl().as_ptr()) };
1301+
if result == 0 {
1302+
Err(vm.new_exception_msg(
1303+
ssl_error(vm),
1304+
"Post-handshake authentication failed".to_owned(),
1305+
))
1306+
} else {
1307+
Ok(())
1308+
}
1309+
}
1310+
#[cfg(not(ossl111))]
1311+
{
1312+
Err(vm.new_not_implemented_error(
1313+
"Post-handshake auth is not supported by your OpenSSL version.".to_owned()
1314+
))
1315+
}
1316+
}
1317+
12951318
#[cfg(osslconf = "OPENSSL_NO_COMP")]
12961319
#[pymethod]
12971320
fn compression(&self) -> Option<&'static str> {
@@ -1609,6 +1632,11 @@ mod _ssl {
16091632
fn SSL_get_client_ciphers(ssl: *const sys::SSL) -> *const sys::stack_st_SSL_CIPHER;
16101633
}
16111634

1635+
#[cfg(ossl111)]
1636+
unsafe extern "C" {
1637+
fn SSL_verify_client_post_handshake(ssl: *const sys::SSL) -> libc::c_int;
1638+
}
1639+
16121640
// OpenSSL BIO helper functions
16131641
// These are typically macros in OpenSSL, implemented via BIO_ctrl
16141642
const BIO_CTRL_PENDING: libc::c_int = 10;

0 commit comments

Comments
 (0)