Commit Graph

108 Commits

Author SHA1 Message Date
Steven Fackler 6cdd2cf577 Speed up SslStream initialization a bit 2014-12-06 11:17:46 -08:00
Steven Fackler 2901c279ab Fix doc test and stop doc upload 2014-12-03 09:18:53 -08:00
Steven Fackler c3603b0db0 Make SslStream Cloneable
Closes #6
2014-11-29 11:06:16 -08:00
Steven Fackler 72ca8433f5 Add MaybeSslStream 2014-11-28 15:43:58 -08:00
Gleb Kozyrev 5fafe4fc60 Hasher: static contract checking, context reuse
- Store EVP_MD_CTX in a separate struct.
- Add with_context() constructor that uses an existing context.
- Switch to EVP_Digest(Init|Final)_ex for efficient context reuse.
- Make update() borrow &mut self.
- Make finalize() consume self. Add finalize_reuse() that also returns the
context which can be passed to from_context() constructor for reuse.

These changes let the type system prevent illegal calls to update() and
finalize().
2014-11-26 21:38:06 +02:00
Andor Uhlár 762331eb2b Sync is now part of the standard library 2014-11-26 16:04:10 +01:00
Steven Fackler a7a9ef7eaa Allow access to the underlying stream
The use case here is to allow methods like `set_read_timeout` to be
called.
2014-11-25 16:44:42 -08:00
Steven Fackler f71555e820 Fix deprecation warning 2014-11-24 13:09:16 -08:00
Cody P Schafer fd14cc77f3 ssl: add get_peer_certificate() 2014-11-24 15:48:08 -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
Valerii Hiora e9e60fe3f3 Fix negative serials on generated certs
required for compatibility with Go crypto
2014-11-21 18:34:10 +02:00
Gleb Kozyrev ef9e0b00bd Slice syntax fix 2014-11-20 19:53:42 +02:00
Gleb Kozyrev 50f11e533c Replace an expired cert with a new one to make tests happy 2014-11-20 19:53:31 +02:00
Steven Fackler 3e98880fe8 Merge pull request #54 from jmesmon/server
Server Support
2014-11-19 15:48:42 -05:00
Steven Fackler 9996f5874e Fix test build 2014-11-19 12:36:32 -08:00
Cody P Schafer b9e3ed50ad Baseline server support
Allows calling SSL_accept() instead of SSL_connect() when creating an
SslStream.
2014-11-19 15:23:31 -05:00
Steven Fackler af5533d936 Remove Zero and One impls 2014-11-17 16:29:12 -08:00
James Hurst f02d8c22ec Fixed compilation errors related to namedspaced enums 2014-11-17 19:16:51 -05:00
Steven Fackler 2569b39855 Impl Error for SslError 2014-11-16 22:21:45 -08:00
Steven Fackler 5258ce6ece Move AES XTS support to a feature 2014-11-16 14:01:24 -08:00
Corey Ford 287d402042 Add XTS-AES mode 2014-11-14 12:22:34 -08:00
Valerii Hiora b60d140d3d New build system 2014-11-13 15:17:00 +02:00
Steven Fackler 952fef7971 Merge pull request #89 from pyrho/aes-256-cbc-decrypt-test
Aes 256 cbc decrypt test
2014-11-10 12:20:00 -05:00
Richard Diamond c2717cd98c Force linkage of LibreSSL when targeting NaCl OSs. 2014-11-09 23:42:11 -06:00
Richard Diamond 019e47020a Support PNaCl/NaCl. 2014-11-09 23:07:59 -06:00
Cody P Schafer 3cbc518249 Hasher::write(): add basic test 2014-11-07 16:58:30 -05:00
Cody P Schafer b9f95b4ce4 crypto/hash: impl Writer for Hasher to allow use of Reader-Writer convenience functions 2014-11-07 16:56:18 -05:00
Cody P Schafer 89fb825e78 Update to work with change in TcpStream api 2014-11-07 13:47:42 -05:00
Steven Fackler 1e706b8ef4 Clean up some warnings 2014-10-31 19:14:30 -07: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
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