Skip to content

Commit

Permalink
implement SSL_get_verify_mode
Browse files Browse the repository at this point in the history
We already implemented `SSL_CTX_get_verify_mode` and had all the pieces
laying around for the `SSL` equiv. Implementing this for `SSL` objects
will make writing a unit test for a piece of the `SSL_CONF_` API easier.
  • Loading branch information
cpu committed Jun 26, 2024
1 parent d8b0ccd commit e2df099
Show file tree
Hide file tree
Showing 4 changed files with 12 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 @@ -379,7 +379,7 @@
| `SSL_get_state` | | | :white_check_mark: |
| `SSL_get_verify_callback` | | | |
| `SSL_get_verify_depth` | | | :white_check_mark: |
| `SSL_get_verify_mode` | | | |
| `SSL_get_verify_mode` | | | :white_check_mark: |
| `SSL_get_verify_result` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_get_version` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_get_wbio` | | :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 @@ -156,6 +156,7 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_get_SSL_CTX",
"SSL_get_state",
"SSL_get_verify_depth",
"SSL_get_verify_mode",
"SSL_get_verify_result",
"SSL_get_version",
"SSL_get_wbio",
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 @@ -1362,6 +1362,12 @@ entry! {
}
}

entry! {
pub fn _SSL_get_verify_mode(ssl: *const SSL) -> c_int {
try_clone_arc!(ssl).get().get_verify_mode().into()
}
}

entry! {
pub fn _SSL_set_verify_depth(ssl: *mut SSL, depth: c_int) {
try_clone_arc!(ssl).get_mut().set_verify_depth(depth)
Expand Down
4 changes: 4 additions & 0 deletions rustls-libssl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,10 @@ impl Ssl {
self.verify_mode = mode;
}

fn get_verify_mode(&self) -> VerifyMode {
self.verify_mode
}

fn set_verify_depth(&mut self, depth: c_int) {
self.verify_depth = depth;
}
Expand Down

0 comments on commit e2df099

Please sign in to comment.