From f79fd8cea985540098bae78503b444130c2e433f Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 7 Dec 2015 23:28:28 -0800 Subject: [PATCH] Add BIO type definitions --- openssl-sys/src/lib.rs | 57 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 0f40bfed..324d7621 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -15,11 +15,8 @@ use std::sync::{Once, ONCE_INIT}; pub type ASN1_INTEGER = c_void; pub type ASN1_STRING = c_void; pub type ASN1_TIME = c_void; -pub type BIO = c_void; -pub type BIO_METHOD = c_void; pub type BN_CTX = c_void; pub type COMP_METHOD = c_void; -pub type CRYPTO_EX_DATA = c_void; pub type DH = c_void; pub type ENGINE = c_void; pub type EVP_CIPHER = c_void; @@ -39,6 +36,60 @@ pub type X509_NAME_ENTRY = c_void; pub type X509_REQ = c_void; pub type X509_STORE_CTX = c_void; pub type stack_st_X509_EXTENSION = c_void; +pub type stack_st_void = c_void; +pub type bio_st = c_void; + +pub type bio_info_cb = Option; + +#[repr(C)] +pub struct BIO_METHOD { + pub type_: c_int, + pub name: *const c_char, + pub bwrite: Option c_int>, + pub bread: Option c_int>, + pub bputs: Option c_int>, + pub bgets: Option c_int>, + pub ctrl: Option c_long>, + pub create: Option c_int>, + pub destroy: Option c_int>, + pub callback_ctrl: Option c_long>, +} + +#[repr(C)] +pub struct BIO { + pub method: *mut BIO_METHOD, + pub callback: Option c_long>, + pub cb_arg: *mut c_char, + pub init: c_int, + pub shutdown: c_int, + pub flags: c_int, + pub retry_reason: c_int, + pub num: c_int, + pub ptr: *mut c_void, + pub next_bio: *mut BIO, + pub prev_bio: *mut BIO, + pub references: c_int, + pub num_read: c_ulong, + pub num_write: c_ulong, + pub ex_data: CRYPTO_EX_DATA, +} + +#[repr(C)] +pub struct CRYPTO_EX_DATA { + pub sk: *mut stack_st_void, + pub dummy: c_int, +} #[repr(C)] pub struct EVP_MD_CTX {