Add RSA structs

This commit is contained in:
Daniel Albert 2016-01-01 19:33:49 +00:00
parent 84c1880ed5
commit 5813ca371d
3 changed files with 44 additions and 4 deletions

View File

@ -22,9 +22,7 @@ pub type ENGINE = c_void;
pub type EVP_CIPHER = c_void; pub type EVP_CIPHER = c_void;
pub type EVP_CIPHER_CTX = c_void; pub type EVP_CIPHER_CTX = c_void;
pub type EVP_MD = c_void; pub type EVP_MD = c_void;
pub type EVP_PKEY = c_void;
pub type EVP_PKEY_CTX = c_void; pub type EVP_PKEY_CTX = c_void;
pub type RSA = c_void;
pub type SSL = c_void; pub type SSL = c_void;
pub type SSL_CTX = c_void; pub type SSL_CTX = c_void;
pub type SSL_METHOD = c_void; pub type SSL_METHOD = c_void;
@ -65,6 +63,47 @@ pub struct BIO_METHOD {
// so we can create static BIO_METHODs // so we can create static BIO_METHODs
unsafe impl Sync for BIO_METHOD {} unsafe impl Sync for BIO_METHOD {}
#[repr(C)]
pub struct RSA {
pad: c_int,
version: c_long,
meth: *const c_void,
pub engine: *mut c_void,
pub n: *mut BIGNUM,
pub e: *mut BIGNUM,
pub d: *mut BIGNUM,
pub p: *mut BIGNUM,
pub q: *mut BIGNUM,
pub dmp1: *mut BIGNUM,
pub dmq1: *mut BIGNUM,
pub iqmp: *mut BIGNUM,
ex_data: *mut c_void,
references: c_int,
flags: c_int,
_method_mod_n: *mut c_void,
_method_mod_p: *mut c_void,
_method_mod_q: *mut c_void,
bignum_data: *mut c_char,
blinding: *mut c_void,
mt_blinding: *mut c_void,
}
#[repr(C)]
pub struct EVP_PKEY {
pub type_: c_int,
pub save_type: c_int,
pub references: c_int,
pub ameth: *const c_void,
engine: *mut ENGINE,
pub pkey: *mut c_void,
save_parameters: c_int,
attributes: *mut c_void,
}
#[repr(C)] #[repr(C)]
pub struct BIO { pub struct BIO {
pub method: *mut BIO_METHOD, pub method: *mut BIO_METHOD,

View File

@ -21,5 +21,6 @@ pub mod pkey;
pub mod rand; pub mod rand;
pub mod symm; pub mod symm;
pub mod memcmp; pub mod memcmp;
pub mod rsa;
mod symm_internal; mod symm_internal;

View File

@ -93,7 +93,7 @@ impl PKey {
None, None,
ptr::null_mut())); ptr::null_mut()));
Ok(PKey { Ok(PKey {
evp: evp, evp: evp as *mut ffi::EVP_PKEY,
parts: Parts::Both, parts: Parts::Both,
}) })
} }
@ -112,7 +112,7 @@ impl PKey {
None, None,
ptr::null_mut())); ptr::null_mut()));
Ok(PKey { Ok(PKey {
evp: evp, evp: evp as *mut ffi::EVP_PKEY,
parts: Parts::Public, parts: Parts::Public,
}) })
} }