aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Albert <[email protected]>2016-01-01 19:33:49 +0000
committerDaniel Albert <[email protected]>2016-01-01 19:33:49 +0000
commit5813ca371dee64c1b2a8da53924be733c82a9421 (patch)
tree162606caaf6bef136ce2fe66e8363ef87cfc0612
parentUpdate README doc link (diff)
downloadrust-openssl-5813ca371dee64c1b2a8da53924be733c82a9421.tar.xz
rust-openssl-5813ca371dee64c1b2a8da53924be733c82a9421.zip
Add RSA structs
-rw-r--r--openssl-sys/src/lib.rs43
-rw-r--r--openssl/src/crypto/mod.rs1
-rw-r--r--openssl/src/crypto/pkey.rs4
3 files changed, 44 insertions, 4 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index f780b6d9..b6d2225b 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -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;
@@ -66,6 +64,47 @@ pub struct 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)]
pub struct BIO {
pub method: *mut BIO_METHOD,
pub callback: Option<unsafe extern "C" fn(*mut BIO,
diff --git a/openssl/src/crypto/mod.rs b/openssl/src/crypto/mod.rs
index 0868ee95..bb77453f 100644
--- a/openssl/src/crypto/mod.rs
+++ b/openssl/src/crypto/mod.rs
@@ -21,5 +21,6 @@ pub mod pkey;
pub mod rand;
pub mod symm;
pub mod memcmp;
+pub mod rsa;
mod symm_internal;
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs
index 10891224..25ce28e8 100644
--- a/openssl/src/crypto/pkey.rs
+++ b/openssl/src/crypto/pkey.rs
@@ -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,
})
}