Skip to content

Commit

Permalink
fix pointer cast in renegotiate test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmayclin committed Dec 7, 2024
1 parent 2dc960d commit 7c22c36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bindings/rust/s2n-tls/src/renegotiate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,11 @@ mod tests {
// Perform the pkey operation with the selected cert / key pair.
let op = this.op.take().unwrap();
let opt_ptr = op.as_ptr();
let chain_ptr = conn.selected_cert().unwrap().as_mut_ptr();
let chain_ptr = conn.selected_cert().unwrap().as_ptr();
unsafe {
let key_ptr = s2n_cert_chain_and_key_get_private_key(chain_ptr)
// SAFETY, mut cast: get_private_key does not modify the
// chain, and it is invalid to modify key through `key_ptr`
let key_ptr = s2n_cert_chain_and_key_get_private_key(chain_ptr as *mut _)
.into_result()?
.as_ptr();
s2n_async_pkey_op_perform(opt_ptr, key_ptr).into_result()?;
Expand Down

0 comments on commit 7c22c36

Please sign in to comment.