From 2ad0c2caa6b6ffa54512fc93c8c6228f6d07a307 Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 30 May 2021 17:47:41 +0100 Subject: [PATCH] add missing headers for systest --- openssl-sys/src/crypto.rs | 2 +- openssl-sys/src/engine.rs | 68 ++++++++++++++++++++++++++++----------- openssl-sys/src/lib.rs | 4 +-- openssl-sys/src/ssl.rs | 9 +++++- systest/build.rs | 2 ++ 5 files changed, 63 insertions(+), 22 deletions(-) diff --git a/openssl-sys/src/crypto.rs b/openssl-sys/src/crypto.rs index d7281210ab..e31a81a043 100644 --- a/openssl-sys/src/crypto.rs +++ b/openssl-sys/src/crypto.rs @@ -132,5 +132,5 @@ extern "C" { #[repr(C)] pub struct CRYPTO_EX_DATA { sk: *mut c_void, - dummy: c_int + dummy: c_int, } diff --git a/openssl-sys/src/engine.rs b/openssl-sys/src/engine.rs index 496f1d845a..dec88b3eae 100644 --- a/openssl-sys/src/engine.rs +++ b/openssl-sys/src/engine.rs @@ -2,33 +2,65 @@ use libc::*; use *; extern "C" { - pub fn ENGINE_load_builtin_engines() -> (); + pub fn ENGINE_load_builtin_engines(); pub fn ENGINE_by_id(id: *const c_char) -> *mut ENGINE; pub fn ENGINE_init(e: *mut ENGINE) -> c_int; pub fn ENGINE_finish(e: *mut ENGINE) -> c_int; pub fn ENGINE_free(e: *mut ENGINE) -> c_int; - pub fn ENGINE_ctrl_cmd(e: *mut ENGINE, cmd_name: *const c_char, i: c_long, p: *mut c_void, f: extern fn() -> (), cmd_optional: c_int) -> c_int; - pub fn ENGINE_ctrl_cmd_string(e: *mut ENGINE, cmd_name: *const c_char, arg: *const c_char, cmd_optional: c_int) -> c_int; + pub fn ENGINE_ctrl_cmd( + e: *mut ENGINE, + cmd_name: *const c_char, + i: c_long, + p: *mut c_void, + f: extern "C" fn() -> (), + cmd_optional: c_int, + ) -> c_int; + pub fn ENGINE_ctrl_cmd_string( + e: *mut ENGINE, + cmd_name: *const c_char, + arg: *const c_char, + cmd_optional: c_int, + ) -> c_int; - pub fn ENGINE_load_private_key(e: *mut ENGINE, key_id: *const c_char, ui_method: *mut UI_METHOD, callback_data: *mut c_void) -> *mut EVP_PKEY; - pub fn ENGINE_load_public_key(e: *mut ENGINE, key_id: *const c_char, ui_method: *mut UI_METHOD, callback_data: *mut c_void) -> *mut EVP_PKEY; + pub fn ENGINE_load_private_key( + e: *mut ENGINE, + key_id: *const c_char, + ui_method: *mut UI_METHOD, + callback_data: *mut c_void, + ) -> *mut EVP_PKEY; + pub fn ENGINE_load_public_key( + e: *mut ENGINE, + key_id: *const c_char, + ui_method: *mut UI_METHOD, + callback_data: *mut c_void, + ) -> *mut EVP_PKEY; pub fn ENGINE_load_ssl_client_cert( - e: *mut ENGINE, ssl: *mut SSL, ca_dn: *mut stack_st_X509_NAME, pcert: *mut *mut X509, ppkey: *mut *mut EVP_PKEY, - pother: *mut *mut c_void, ui_method: *mut UI_METHOD, callback_data: *mut c_void + e: *mut ENGINE, + ssl: *mut SSL, + ca_dn: *mut stack_st_X509_NAME, + pcert: *mut *mut X509, + ppkey: *mut *mut EVP_PKEY, + pother: *mut *mut c_void, + ui_method: *mut UI_METHOD, + callback_data: *mut c_void, ) -> c_int; } #[repr(C)] pub struct UI_METHOD { name: *const c_char, - ui_open_session: extern fn(ui: *mut UI) -> c_int, - ui_write_string: extern fn(ui: *mut UI, uis: *mut UI_STRING) -> c_int, - ui_flush: extern fn(ui: *mut UI) -> c_int, - ui_read_string: extern fn(ui: *mut UI, uis: *mut UI_STRING) -> c_int, - ui_close_session: extern fn(ui: *mut UI) -> c_int, - ui_construct_prompt: extern fn(ui: *mut UI, object_desc: *const c_char, object_name: *const c_char) -> *mut c_char, + ui_open_session: extern "C" fn(ui: *mut UI) -> c_int, + ui_write_string: extern "C" fn(ui: *mut UI, uis: *mut UI_STRING) -> c_int, + ui_flush: extern "C" fn(ui: *mut UI) -> c_int, + ui_read_string: extern "C" fn(ui: *mut UI, uis: *mut UI_STRING) -> c_int, + ui_close_session: extern "C" fn(ui: *mut UI) -> c_int, + ui_construct_prompt: extern "C" fn( + ui: *mut UI, + object_desc: *const c_char, + object_name: *const c_char, + ) -> *mut c_char, } const UI_FLAG_REDOABLE: c_int = 0x0001; @@ -53,10 +85,10 @@ pub struct UI_STRING { #[repr(C)] pub enum UI_string_types { - UIT_NONE=0, - UIT_PROMPT, - UIT_VERIFY, - UIT_BOOLEAN, - UIT_INFO, + UIT_NONE = 0, + UIT_PROMPT, + UIT_VERIFY, + UIT_BOOLEAN, + UIT_INFO, UIT_ERROR, } diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 0453c55e1f..d865434554 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -27,9 +27,9 @@ pub use dh::*; pub use dsa::*; pub use dtls1::*; pub use ec::*; +pub use engine::*; pub use err::*; pub use evp::*; -pub use engine::*; pub use hmac::*; pub use obj_mac::*; pub use object::*; @@ -65,9 +65,9 @@ mod dh; mod dsa; mod dtls1; mod ec; +mod engine; mod err; mod evp; -mod engine; mod hmac; mod obj_mac; mod object; diff --git a/openssl-sys/src/ssl.rs b/openssl-sys/src/ssl.rs index 346cbf0fff..437c1b59ba 100644 --- a/openssl-sys/src/ssl.rs +++ b/openssl-sys/src/ssl.rs @@ -1150,7 +1150,14 @@ extern "C" { #[cfg(not(libressl))] pub fn SSL_CTX_add_client_CA(ctx: *mut SSL_CTX, cacert: *mut X509) -> c_int; - pub fn SSL_CTX_set_client_cert_cb(ctx: *mut SSL_CTX, client_cert_cb: extern fn(ssl: *mut SSL, x509: *mut*mut X509, pkey: *mut*mut EVP_PKEY)); + pub fn SSL_CTX_set_client_cert_cb( + ctx: *mut SSL_CTX, + client_cert_cb: extern "C" fn( + ssl: *mut SSL, + x509: *mut *mut X509, + pkey: *mut *mut EVP_PKEY, + ), + ); pub fn SSL_CTX_set_default_verify_paths(ctx: *mut SSL_CTX) -> c_int; pub fn SSL_CTX_load_verify_locations( diff --git a/systest/build.rs b/systest/build.rs index 5cf20bc24e..c62914ef8a 100644 --- a/systest/build.rs +++ b/systest/build.rs @@ -61,6 +61,8 @@ fn main() { .header("openssl/aes.h") .header("openssl/ocsp.h") .header("openssl/evp.h") + .header("openssl/ui.h") + .header("openssl/engine.h") .header("openssl/x509_vfy.h"); if openssl_version.is_some() {