From 33f3c966ac0448a6f906f23d7cf51969c088bfa1 Mon Sep 17 00:00:00 2001 From: Chris Cole Date: Wed, 10 Dec 2014 22:08:32 -0500 Subject: Added mod_word. --- openssl-sys/src/lib.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 2b0c9292..931920a9 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -255,6 +255,7 @@ extern "C" { pub fn BN_mod_sub(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM, m: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_mul(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_nnmod(rem: *mut BIGNUM, a: *mut BIGNUM, m: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; + pub fn BN_mod_word(r: *mut BIGNUM, w: c_ulong) -> c_ulong; pub fn BN_sqr(r: *mut BIGNUM, a: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_sub(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM) -> c_int; -- cgit v1.2.3 From 38682821ade69780e5c125fa00f1f71a3b161ffd Mon Sep 17 00:00:00 2001 From: Chris Cole Date: Sun, 14 Dec 2014 10:02:18 -0500 Subject: Added BigNum::{from_dec_str,from_hex_str}, BN_dec2bn, and BN_hex2bn. --- openssl-sys/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 03a5a567..68d2d6dc 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -81,6 +81,11 @@ pub struct BIGNUM { pub flags: c_int, } +#[repr(C)] +pub struct BIGNUM_PTR { + pub ptr: *mut BIGNUM, +} + pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, ad: *const CRYPTO_EX_DATA, idx: c_int, argl: c_long, argp: *const c_void) -> c_int; @@ -291,9 +296,14 @@ extern "C" { pub fn BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM; pub fn BN_bn2bin(a: *mut BIGNUM, to: *mut u8) -> c_int; - /* Conversion from/to string representation */ + /* Conversion from/to decimal string representation */ + pub fn BN_dec2bn(a: *mut BIGNUM_PTR, s: *const i8) -> c_int; pub fn BN_bn2dec(a: *mut BIGNUM) -> *const c_char; + /* Conversion from/to hexidecimal string representation */ + pub fn BN_hex2bn(a: *mut BIGNUM_PTR, s: *const i8) -> c_int; + pub fn BN_bn2hex(a: *mut BIGNUM) -> *const c_char; + pub fn CRYPTO_num_locks() -> c_int; pub fn CRYPTO_set_locking_callback(func: extern "C" fn(mode: c_int, n: c_int, -- cgit v1.2.3 From fa32bc950b8756b77bc1ba44d6f65276f55f4442 Mon Sep 17 00:00:00 2001 From: Chris Cole Date: Tue, 23 Dec 2014 15:50:29 -0500 Subject: Added Copy impl. --- openssl-sys/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 48fac1d2..dfcbf769 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -93,6 +93,8 @@ pub struct BIGNUM_PTR { pub ptr: *mut BIGNUM, } +impl Copy for BIGNUM_PTR {} + pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, ad: *const CRYPTO_EX_DATA, idx: c_int, argl: c_long, argp: *const c_void) -> c_int; -- cgit v1.2.3 From 2e2fde4b1a868050245b185b26a12187c379ec0d Mon Sep 17 00:00:00 2001 From: Chris Cole Date: Fri, 2 Jan 2015 18:47:29 -0500 Subject: Added BN_add_word, BN_sub_word, BN_mul_word, BN_div_word. Removed BIGNUM_PTR struct. --- openssl-sys/src/lib.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'openssl-sys/src') diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index df38215d..7471616f 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -88,13 +88,6 @@ pub struct BIGNUM { impl Copy for BIGNUM {} -#[repr(C)] -pub struct BIGNUM_PTR { - pub ptr: *mut BIGNUM, -} - -impl Copy for BIGNUM_PTR {} - pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void, ad: *const CRYPTO_EX_DATA, idx: c_int, argl: c_long, argp: *const c_void) -> c_int; @@ -275,7 +268,11 @@ extern "C" { pub fn BN_mod_sub(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM, m: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_mul(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_nnmod(rem: *mut BIGNUM, a: *mut BIGNUM, m: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; - pub fn BN_mod_word(r: *mut BIGNUM, w: c_ulong) -> c_ulong; + pub fn BN_add_word(r: *mut BIGNUM, w: c_ulong) -> c_int; + pub fn BN_sub_word(r: *mut BIGNUM, w: c_ulong) -> c_int; + pub fn BN_mul_word(r: *mut BIGNUM, w: c_ulong) -> c_int; + pub fn BN_div_word(r: *mut BIGNUM, w: c_ulong) -> c_ulong; + pub fn BN_mod_word(r: *const BIGNUM, w: c_ulong) -> c_ulong; pub fn BN_sqr(r: *mut BIGNUM, a: *mut BIGNUM, ctx: *mut BN_CTX) -> c_int; pub fn BN_sub(r: *mut BIGNUM, a: *mut BIGNUM, b: *mut BIGNUM) -> c_int; @@ -309,11 +306,11 @@ extern "C" { pub fn BN_bn2bin(a: *mut BIGNUM, to: *mut u8) -> c_int; /* Conversion from/to decimal string representation */ - pub fn BN_dec2bn(a: *mut BIGNUM_PTR, s: *const i8) -> c_int; + pub fn BN_dec2bn(a: *const *mut BIGNUM, s: *const i8) -> c_int; pub fn BN_bn2dec(a: *mut BIGNUM) -> *const c_char; /* Conversion from/to hexidecimal string representation */ - pub fn BN_hex2bn(a: *mut BIGNUM_PTR, s: *const i8) -> c_int; + pub fn BN_hex2bn(a: *const *mut BIGNUM, s: *const i8) -> c_int; pub fn BN_bn2hex(a: *mut BIGNUM) -> *const c_char; pub fn CRYPTO_num_locks() -> c_int; -- cgit v1.2.3