Commit 5813ca37 authored by Daniel Albert's avatar Daniel Albert
Browse files

Add RSA structs

parent 84c1880e
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -22,9 +22,7 @@ pub type ENGINE = c_void;
pub type EVP_CIPHER = c_void;
pub type EVP_CIPHER_CTX = c_void;
pub type EVP_MD = c_void;
pub type EVP_PKEY = c_void;
pub type EVP_PKEY_CTX = c_void;
pub type RSA = c_void;
pub type SSL = c_void;
pub type SSL_CTX = c_void;
pub type SSL_METHOD = c_void;
@@ -65,6 +63,47 @@ pub struct BIO_METHOD {
// so we can create static BIO_METHODs
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)]
pub struct BIO {
    pub method: *mut BIO_METHOD,
+1 −0
Original line number Diff line number Diff line
@@ -21,5 +21,6 @@ pub mod pkey;
pub mod rand;
pub mod symm;
pub mod memcmp;
pub mod rsa;

mod symm_internal;
+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ impl PKey {
                                                                 None,
                                                                 ptr::null_mut()));
            Ok(PKey {
                evp: evp,
                evp: evp as *mut ffi::EVP_PKEY,
                parts: Parts::Both,
            })
        }
@@ -112,7 +112,7 @@ impl PKey {
                                                             None,
                                                             ptr::null_mut()));
            Ok(PKey {
                evp: evp,
                evp: evp as *mut ffi::EVP_PKEY,
                parts: Parts::Public,
            })
        }