Commit Graph

1450 Commits

Author SHA1 Message Date
Steven Fackler 34c2b69118
Merge pull request #1180 from PrismaPhonic/master
Added clonability for sha hash state.  Useful for incremental hashing
2019-11-11 21:01:19 -05:00
Peter Farr 5991f425fa Added unit test to test that new cloning feature works as intended 2019-11-11 16:40:05 -08:00
Peter Farr 8fae1115a4 Changed all sha objects to be clonable per PR review suggestion. 2019-11-11 16:31:47 -08:00
Lukas Lihotzki 258c49a581 Add #[cfg(ossl110)] 2019-11-11 23:03:40 +01:00
Lukas Lihotzki 6d6429237d Add EC_GROUP_order_bits 2019-11-11 22:04:14 +01:00
Peter Farr 22f029064a Added clonability for sha hash state. Useful for incremental hashing 2019-11-11 11:09:49 -08:00
Brian Olsen 80e0dd03ba
Add method to create Asn1Time from time_t value
This is mostly just a rework of the earlier work done by @illegalprime
in his PR #673 and credit should go to him.
2019-10-13 23:10:16 +02:00
Brian Olsen 14a6a98ebf
Add diff method and comparisons to Asn1TimeRef
This implements a `diff` method on `Asn1TimeRef` using `ASN1_TIME_diff`
and uses this new method to implement combinations of `PartialEq` and
`PartialOrd` for `Asn1Time` and `Asn1TimeRef`.

This is mostly just a rework of the earlier work done by @illegalprime
in his PR #673 and credit should go to him.
2019-10-13 23:09:12 +02:00
Matt Vertescher b771738a3a Fix rustc warnings
- Use `..=` for inclusive ranges
- Add the `dyn` keyword for trait objects
- Switch from `ONCE_INIT` to `std::sync::Once::new()`
2019-10-08 08:35:35 -04:00
Steven Fackler bb3e0f474b Release openssl v0.10.25 2019-10-02 17:52:36 -07:00
Steven Fackler 02c3262be8 Release openssl-sys v0.9.50 2019-10-02 17:46:57 -07:00
Steven Fackler 7ce0835b74 Implement Clone for PKey 2019-10-01 18:45:10 -07:00
Steven Fackler 79d6d1ff2b
Merge pull request #1153 from sturmsebastian/eddsa
Added support for Ed25519 and Ed448 signatures
2019-09-08 20:49:41 -04:00
Sebastian Sturm cf9978bc0e Ensure Signer::len has documentation
Applied conditional compilation to internal helpers
2019-09-08 14:45:06 +02:00
Steven Fackler 9780fd6ba2
Merge pull request #1152 from thomaswhiteway/ecdsa_sig_set0_leak
Free r and s on ECDSA_SIG before overwriting them in ECDSA_SIG_set0
2019-09-06 09:20:33 -04:00
Thomas Whiteway 106d613805 Free r and s on ECDSA_SIG before overwriting them in ECDSA_SIG_set0 2019-09-06 10:52:15 +01:00
Sebastian Sturm bdede43afe Added support for Ed25519 and Ed448 signatures 2019-08-16 11:15:04 +02:00
Steven Fackler 8b2c370b86 Release openssl-sys v0.9.49 2019-08-15 22:19:46 -04:00
Steven Fackler dbe0672dc4 Release openssl v0.10.24 2019-07-19 07:45:32 -07:00
Steven Fackler 45c83e2772 Release openssl-sys v0.9.48 2019-07-19 07:30:11 -07:00
Steven Fackler 8d2e9e783d Hack around an unpatched OpenSSL issue
Why backport fixes to your LTS version? Seems like a lot of work, I
guess!

Closes #1133
2019-07-18 22:44:02 -04:00
Leo d598f156a7 Add AES-192 tests in CTR, CFB, and OFB modes 2019-07-07 11:07:20 +08:00
Leo 88c5bd81c7 Add AES-192 and OFB mode 2019-07-06 17:11:37 +08:00
Leo a02a962f7d Expose pem serialize function for DSA private key
Expose private_key_to_pem() & private_key_to_pem_passphrase() for DsaRef
2019-06-30 23:35:50 +08:00
Steven Fackler 850e93ee85 Don't depend on NO_SSL_MASK 2019-06-28 20:07:22 -07:00
Steven Fackler d3104955dd Minimize test duplication 2019-06-28 19:51:52 -07:00
Steven Fackler 1b3e0c8a15 Add mozilla v5 configurations
Closes #1134
2019-06-28 19:42:29 -07:00
Mike Belopuhov aef0517dcf Expose EC_POINT_dup as EcPoint::to_owned 2019-06-19 21:34:48 +02:00
Mike Belopuhov e8fc907da3 Expose EC_GROUP_get_cofactor as EcGroup::cofactor 2019-06-14 16:41:47 +02:00
Mike Belopuhov 390d71f1e5 Expose EC_GROUP_get0_generator as EcGroup::generator 2019-06-13 03:09:45 +02:00
Daniel Abramov fab6ea4727 Conditionally compile PEM functions for CMS
Apparently libressl does not quite support all CMS functions (well, at
least the bindings for CMS are currently compile-time guarded), so CI
checks inside the systest fail during the verification on libressl.
This is an attempt to fix it.
2019-06-12 16:48:16 +02:00
Daniel Abramov ed966a09ac Extend CMS unit tests (pem/der conversions) 2019-06-12 10:36:44 +02:00
Daniel Abramov 69ee79d435 Fix formatting in cms `to_der` implementation 2019-06-12 10:24:53 +02:00
Daniel Abramov 124c05d058 Add `CmsContentInfo` <-> PEM bindings 2019-06-12 10:23:48 +02:00
Leo d2e48e8d1f Add Debug impl for EcKey 2019-06-10 21:57:10 +08:00
Russell Greene 1c3f5b5f57 Address comments 2019-06-07 19:32:36 -06:00
Russell Greene b9341856b1 Add AES_wrap_key and AES_unwrap_key functionality 2019-06-05 21:03:34 -06:00
Simon Génier e3ac3f40bf Display for Error was incorrectly showing func instead of reason. 2019-05-30 15:06:14 -04:00
Steven Fackler 3b064fdb02 Release openssl v0.10.23 2019-05-18 12:13:39 -07:00
Steven Fackler b6d968b378 Release openssl-sys v0.9.47 2019-05-18 12:10:57 -07:00
Steven Fackler b39a712076 Fix handling of session callbacks
The session context is used for session callbacks rather than the normal
context, which breaks state lookup when the context has been swapped out
(e.g. for SNI). Since there isn't an accessor for the session context,
we just store an extra reference in the SSL's ex data.

Closes #1115
2019-05-18 10:27:40 -07:00
Andy Caldwell 2e37753790
Const-correctness 2019-05-13 19:11:15 +01:00
Andy Caldwell 41fea135ad
Allow passing by non-owned reference 2019-05-13 18:49:09 +01:00
Andy Caldwell 628c3b338a
Add SSL_CTX_add_client_CA on OpenSSL 2019-05-13 15:08:02 +01:00
Steven Fackler 6686092edf Release openssl v0.10.22 2019-05-08 18:46:43 -07:00
Steven Fackler a9b9f818a1
Merge pull request #1097 from vishwin/master
Support LibreSSL 2.9.1
2019-05-08 18:40:18 -07:00
Steven Fackler 801a236413 Ignore SRTP tests on libressl 2.9.1
SRTP is broken in that release!
2019-05-08 18:19:42 -07:00
Steven Fackler d2b169dae6 Fix doc link bugs 2019-05-03 07:32:05 -07:00
Steven Fackler 3331908a1d Release openssl v0.10.21 2019-04-30 21:59:02 -07:00
Nathaniel McCallum 7ad3208937 Fix output size check for stream ciphers
The previous output size check presumed a block cipher. Therefore, it
enforced an unnecessary extra byte in the case of stream ciphers. This
patch ensures that our size checks don't force the caller to
overallocate for stream ciphers.
2019-04-29 17:45:12 -04:00
Steven Fackler 4121ac34cb Fix deprecation warnings in tests 2019-04-25 10:03:13 -07:00
Charlie Li d79090a00a Reconcile exdata and version functions between libraries/versions. 2019-04-24 23:15:56 -04:00
Charlie Li 98f91769e3 Add missing any() in the {,D}TLS_method usage logic. 2019-04-24 19:29:01 -04:00
Charlie Li f0b8a2e467 Support LibreSSL 2.9.1
LibreSSL 2.9.1 added generic DTLS methods.

While here, bump CircleCI.
2019-04-24 16:08:42 -04:00
Steven Fackler 2024379f17 Clean up seal/open a bit 2019-04-23 20:21:43 -07:00
Vojtěch Pejša f40a328d43 Remove unnecessary version req and clean up param names. 2019-04-18 10:47:50 +02:00
Vojtěch Pejša 1b5293a977 Address comments. 2019-04-17 20:11:14 +02:00
Vojtěch Pejša bbff79636f Remove nested groups in use. 2019-04-15 13:59:29 +02:00
Vojtěch Pejša 63c7bda0c2 Add minimum ossl version. 2019-04-15 13:41:54 +02:00
Vojtěch Pejša 08879ed512 Add EVP_Seal and EVP_Open 2019-04-15 00:54:49 +02:00
Steven Fackler 0b1c2a1048 Cleanup ssl tests 2019-03-20 19:34:50 -07:00
Steven Fackler 576de0eaa2 Release openssl v0.10.20 2019-03-20 10:45:10 -04:00
Nathaniel McCallum 702bc48b1c Expose EC_GROUP_get_curve_name()
This gives us the ability to get the Nid from an EcGroupRef.
2019-03-19 11:10:35 -04:00
Nathaniel McCallum d9cb5433b1 Expose EVP_MD_type()
This gives us the ability to get the Nid from a MessageDigest.
2019-03-19 11:10:35 -04:00
Steven Fackler c3e2604702 Implement Eq for MessageDigest
Closes #1081
2019-03-17 14:33:56 -04:00
Steven Fackler 2a028e59e4 Move CHANGELOG.md into openssl 2019-03-14 12:04:01 -07:00
Alexey Galakhov a0e5b31799 X.509: add verify methods 2019-03-11 22:35:43 +01:00
tgbit 546eb4d391 CMS: add encrypt, from_der 2019-03-02 00:33:52 +01:00
Steven Fackler 4436245ab8 Release openssl v0.10.19 2019-03-01 12:40:21 -08:00
Steven Fackler 0dd632456f Release openssl-sys v0.9.42 2019-03-01 12:38:18 -08:00
Steven Fackler 404670691c Use into for infallible conversions 2019-03-01 12:36:01 -08:00
Steven Fackler 404b7f1790 Add session cache size accessors 2019-03-01 10:07:51 -08:00
Steven Fackler a16482f972 Add session info accessors 2019-02-28 22:08:48 -08:00
Steven Fackler 913267e68a Add SslCtx::{add,remove}_session 2019-02-28 19:48:10 -08:00
Edouard Oger 55fee497bb Implement Clone for Dsa 2019-02-28 14:10:49 -05:00
Steven Fackler e088d1d856 Release openssl v0.10.18 2019-02-22 12:34:11 -07:00
Steven Fackler 58ccea26ad Fix cipher_name return value 2019-02-22 12:33:41 -07:00
Steven Fackler 28c0af386f Release openssl v0.10.17 2019-02-22 10:51:35 -07:00
Steven Fackler 4c6af10cbd Release openssl-sys v0.9.41 2019-02-22 10:50:16 -07:00
Steven Fackler 70afbb8393 Add standard ciphername support 2019-02-22 10:33:12 -07:00
Steven Fackler 7eee39f1ec Rustfmt 2019-02-22 10:14:15 -07:00
Ryuichi Okumura 899fc30e9b
Change from EVP_des_ede3_cfb to EVP_des_ede3_cfb64 2019-02-18 19:35:00 +09:00
Ryuichi Okumura 941a69a4d2
Add des_ede3_cfb symm cipher 2019-02-17 22:21:01 +09:00
Steven Fackler 3a170b655b Make Rsa::generate delegate to Rsa::generate_with_e 2019-01-30 09:16:12 -08:00
Steven Fackler e48901e20b
Merge pull request #1054 from Zolmeister/generate-with-e
add Rsa::generate_with_e(bits: u32, e: BigNum)
2019-01-29 18:50:33 -08:00
Zolmeister dd140f5167 add Rsa::generate_with_e(bits: u32, e: BigNum) 2019-01-29 12:00:47 -06:00
Steven Fackler 34755f8a6b ASN1_TIME_from_string_x509 was added in 1.1.1 2019-01-27 13:14:11 -08:00
Steven Fackler 691ce7ca2a Add Asn1Time::from_str and Asn1Time::from_str_x509
Closes #1051
2019-01-27 13:05:03 -08:00
Zolmeister e56e09b6a4 Add RsaRef::check_key 2019-01-18 21:03:04 -06:00
Jonas Schievink 6378eff9db Forward to BigNumRef::to_asn1_integer 2019-01-18 17:58:48 +01:00
Jonas Schievink 4ff5f4486f Add `Asn1Integer::from_bn` 2019-01-18 12:21:39 +01:00
Jonas Schievink b565a0c7eb Implement AsRef<str/[u8]> for OpensslString{Ref} 2019-01-17 14:19:36 +01:00
Steven Fackler 69aa335871 Drop data_encoding dev dependency 2019-01-04 20:50:00 -08:00
PSeitz 1c48c9c456
Update bn.rs 2019-01-04 11:54:36 +01:00
Steven Fackler 57e02abb50 Release openssl v0.10.16 2018-12-16 09:04:07 -08:00
Stacey Ell 800c232c09 Fix cargo dependency documentation
`feature` -> `features`
2018-11-24 13:29:10 -07:00
Steven Fackler 5c7fa43d87 Add bindings to RAND_keep_random_devices_open
Closes #1019
2018-11-22 09:32:50 -07:00
Sameer 38a4dccceb Add new SHAKE128/256 EVP message digest functions in OpenSSL 1.1.1, fixes #1017. 2018-11-21 15:46:03 -05:00
Sameer e0e0a96cb3 Add new SHA3 EVP message digest functions in OpenSSL 1.1.1 2018-11-21 15:31:50 -05:00
Steven Fackler b88778bc76 Release openssl v0.10.15 2018-10-22 09:03:28 -07:00
Steven Fackler 93c67e2f77 Implement DoubleEndedIterator for stack iters 2018-10-22 08:49:24 -07:00
Steven Fackler e2783971ea Release openssl v0.10.14 2018-10-18 20:16:55 -07:00
Steven Fackler 3aecfe5655 Release openssl-sys v0.9.39 2018-10-18 20:11:35 -07:00
Steven Fackler 4256cfbf19 Fix some accidentally-public functions 2018-10-18 11:37:36 -07:00
Steven Fackler 3013d2e93f Release openssl v0.10.13 2018-10-14 16:10:22 -07:00
Steven Fackler d3bb880866 Release openssl-sys 0.9.37 2018-10-14 16:09:17 -07:00
Steven Fackler d52be16cc4
Merge pull request #1005 from samscott89/add-pkcs7-support
Add PKCS7 support
2018-10-10 22:18:46 -07:00
Steven Fackler 04ada473d1 Cleanup 2018-10-10 21:25:29 -07:00
Steven Fackler d2cc0eae2d Move README info into crate root docs
This is more discoverable in the modern Rust world!
2018-10-07 19:59:33 -07:00
Sam Scott 8ae761063c Address comments. 2018-10-02 22:53:03 -04:00
Sam Scott 2dd3736444 Refactor to match style and add documentation. 2018-10-02 17:25:18 -04:00
Jonatan Männchen cd1d1955d9 PKCS7 Support
(Rebased onto latest version)
2018-10-02 17:25:18 -04:00
Mike Belopuhov 18dfc9b6b2 Add support for encoding and decoding ECDSA signatures 2018-09-28 14:43:33 +02:00
Steven Fackler 5894cdfdc5
Fix get session callback
This could previously open up the possibility of a double-free!

Closes #996
2018-09-17 09:30:16 -07:00
Steven Fackler 22231d7547 Support the client hello callback 2018-09-15 13:29:18 -07:00
Steven Fackler a548913e44 Release openssl 0.10.12 2018-09-13 19:23:09 -07:00
李伟 348cb7391b
Fix typo
Fix typo in docs for openssl::rsa::Rsa::from_private_components
2018-09-13 12:39:57 -10:00
Steven Fackler 8c6bc774db Support libressl 2.8.0
Closes #988
2018-09-12 20:44:22 -07:00
Steven Fackler ea18d84de3 clean up example 2018-09-02 14:51:08 -07:00
Steven Fackler 947dfbd143 Small cleanup
Closes #981
2018-09-02 14:26:27 -07:00
Steven Fackler bc4e47a321 Fix lookup errors with SNI callback.
The job of an SNI callback is typically to swap out the context
associated with an SSL depending on the domain the client is trying to
talk to. Typically, only the callbacks associated with the current
context are used, but this is not the case for the SNI callback.

If SNI is run for a second time on a connection (i.e. in a
renegotiation) and the context was replaced with one that didn't itself
register an SNI callback, the old callback would run but wouldn't be
able to find its state in the context's ex data. To work around this, we
pass the pointer to the callback data directly to the callback to make
sure it's always available. It still lives in ex data to handle the
lifetime management.

Closes #979
2018-08-31 20:23:55 -07:00
Steven Fackler 2df87cfd59 Fix doc reference 2018-08-19 20:19:10 -07:00
Steven Fackler ef7721092d SRTP cleanup 2018-08-19 18:50:11 -07:00
Aron Wieck 59c578cf04 Add methods for DTLS/SRTP key handshake 2018-08-14 16:04:33 +02:00
Steven Fackler 1396143c66 Add get_shutdown and set_shutdown 2018-08-08 13:19:55 -07:00
Steven Fackler ef69870ea2 Release openssl 0.10.11 2018-08-04 10:12:12 -07:00
Alex Crichton 71ee9439ca Support builds of OpenSSL from vendored source (take 2)
This is a revival of #684 to see if I can help push it across the finish line!

Closes #580
2018-07-30 15:15:24 -07:00
Steven Fackler 415f399b2c Fix tests when built with no-ec2m
The other curve identifier isn't valid, at least in some contexts so
just ignore the test in those cases.

Closes #964
2018-07-29 09:48:03 -07:00
Steven Fackler ee5215bd31 SslSessionRef methods return static strings
Closes #961
2018-07-19 20:22:57 -07:00
Josh Abraham a964d05d4a Fix spelling in symm docs 2018-07-14 11:54:26 -10:00
Steven Fackler 1392b006e2
Merge pull request #937 from marcoh00/iterable-x509names
X509NameRef: Provide an iterator over all entries
2018-07-07 20:20:45 -07:00
Steven Fackler 6422ffb1b2 Clean up IGE example
Closes #955
2018-07-04 23:15:33 -07:00
Steven Fackler 07c49e517e
Only grab the name entry count when needed 2018-06-26 22:31:10 -07:00
Steven Fackler 4c1891cc10
Merge pull request #950 from WanzenBug/master
Add access to private/public components of DSA key pairs.
2018-06-23 23:53:09 -04:00
Moritz Wanzenböck 339d09fbf3 Simplify DSA from private components 2018-06-23 18:16:32 +02:00
Stefan Tatschner 321c076ab3
Fix build with openssl 1.1.1 and no-psk
I used this as build flags for openssl 1.1.1:

```
/usr/bin/perl ./Configure linux-x86_64 no-shared no-zlib no-psk no-srp no-weak-ssl-ciphers no-idea
```

rust-openssl crashed with this error:

```
   Compiling openssl v0.10.10                                                                                                                                                                                      
error[E0433]: failed to resolve. Use of undeclared type or module `CStr`                                                                                                                                           
   --> /home/stefan/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.10/src/ssl/callbacks.rs:386:16                                                                                                    
    |                                                                                                                                                                                                              
386 |     let line = CStr::from_ptr(line).to_bytes();                                                                                                                                                              
    |                ^^^^ Use of undeclared type or module `CStr`                                                                                                                                                  
                                                                                                                                                                                                                   
error[E0412]: cannot find type `c_char` in this scope                                                                                                                                                              
   --> /home/stefan/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.10/src/ssl/callbacks.rs:377:75                                                                                                    
    |                                                                                                                                                                                                              
377 | pub unsafe extern "C" fn raw_keylog<F>(ssl: *const ffi::SSL, line: *const c_char)                                                                                                                            
    |                                                                           ^^^^^^ did you mean `c_uchar`?                                                                                                     
help: possible candidates are found in other modules, you can import them into scope                                                                                                                               
    |                                                                                                                                                                                                              
1   | use libc::c_char;                                                                                                                                                                                            
    |                                                                                                                                                                                                              
1   | use std::os::raw::c_char;                                                                                                                                                                                    
    |                                                                                                                                                                                                              
                                                                                                                                                                                                                   
error: aborting due to 2 previous errors                                                                                                                                                                           
                                                                                                                                                                                                                   
Some errors occurred: E0412, E0433.                                                                                                                                                                                
For more information about an error, try `rustc --explain E0412`.                                                                                                                                                  
error: Could not compile `openssl`.                                                                                                                                                                                
warning: build failed, waiting for other jobs to finish... 
```

this patch fixes the problem
2018-06-21 22:19:29 +02:00
Moritz Wanzenböck c624427e31 Fix fallback implementation of DSA utility methods 2018-06-18 20:32:34 +02:00
Moritz Wanzenböck 0390aba73b Add tests for DSA key pairs 2018-06-18 18:12:34 +02:00
Moritz Wanzenböck 4994e75d2c Add Dsa::from_(private|public)_components
Add 2 methods to create a DSA key pair from its raw components.
2018-06-18 18:10:02 +02:00
Moritz Wanzenböck 52c942f4b3 Add methods to access private and public part of DSA keys 2018-06-18 11:39:15 +02:00
Steven Fackler 6440ee04ef
Merge pull request #943 from lolzballs/master
Add wrapper for SSL_CTX_set_psk_server_callback
2018-06-17 15:47:00 -07:00
Benjamin Cheng bf86580bec
Disable TLSv1.3 for psk_ciphers test 2018-06-17 17:00:22 -04:00
Steven Fackler 115cb730b0 Switch to accessors in libressl where possible
Some accessors are mysteriously still macros so we can't make everything
opaque yet, unfortunately.

cc #909
2018-06-09 21:49:36 -07:00
Steven Fackler 6834b97ff4 Release openssl v0.10.10 2018-06-06 13:37:25 -07:00
Steven Fackler d82a49bee2 Release openssl-sys 0.9.33 2018-06-06 13:36:24 -07:00
Steven Fackler cdc90c7e9d Add SslRef::set_alpn_protos 2018-06-04 20:19:27 -07:00
Marco Huenseler 14b5439347 Rename X509NameRef::all_entries and refactor end-of-iterator checks 2018-06-03 15:38:46 +02:00
Marco Huenseler f5e6d57c47 Provide an Asn1Object getter method for X509NameEntryRef 2018-06-03 15:38:46 +02:00
Marco Huenseler 2afdc16fc9 Make X509NameRef provide an iterator over all X509NameEntries 2018-06-03 15:38:46 +02:00
Steven Fackler 0745d66927 Update to 1.1.1-pre7
The initial session ticket is now sent as part of SSL_accept, so some
tests need to write a single byte through the stream to make sure that
both ends have fully completed to avoid test flakes.

TLSv1.3 cipher suite control has been extracted from the normal cipher
list into a separate method: SslContextBuilder::set_ciphersuites.
2018-06-02 13:58:56 -07:00