Skip to content

Commit

Permalink
Implement SSL_get_SSL_CTX
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed May 2, 2024
1 parent 2667517 commit c5cfeeb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rustls-libssl/MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
| `SSL_get1_peer_certificate` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_get1_session` | | :white_check_mark: | :white_check_mark: |
| `SSL_get1_supported_ciphers` | | | |
| `SSL_get_SSL_CTX` | | | |
| `SSL_get_SSL_CTX` | | | :white_check_mark: |
| `SSL_get_all_async_fds` | | | |
| `SSL_get_async_status` | | | |
| `SSL_get_certificate` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Expand Down
1 change: 1 addition & 0 deletions rustls-libssl/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_get_servername_type",
"SSL_get_session",
"SSL_get_shutdown",
"SSL_get_SSL_CTX",
"SSL_get_state",
"SSL_get_verify_depth",
"SSL_get_verify_result",
Expand Down
6 changes: 6 additions & 0 deletions rustls-libssl/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ entry! {
}
}

entry! {
pub fn _SSL_get_SSL_CTX(ssl: *const SSL) -> *mut SSL_CTX {
Arc::as_ptr(&try_clone_arc!(ssl).get().ctx) as *mut SSL_CTX
}
}

entry! {
pub fn _SSL_set_ex_data(ssl: *mut SSL, idx: c_int, data: *mut c_void) -> c_int {
match try_clone_arc!(ssl).get_mut().set_ex_data(idx, data) {
Expand Down
1 change: 1 addition & 0 deletions rustls-libssl/tests/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ int main(int argc, char **argv) {

SSL *ssl = SSL_new(ctx);
dump_openssl_error_stack();
assert(SSL_get_SSL_CTX(ssl) == ctx);
printf("SSL_new: SSL_get_privatekey %s SSL_CTX_get0_privatekey\n",
SSL_get_privatekey(ssl) == client_key ? "same as" : "differs to");
printf("SSL_new: SSL_get_certificate %s SSL_CTX_get0_certificate\n",
Expand Down

0 comments on commit c5cfeeb

Please sign in to comment.