Commit Graph

29 Commits

Author SHA1 Message Date
Chris Cole 2e2fde4b1a Added BN_add_word, BN_sub_word, BN_mul_word, BN_div_word.
Removed BIGNUM_PTR struct.
2015-01-02 18:47:29 -05:00
Chris Cole 156fc65eb0 Merge remote-tracking branch 'upstream/master'
Conflicts:
	openssl-sys/src/lib.rs
2014-12-23 15:14:27 -05:00
Aaron Weiss e2fa62e2ae Replaced now removed NativeMutex with StaticMutex, and fixed Neg
implementation for BigNum.
2014-12-21 08:52:12 -05:00
Aaron Weiss a637f2b0bf Updated for language changes to macros. 2014-12-19 10:45:19 -05:00
Alex Crichton 01a5d7cc56 Update to rust master 2014-12-16 08:14:50 -08:00
Chris Cole 38682821ad Added BigNum::{from_dec_str,from_hex_str}, BN_dec2bn, and BN_hex2bn. 2014-12-14 10:02:18 -05:00
Chris Cole 7a4fbc1567 Added BigNum::one(). 2014-12-11 11:04:29 -05:00
Valerii Hiora c922090075 Update to nightly: explicit Copy trait 2014-12-11 13:44:37 +02:00
Chris Cole f0de773888 Use "ffi" namespace. 2014-12-10 22:11:29 -05:00
Chris Cole 33f3c966ac Added mod_word. 2014-12-10 22:08:32 -05:00
Chris Cole 5f76f1cb62 Merge remote-tracking branch 'upstream/master'
Conflicts:
	src/bn/mod.rs
2014-11-29 19:47:09 -05:00
Chris Cole ff04805497 Added mod_mul. 2014-11-29 19:40:48 -05:00
Cody P Schafer 381a9b6e51 sys (and bn): make CRYPTO_free() take a *mut c_void insead of a *const c_char
CRYPTO_free() ends up being used for a variety of types of data, not just
c_char. And it essentially takes full ownership of the type, making
*mut appropriate.

With this change it also more closely (exactly) matches the C defintion:
	void CRYPTO_free(void *ptr);
2014-11-24 15:38:04 -05:00
Steven Fackler af5533d936 Remove Zero and One impls 2014-11-17 16:29:12 -08:00
Steven Fackler 66df9154a6 Merge pull request #90 from ebfe/fix-build
fail! -> panic!
2014-10-30 10:58:51 -04:00
Michael Gehring 1eb79df25a fail! -> panic! 2014-10-30 09:58:22 +01:00
Steven Fackler b41201c3c9 Clean up some BN stuff 2014-10-26 21:05:27 -07:00
Valerii Hiora 3164ac0214 Cleaned up BigNum constructors 2014-10-14 22:39:07 +03:00
Valerii Hiora dd46d1922e Correct init mutexes and locking function
`libcrypto` uses locks quite intensively even without SSL. 
So they should be initialized before everything else to 
function properly in multi-threaded apps in which SSL 
operations are absent or delayed.

Finishes #79
2014-10-14 08:31:42 +03:00
Valerii Hiora 59b843517d BN_is_zero as a Rust function
Although wrapping was relatively easy it basically meant
that we depend on C compilation which becomes nightmare
as soon as multiple platforms are used. I’ve got a huge pain
once iOS was involved with 3 device archs and 2 simulator 
arches to support, not mentioning different set of include 
and lib flags.

So there are 2 different approaches:

- continue this way, maintaining all compilation issues like
  like managing correct flags, providing correct paths and so
  on. This way our Makefile will grow extremely fast and will
  actually take more efforts to maintain.

- doing it pure Rust way. In this case we provide all the 
  macros expansions inside our wrappers and there should be
  no other way to access raw data other than through those 
  wrappers. It might be fragile if OpenSSL internal data 
  structures will ever change, but I think (or hope) it is 
  pretty stable and wouldn’t change anytime soon.

This PR eliminates `BN_is_zero` at all from public API. It’s
functionality is implemented in `BigNum.is_zero` and should 
be enough. 

Additional notes:

1. I’ve moved BIGNUM into `bn` so it could access fields
   directly and keep it as an opaque structure for everyone 
   else

2. I’ve kept empty Makefile as I hope to land `feature-matrix`
   branch soon and I don’t like merging deleted/added file 
   conflicts.
2014-10-09 19:25:07 +03:00
Valerii Hiora dec5f967c6 Fixed mut_null deprecation warnings 2014-09-30 09:37:32 +03:00
Valerii Hiora 02637ec7d4 single `ffi` module 2014-09-30 08:21:31 +03:00
Chris Cole 7cbe372ce1 Removed BN_sub_word signature for the time being. 2014-09-28 00:00:17 -04:00
Chris Cole 2ef537cfb2 Removing unused signatures for the time being. 2014-09-27 23:58:48 -04:00
Chris Cole 6bc8e1c560 Use CRYPTO_free to free the result of BN_bn2bin. 2014-09-27 23:34:10 -04:00
Chris Cole 7235e03c95 Added signatures forBN_sub_word, BN_is_zero, BN_is_one, BN_is_word,
and BN_is_odd.
Fixed incorrect BN_mod_inverse signature.
Added signature for BN_bn2dec.
Added trait implementations for Zero, One, and fmt::Show.
Added to_dec_str function to BigNum impl.
2014-09-27 23:00:13 -04:00
Michael Gehring c4a275dc37 Add repr(C) to C structs 2014-08-22 17:16:16 +02:00
Israël Hallé 960718f900 Use BN_div instead of BN_mod
BN_mod is not available on all plateform and can be replaced by BN_div
with dv set as NULL.
2014-08-20 22:52:45 -04:00
Steven Fackler 203bdd076e Shift directory structure 2014-08-03 19:16:09 -07:00