Commit Graph

351 Commits

Author SHA1 Message Date
Steven Fackler 627f394d59 Revert "Revert "impl Clone for PKey and X509 by using their 'references' member"" 2016-01-31 20:38:36 +00:00
Steven Fackler 4e58fd10de Fix PKey RSA constructors
`set1` functions bump the object's refcount so we were previously
leaking the RSA object. Split the decode from PEM part out to a method
on RSA and use that in the PKey constructors.

Also make RSA a pointer and actually free it.
2016-01-30 13:12:06 -08:00
Steven Fackler 8ab4b54541 Revert "impl Clone for PKey and X509 by using their 'references' member" 2016-01-28 23:37:27 -08:00
Steven Fackler 274715fad0 Merge pull request #343 from jimmycuadra/ordered-extensions
Preserve X.509 extension insertion order
2016-01-28 22:37:48 -08:00
Steven Fackler 87f94c832f Bump openssl version to test with 2016-01-28 22:21:10 -08:00
Jimmy Cuadra 5e0830286e Preserve X.509 extension insertion order.
Ensures that extensions that are order-dependent are inserted in the
same order when calling out to OpenSSL during certificate signing.

Fixes #327.
2016-01-28 20:02:44 -08:00
Steven Fackler 7610804c9d Remove unwraps from rsa accessors 2016-01-22 19:10:22 -08:00
Steven Fackler 18e7e2455c Merge pull request #330 from esclear/master
Add a interface to RSA structs
2016-01-22 19:07:38 -08:00
Steven Fackler d25858cb57 Exclude test directory from package 2016-01-22 16:34:31 -08:00
Steven Fackler 2ece5b1039 Release v0.7.5 2016-01-22 15:57:21 -08:00
Steven Fackler b7d3357f37 Fix connect and accept error reporting
We were previously trying to create an error twice so the second
wouldn't be correct.
2016-01-22 15:34:31 -08:00
Daniel Albert 3ee2bf9310 Fix up RSA integration 2016-01-20 20:29:06 +00:00
Daniel Albert 74db7db560 Merge branch 'master' of https://github.com/sfackler/rust-openssl 2016-01-20 19:59:41 +00:00
Steven Fackler 95a83c477c Merge pull request #334 from jmesmon/ssl-context
ssl: fix refcounting of SslContext when set_ssl_context is used
2016-01-19 20:04:44 -08:00
Cody P Schafer 36a667be49 x509: impl Clone using references & CRYPTO_add() 2016-01-19 22:04:51 -05:00
Cody P Schafer 3c51f159a7 crypto/pkey: impl Clone for PKey using openssl's ref counting 2016-01-19 22:04:51 -05:00
Cody P Schafer d1825c7a86 openssl/ssl/context: test that we are refcounting correctly
Not a perfect test, on failure it _might_ exit with this output:

Process didn't exit successfully:
`/home/cody/g/rust-openssl/openssl/target/debug/openssl-8e712036e3aac4fe`
(signal: 11)

But unclear if we can do any better.
2016-01-18 16:40:14 -05:00
Cody P Schafer dacde211c3 ssl: fix refcounting of SslContext when set_ssl_context is used
Additionally impl Clone for SslContext to both allow us to use it &
allow external users to take advantage of SslContext's internal
refcount.

Maintain the existing signature for set_ssl_context(), but
add inline comments recommending changing it.

Fixes #333
2016-01-18 15:37:13 -05:00
Daniel Albert 1f45723b39 Fix incorrect unsafe declaration 2016-01-12 20:57:01 +00:00
Daniel Albert 7e8df9febd Adhere to rust conventions 2016-01-12 18:15:07 +00:00
Steven Fackler 86e2f81f43 Fix should_panic check 2016-01-11 23:45:12 -08:00
Steven Fackler 1865dd7374 Test nightly on travis 2016-01-11 22:38:06 -08:00
Steven Fackler fd6454f625 Add stream panic propagation behind a nightly feature gate 2016-01-11 22:36:58 -08:00
Daniel Albert 1238405637 Make the BigNum generation from a native pointer unsafe 2016-01-09 22:09:38 +00:00
Steven Fackler b32a50797c Merge pull request #328 from Cyberunner23/PemRSA
Add support for RSA PEM files.
2016-01-09 13:08:00 -08:00
Cyberunner23 c0b9a4c8ec Added tests for private_rsa_key_from_pem() and public_rsa_key_from_pem() 2016-01-09 14:36:01 -05:00
Will Tange 89e88727ff Mark PKey as `Send` and `Sync`
Provided that the locking function is set, the underlying `ffi::EVP_KEY`
type should be safe to use across threads.
2016-01-07 06:33:25 +01:00
Cyberunner23 1d3277fbee Added private_rsa_key_from_pem and public_rsa_key_from_pem. 2016-01-05 13:22:56 -05:00
Daniel Albert 578fac7e80 Add public interface to access BigNums from RSA keys 2016-01-01 19:46:03 +00:00
Daniel Albert 5e5d24ee25 Implement the possibility to create BigNums from their ffi counterpart 2016-01-01 19:36:29 +00:00
Daniel Albert 5813ca371d Add RSA structs 2016-01-01 19:33:49 +00:00
Steven Fackler 926c8167be Release v0.7.4 2015-12-18 22:41:46 -08:00
Steven Fackler 11129aa521 Rustfmt 2015-12-18 22:34:30 -08:00
Steven Fackler a31acdbb93 Fix deprecation location 2015-12-18 22:21:23 -08:00
Steven Fackler e85b49d375 Work around the worst of clone bogusness
SslStream::{clone,try_clone} are inherently broken since the Ssl object
shared by both streams is only going to be talking to one stream. Stuff
like hyper depends on try_clone, so we'll leave it here for now but
minimize the brokenness to "no worse than what it used to be like".
They'll be removed in 0.8.

cc #325
2015-12-18 21:20:47 -08:00
Steven Fackler 5fa46d428d Release v0.7.3 2015-12-17 21:25:48 -08:00
Steven Fackler e077ed0b4d Disable cross compilation for now 2015-12-17 21:13:44 -08:00
Steven Fackler 053c924d5a Fix nonblocking behavior
A new nonblocking socket may not have finished connecting yet, so reads
and writes can return ENOTCONNECTED which we should reinterpret into a
WantRead or WantWrite

Closes #323
2015-12-17 16:54:11 -08:00
Steven Fackler ccab187f5a Travis fixes 2015-12-16 23:51:19 -08:00
Steven Fackler 2cf65fc68d Stop using manifest-path for now
Some ssl tests depend on the working directory being openssl
2015-12-16 23:39:29 -08:00
Steven Fackler e7744874f4 Try cross compiling 2015-12-16 23:25:19 -08:00
Steven Fackler 2531ac9a45 Test overhaul + add an arm cross compile build
The ARM build doesn't do anything yet
2015-12-16 22:52:30 -08:00
Ondrej Perutka 02d2230a76 Fix regression of c_char type mismatches on ARM 2015-12-16 11:11:14 +01:00
Steven Fackler 157e6aa961 Rustfmt 2015-12-15 21:51:20 -08:00
Steven Fackler edfb318e0b Fix bounds on ssl_read and ssl_write 2015-12-15 20:06:07 -08:00
Steven Fackler 13f7cfd9d8 Release v0.7.2 2015-12-15 19:41:57 -08:00
Steven Fackler 6d559bf1da Cleanup SNI stuff 2015-12-15 19:39:24 -08:00
Steven Fackler 3a0e64dca5 Cleanup 2015-12-15 19:33:36 -08:00
Steven Fackler 167008d247 Merge pull request #320 from uasi/add-variations-of-pbkdf2
Add PBKDF2-HMAC-SHA256 and -SHA512 functions
2015-12-15 19:30:57 -08:00
Steven Fackler 514c5ec415 Merge pull request #309 from Geal/master
Add support for Server Name indication (SNI) on the server's side
2015-12-15 19:22:39 -08:00
Steven Fackler f2fae1f83f Document unused variant
No reason to hide it
2015-12-14 23:44:28 -08:00
Steven Fackler b8c8b770e3 Yet more AsRawSocket fixes 2015-12-12 18:01:21 -08:00
Steven Fackler ddedda1d03 More AsRawSocket fixes 2015-12-12 16:47:03 -08:00
Steven Fackler 63a45ac622 Fix AsRawSocket impls 2015-12-12 16:33:58 -08:00
Steven Fackler d6ce9afdf3 Have NonblockingSslStream delegate to SslStream 2015-12-12 15:46:17 -08:00
Steven Fackler 1df131ff81 Build out a new error type 2015-12-12 15:01:16 -08:00
Steven Fackler aa37dba0bc Make error handling more reliable 2015-12-10 21:58:22 -08:00
Tomoki Aonuma b6647cc610 Put pbkdf2_hmac_{256,512}() behind feature gate
PKCS5_PBKDF2_HMAC is not available with openssl-0.9.8 on os x
2015-12-10 23:00:49 +09:00
Tomoki Aonuma e9b8627af2 Add PBKDF2-HMAC-SHA256 and -SHA512 functions 2015-12-10 20:29:52 +09:00
Steven Fackler 91f8c542f7 Replace SslStream implementation! 2015-12-09 23:30:29 -08:00
Steven Fackler 8f56897043 Implement read and write 2015-12-09 22:02:02 -08:00
Steven Fackler 9ee6f1c578 IT LIVES 2015-12-09 21:43:02 -08:00
Steven Fackler 4d883d488e Custom BIO infrastructure 2015-12-08 23:02:38 -08:00
Steven Fackler 8cc69267fd Bump openssl version for travis 2015-12-07 19:03:29 -08:00
Geoffroy Couprie 6850c810d3 Increment SSL_CTX's reference count in Ssl::get_ssl_context()
Without this, whenever the returned SslContext is released,
the refcount of the underlying SSL_CTX will decrease and it
will be freed too soon
2015-12-03 12:26:55 +01:00
Ondrej Perutka f54af75eb7 Cast correctly c_char raw pointers (fixes build on ARM #314) 2015-11-30 21:06:54 +01:00
Steven Fackler fce7cf4d36 Release v0.7.1 2015-11-28 16:14:58 -08:00
Geoffroy Couprie 7835ea1c90 Make shims for SSL_CTX_ctrl and SSL_CTX_callback_ctrl macro wrappers 2015-11-25 08:10:36 +01:00
Geoffroy Couprie e486944320 fix memory management 2015-11-25 07:51:22 +01:00
Geoffroy Couprie 667e3f44b9 Avoid freeing the SSL object when Ssl is dropped 2015-11-24 17:15:52 +01:00
Geoffroy Couprie dba3a0ced2 implement get/set ssl context 2015-11-24 17:11:00 +01:00
Geoffroy Couprie cb4263f91e test SNI support 2015-11-24 17:11:00 +01:00
Steven Fackler 6bb3d8f1b5 Implement try_clone for MaybeSslStream
Closes #308
2015-11-20 21:33:36 -08:00
Alex Gaynor 38b3b4a11e Fixed a typo in a comment. 2015-11-19 19:52:26 -05:00
Overmind JIANG 3c6c4a7b3d Fix a leak when using `EVP_PKEY_get1_RSA`.
`EVP_PKEY_get1_RSA` returns a RSA structure with its reference count
increased by 1 and therefore we need to call `RSA_free` after finishing
using that value.
2015-11-18 11:36:34 +08:00
Steven Fackler 82547f53d7 Release v0.7.0 2015-11-16 21:10:50 -08:00
Steven Fackler 1bc96a5b3d Remove deprecated X509 methods 2015-11-16 20:56:02 -08:00
Steven Fackler f36f610d07 Move HMAC_CTX_copy to sys-extras 2015-11-16 20:16:01 -08:00
Steven Fackler a8a10e64ad Split stuff requiring a shim out to a separate crate 2015-11-16 20:16:01 -08:00
Steven Fackler 8139fadbff Bump ws2_32-sys version 2015-11-16 20:16:01 -08:00
Steven Fackler 309b6d9f46 Switch to libc 0.2 2015-11-16 20:16:01 -08:00
Steven Fackler 03e4908c13 Move SSL methods to Ssl object, add getter 2015-11-16 20:16:01 -08:00
Steven Fackler fae44250f6 Fix feature gated sslv3 2015-11-16 20:16:01 -08:00
Steven Fackler be2cbabdb7 Revert "Revert "Merge pull request #280 from ltratt/libressl_build""
This reverts commit ae3d0e36d7.
2015-11-16 20:16:01 -08:00
Steven Fackler b0cb0f7c40 Revert "Use AsRef for backwards compatibility with passing IV as Vec"
This reverts commit d2d20a8377.
2015-11-16 20:16:01 -08:00
Steven Fackler 65e1d08dd3 Merge pull request #300 from thommay/pkey_private_encrypt
Provide public_decrypt, private_encrypt for PKEY
2015-11-16 23:16:04 -05:00
Steven Fackler 776852ff2b Travis without sudo 2015-11-08 23:16:42 -08:00
Thom May 11e3b1b563 Provide public_decrypt, private_encrypt for PKEY 2015-10-28 18:15:55 +00:00
Steven Fackler 1e7ff1d8a8 Better debug impls 2015-10-26 21:43:52 -07:00
Alex Crichton c895b9f09f Get nonblocking tests working on OSX/Windows 2015-10-22 08:45:29 -07:00
Jamie Turner c37767df8f Nonblocking streams support. 2015-10-20 23:14:26 -07:00
Steven Fackler f318a2c84c Release v0.6.7 2015-10-14 22:25:35 -04:00
Steven Fackler ae3d0e36d7 Revert "Merge pull request #280 from ltratt/libressl_build"
This reverts commit aad933e507, reversing
changes made to 60ee731408.
2015-10-14 21:51:32 -04:00
Steven Fackler 8f5b67fed4 Merge pull request #286 from jedisct1/use_certificate_chain
Add set_certificate_chain_file()
2015-10-13 09:26:18 -04:00
Steven Fackler 81bc1edb61 Merge pull request #284 from bheart/cfb-mode
AES CFB-mode feature
2015-10-12 21:18:27 -04:00
Frank Denis a28253ee7d Add set_certificate_chain_file()
SSL_CTX_use_certificate_chain_file() is preferred over
SSL_CTX_use_certificate_file().

It allows the use of complete certificate chains instead of loading
only the first certificate in a PEM file.
2015-10-12 20:54:00 +02:00
Will Tange acbcb49414 AES CFB{1,8,128} mode support 2015-10-11 20:09:36 +02:00
Steven Fackler aad933e507 Merge pull request #280 from ltratt/libressl_build
Fix build on LibreSSL.
2015-10-10 21:56:20 -04:00
Steven Fackler 60ee731408 Merge pull request #277 from nixpulvis/read_public_pem
Add public key PEM read function.
2015-10-10 21:55:37 -04:00
Steven Fackler 677ed6ad1b Release v0.6.6 2015-10-05 22:34:32 +01:00