Commit Graph

18 Commits

Author SHA1 Message Date
Jared Roesch 5f017cd549 Refactor init and error handling code
Move common ffi initialization code to 'ffi::init()' and the initialization of error handling to a
a shared location.
2014-10-11 01:57:33 -07:00
Alex Crichton f1b8ad7df9 Prepare for s/static/const/ 2014-10-09 18:33:59 -07: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 fe21d4bb66 X509 Generator sample
Forcing static linking for lib wrapped as in other case doc tests
fail to locate the static library
2014-10-08 19:26:38 +03:00
Valerii Hiora 3ba768bc28 Fixed incorrect EOF handling in MemBio, added error description
Actually, EOF wasn't handled at all and it caused `mem_bio.read_to_end()` to fail. Which in turn failed all `write_pem` implementations.
2014-10-07 19:58:52 +03:00
Valerii Hiora 9dd8ce9270 Potential fix for #68 2014-10-07 15:21:17 +03:00
Valerii Hiora 72ee42adba Better error handling in cert generation
Now it should correctly free all resources in case
of failure.
2014-10-06 07:12:54 +03:00
Jared Roesch a8cadc46ac Load crypto error strings 2014-10-05 02:50:33 -07:00
Jared Roesch b3c80a76dd Make errors human readable
Change error messages from numeric codes to human readable strings. This makes debugging failures much easier.
2014-10-05 02:43:37 -07:00
Steven Fackler b8fd300f80 Clean up warnings 2014-10-04 19:44:06 -07:00
D.K 09ecc7e521 Changes made to support 0.12.0-dev ( October 2, 2014 ) 2014-10-04 19:40:34 -07:00
Steven Fackler c09ec835fa Merge pull request #64 from reem/fix/big-num-is-zero
Add a dummy bn_is_zero C dependency to wrap BN_is_zero
2014-10-04 22:06:50 -04:00
Steven Fackler 78d438baef Merge pull request #58 from vhbit/verify-data
User-provided data in verify
2014-10-04 21:59:13 -04:00
Jonathan Reem c22b3c5063 Add a dummy bn_is_zero C dependency to wrap BN_is_zero
This is necessary because on some architectures BN_is_zero
is a CPP macro, so trying to link against it in an `extern "C"`
block causes a linker error.

This also introduces a build command to Cargo to compile
the bn_is_zero wrapper.
2014-10-04 18:18:02 -07:00
Valerii Hiora fbb359720b User-provided data in verify 2014-10-02 10:15:50 +03:00
Alex Crichton be0e83c978 Add bindings to CRYPTO_memcmp
This should help other projects use a constant-time memory comparison.
2014-10-01 13:28:56 -07:00
Valerii Hiora a154ceeed2 Unification and explicity in FFI type decls 2014-09-30 09:39:21 +03:00
Valerii Hiora 02637ec7d4 single `ffi` module 2014-09-30 08:21:31 +03:00