Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fixes, a couple new API fns, and a bunch of stubs #43

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
| `SSL_set_trust` | | | |
| `SSL_set_verify` | | :white_check_mark: | :white_check_mark: |
| `SSL_set_verify_depth` | | :white_check_mark: | :white_check_mark: |
| `SSL_set_verify_result` | | | |
| `SSL_set_verify_result` | | | :white_check_mark: |
| `SSL_set_wfd` [^sock] | | | |
| `SSL_shutdown` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_srp_server_param_with_username` [^deprecatedin_3_0] [^srp] | | | |
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_set_SSL_CTX",
"SSL_set_verify",
"SSL_set_verify_depth",
"SSL_set_verify_result",
"SSL_shutdown",
"SSL_up_ref",
"SSL_use_certificate",
Expand Down
6 changes: 6 additions & 0 deletions src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,12 @@ entry! {
}
}

entry! {
pub fn _SSL_set_verify_result(ssl: *mut SSL, v: c_long) {
try_clone_arc!(ssl).get().set_last_verification_result(v)
}
}

entry! {
pub fn _SSL_get_certificate(ssl: *const SSL) -> *mut X509 {
try_clone_arc!(ssl).get().get_certificate()
Expand Down
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,14 @@ impl Ssl {
}
}

fn set_last_verification_result(&self, v: i64) {
match &self.conn {
ConnState::Client(_, verifier) => verifier.update_last_result(v),
ConnState::Server(_, verifier, _) => verifier.update_last_result(v),
_ => {}
}
}

fn get_last_verification_sig_scheme(&self) -> Option<SignatureScheme> {
match &self.conn {
ConnState::Client(_, verifier) => verifier.last_sig_scheme(),
Expand Down
8 changes: 8 additions & 0 deletions src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ impl ServerVerifier {
self.last_result.load(Ordering::Acquire)
}

pub fn update_last_result(&self, v: i64) {
self.last_result.store(v, Ordering::Relaxed);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Relaxed is the right choice here, but I admit to not being 100% sure. (Ditto L210).

Calling this out as something I'd appreciate input on.

}

pub fn last_sig_scheme(&self) -> Option<SignatureScheme> {
self.last_sig_scheme.read().ok().map(|scheme| *scheme)?
}
Expand Down Expand Up @@ -202,6 +206,10 @@ impl ClientVerifier {
self.last_result.load(Ordering::Acquire)
}

pub fn update_last_result(&self, v: i64) {
self.last_result.store(v, Ordering::Relaxed);
}

pub fn last_sig_scheme(&self) -> Option<SignatureScheme> {
self.last_sig_scheme.read().ok().map(|scheme| *scheme)?
}
Expand Down