Skip to content

Commit

Permalink
add missing headers for systest
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEnbyperor committed May 30, 2021
1 parent c3cd5e6 commit 2ad0c2c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 22 deletions.
2 changes: 1 addition & 1 deletion openssl-sys/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ extern "C" {
#[repr(C)]
pub struct CRYPTO_EX_DATA {
sk: *mut c_void,
dummy: c_int
dummy: c_int,
}
68 changes: 50 additions & 18 deletions openssl-sys/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
}
4 changes: 2 additions & 2 deletions openssl-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion openssl-sys/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 2ad0c2c

Please sign in to comment.