Commit Graph

128 Commits

Author SHA1 Message Date
Michael Gehring 1eb79df25a fail! -> panic! 2014-10-30 09:58:22 +01:00
pyrho 42e9438e4f Replaced vector of bytes with bytes string literal for expected output of AES_256_CBC deciphering unit test 2014-10-28 14:15:13 +01:00
pyrho 0982081dd7 Merge remote-tracking branch 'upstream/master' into aes-256-cbc-decrypt-test 2014-10-28 02:20:58 +01:00
pyrho d10c552af6 AES 256 CBC unit test 2014-10-28 02:15:31 +01:00
Steven Fackler b41201c3c9 Clean up some BN stuff 2014-10-26 21:05:27 -07:00
Steven Fackler ebbc44bb3f Update doc location 2014-10-26 13:10:57 -07:00
Valerii Hiora e47a3cf7e2 Cert loading from PEM & restructuring
- Added cert loading

- Extracted X509 tests
2014-10-15 09:24:08 +03: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
Cody P Schafer a6af89c67b ssl: allow setting cipher list 2014-10-13 16:22:12 -04:00
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
Steven Fackler bd38812880 Merge pull request #75 from kinghajj/change-final-to-finalize
"final" is now a reserved word, so change occurrences to "finalize".
2014-10-09 10:01:36 -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
Samuel Fredrickson 95b9cf39c9 "final" is now a reserved word, so change occurrences to "finalize". 2014-10-09 01:05:41 -07: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 6f399239d8 Minor doc fixes and feature mentions 2014-10-08 09:06:16 +03:00
Steven Fackler fec1c43a4a Revert "Fix #65: failing test case" 2014-10-07 23:18:20 -04:00
Steven Fackler 68b9bd700e Merge pull request #66 from jroesch/fix-failing-test
Fix #65: failing test case
2014-10-07 23:06:35 -04:00
Steven Fackler de3f1cf57f Merge pull request #67 from vhbit/membio-eof
Fixed incorrect EOF handling in MemBio, added error description
2014-10-07 11:05:53 -07: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
Steven Fackler ad08bf4ed9 Merge pull request #71 from vhbit/path-ization
Using `Path`s instead of plain strings
2014-10-07 09:50:05 -07:00
Valerii Hiora 9dd8ce9270 Potential fix for #68 2014-10-07 15:21:17 +03:00
Valerii Hiora 41287f3b14 Using `Path`s instead of plain strings
Refs #45
2014-10-07 14:54:35 +03:00
Jared Roesch 7e214fe8a8 Fix #65: failing test case 2014-10-06 01:53:56 -07: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
Steven Fackler 6231a39a41 Ignore error string text
cc #65
2014-10-05 13:47:20 -07:00
Jared Roesch a8cadc46ac Load crypto error strings 2014-10-05 02:50:33 -07:00
Jared Roesch 5713c42df7 Fix error messages 2014-10-05 02:43:37 -07:00
Jared Roesch 02c124a1fe Address CR comments and add a test 2014-10-05 02:43:37 -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 4d3f9e0520 Simpler setter for verify with data
There is no need in wrapping function in option as there is no
sense in providing data without function.
2014-10-04 06:47:27 +03: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 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
Steven Fackler 359043a7aa Merge pull request #53 from vhbit/cert-gen
Certificate/PKey generation & PEM export
2014-09-30 00:47:00 -04:00
Valerii Hiora 3f413e9354 Addressed review comments
- fixed invalid file permissions

- removed redundand mem::transmute

- removed outdated FIXME's

- removed redundand temporary variable

- removed macro_export for internal macros
2014-09-28 07:18:45 +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
Valerii Hiora 4fd169a1e5 Certificate/pkey generation & PEM export
Required quite a lot of refactoring
2014-09-26 10:39:08 +03:00
Steven Fackler fa53c79e48 Merge pull request #46 from vhbit/tls1-2-support
Enabling TLS1.2 support
2014-09-25 02:43:36 -04:00
Michael Gehring da125b3a95 Fix deprecation warnings 2014-09-23 20:27:37 +02:00
Valerii Hiora 4c1edcf4c8 TLS 1_1, 1_2, Ssl 2 is enabled by features 2014-09-23 18:29:43 +03:00
Valerii Hiora 03871d368e Enabling TLS1.2 support
Unfortunately OS X comes with 0.9.8 bundled. There is a way to
install a recent version through homebrew, however it is
extremely hard to make it link agains brewed version without
tricking link version
2014-09-23 17:49:08 +03:00
Valerii Hiora f508b7f067 Get certificate fingerprint 2014-09-20 03:54:38 +03:00
Steven Fackler efa1a719f5 Merge pull request #47 from vhbit/cert-key-auth
Allow to set cert/key pair
2014-09-19 15:32:55 -07:00
Valerii Hiora fb2665961c Fixed documentation string 2014-09-17 19:22:08 +03:00
Michael Gehring 6802216f79 Update for rust rfc 52 changes 2014-09-17 17:21:17 +02:00
Valerii Hiora ece8957e2f Allow to set cert/key pair 2014-09-17 09:41:10 +03:00
Mathijs van de Nes 7685a8349c Switch to the more sane RSA PUBKEY function
For differences, see:
http://openssl.6102.n7.nabble.com/difference-between-i2d-PUBKEY-and-i2d-PublicKey-td43869.html

This will break loading of *public* keys generated before this commit
2014-09-12 15:36:00 +02:00
Mathijs van de Nes 759feedb04 Switch PKey load/save functions to RSA specific 2014-09-12 15:30:09 +02:00
Steven Fackler e7e6ef5da2 Remove failing constructor wrappers 2014-09-05 21:52:44 -07:00
Steven Fackler 0a18409cdb Merge pull request #39 from andrew-d/andrew-support-tls-sni
Allow setting hostname to support TLS-SNI
2014-09-05 10:39:45 -07:00
Andrew Dunham b1346029e5 Make Ssl public, add new constructor to SslStream that takes an Ssl instance 2014-09-04 21:59:57 -07:00
Steven Fackler 4a823242ab Merge pull request #38 from andrew-d/andrew-get-compression
Allow getting the compression used in a connection
2014-09-04 19:07:10 -07:00
Andrew Dunham c4ede3d585 Allow getting the compression used in a connection 2014-09-04 19:02:05 -07:00
Steven Fackler f7433cd25e Merge pull request #37 from andrew-d/andrew-fix-lints
Fix lints for non snake-case functions
2014-09-04 18:59:38 -07:00
Andrew Dunham fc79815faf Allow setting hostname to support TLS-SNI 2014-09-04 18:21:43 -07:00
Andrew Dunham 1579173a10 Fix lints for non snake-case functions 2014-09-04 17:55:35 -07:00
Andrew Dunham 13b2027850 Derive things on SslMethod 2014-09-04 17:53:51 -07:00
Eunchong Yu 11c44d3b88 Fix the ambiguous integer literal error
This commit fixes this:

> src/crypto/symm.rs:95:25: 95:52 error: cannot determine a type for
> this expression: cannot determine the type of this integer; add a
> suffix to specify the type explicitly [E0101]
> src/crypto/symm.rs:95                 let v = if padding { 1 } else { 0 } as c_int;
2014-08-27 15:40:09 +09: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 39343df472 Derive thigs for error types 2014-08-10 13:06:21 -07:00
Jeremy Ruten 9f2a9c8524 Add new HashType RIPEMD160 2014-08-04 15:20:49 -06:00
Steven Fackler 203bdd076e Shift directory structure 2014-08-03 19:16:09 -07:00
Steven Fackler 53e11b08f5 Prepare rustcrypto to merge into rust-openssl 2013-12-28 17:09:18 -07:00
Erick Tryzelaar 85e6d1db12 update to rust 0.9-pre (a5fa1d9) 2013-12-27 22:02:38 -05:00
Erick Tryzelaar a9ce2a36d5 Switch over to rustpkg 2013-12-18 08:51:10 -08:00