Commit Graph

151 Commits

Author SHA1 Message Date
Rushil Mehra 04abc99fb2 Fix clippy lints re: docs indentation + unused feature 2024-07-30 12:28:38 -07:00
Rushil Mehra 4fe43f85d1 Impl From for SslVersion 2024-07-30 12:28:38 -07:00
Julien Rouviere c7fd3249a7 Split SSL curve identifiers into a separate enum.
Some functions use the NID_* constants, and some use the SSL_CURVE_* ones.
Extract from the documentation:
> Where NIDs are unstable constants specific to OpenSSL and BoringSSL, group IDs are defined by the TLS protocol. Prefer the group ID representation if storing persistently, or exporting to another process or library.
2024-07-30 02:23:13 -07:00
Yury Yarashevich 31665926c9 Expose set_permute_extensions 2024-07-09 22:37:42 -07:00
Bas Westerbaan 4725a930d5 PQ: fix timing sidechannels and add IPDWing
Fix three potential timing sidechannels. These don't affect ephemeral
usage of Kyber as in TLS, but it's good practice to get rid of them anyway.

Also adds IPDWing, a preliminary version of X-Wing using the initial public
draft (IPD) of ML-KEM. Don't use it.
2024-07-08 19:47:43 +01:00
Ivan Nikulin d8e821bae9 Expose hmac_sha1 function 2024-06-28 10:51:46 +01:00
Rushil Mehra 924f452130 clippy: *::max_value() -> *::MAX 2024-06-26 16:13:58 +01:00
Rushil Mehra 884c91e770 Expose X509_check_host 2024-06-26 16:13:58 +01:00
Rushil Mehra ac208ede66 Expose SSL_add1_chain_cert 2024-06-26 16:13:58 +01:00
Rushil Mehra fb1283ef23 Expose SSL_{set|clear}_mode 2024-06-26 16:13:58 +01:00
Rushil Mehra 2997b07d06 Expose SSL_{get|set}_{max|min}_proto_version 2024-06-26 16:13:58 +01:00
Rushil Mehra 936d81b4ff Add APIs to expose client and server cipher lists
The client sent ciphers in the ClientHello are unparsed and thus require
the user to convert u16s into SslCipher instances. It could be worth
doing this parsing in the library itself to make things consistent and
always return a StackRef<SslCipher>.
2024-06-26 16:13:58 +01:00
Rushil Mehra 1879e9cff0 Expose SSL_CIPHER_is_aead and SSL_CIPHER_auth_nid 2024-06-26 16:13:58 +01:00
Rushil Mehra a88704076c Add NIDs for cipher authentication types 2024-06-26 16:13:58 +01:00
Rushil Mehra 760e99db46 Impl From for SslSignatureAlgorithm
This is useful for comparing raw u16s with the various sigalg constants.
2024-06-26 16:13:58 +01:00
Ivan Nikulin 738d80a653 Expose hmac_sha256/512 functions 2024-05-31 09:38:29 +01:00
Eric Rosenberg 3d9a5e3244
add get_curve (#226) 2024-03-26 14:48:53 +01:00
Rushil Mehra 167f5aece1 Remove kx-safe-default gate on SslCurve
While setting curves should be restricted by the kx-safe-default
feature, reading the curve is allowed.
2024-03-24 11:11:22 -07:00
Julien Rouviere 713558993a Add getters for client hello message 2024-03-22 20:44:55 +01:00
Kevin Guthrie bc42edc552 Introduce and use read_uninit and write_uninit duplicated from openssl-0.10.61 and tokio-openssl-0.6.4 2024-02-21 09:07:39 +01:00
Anthony Ramine 8ab1873d8b Introduce SslRef::set_private_key 2024-02-08 10:10:50 +01:00
Jonathan Hoyland e370083af5 Expose `set_compliance_policy` and `get_ciphers` 2024-01-17 17:57:47 +01:00
Evan Rittenhouse 0f5731b1d8 Expose SSL_get_error 2024-01-09 16:42:58 +01:00
Anthony Ramine 20f9991c18 Fix support for fips-link-precompiled
This feature expects a recent boringssl checkout (such as the one
found in boring-sys/deps/boringssl), so it should not be using
the same bindings as the fips feature, which are based on
boring-sys/deps/boringssl-fips, which is older and with a different
API.
2024-01-08 14:37:55 +01:00
Anthony Ramine dfd49f4fef Introduce X509Flags
For now it has a single associated constant, X509Flags::TRUSTED_FIRST.
2024-01-03 19:37:59 +01:00
Anthony Ramine 94457340ac Move x509 tests to a subdirectory 2024-01-03 19:37:59 +01:00
Anthony Ramine 1321ded678 Rearrange imports in x509 module 2024-01-03 19:37:59 +01:00
Anthony Ramine a8dea4a22c Introduce X509CheckFlags::UNDERSCORE_WILDCARDS 2024-01-02 15:37:36 +01:00
Anthony Ramine 72f4bf5724 Introduce set_custom_verify_callback and set_async_custom_verify_callback 2023-12-14 16:31:09 +01:00
Anthony Ramine 446b65550a Introduce tokio_boring::SslStreamBuilder 2023-12-14 16:05:09 +01:00
vuittont60 4d1b7fc816 Fix typos 2023-12-14 02:28:11 +01:00
Anthony Ramine 9cf03ae4c1 Move async callbacks infra to boring itself
This helps drive async callbacks from outside tokio-boring, such as in quiche.

Not a breaking change because every public item in tokio-boring is preserved as is.
2023-11-27 11:53:35 +01:00
Anthony Ramine c38ed71511 Use replace_ex_data more
Setting callbacks multiple times on a SslContextBuilder causes the previous callback
installed to leak, using replace_ex_data internally prevents that.

We also start using it in tokio-boring in with_ex_data_future, my understanding
is that the futures currently in use are never installed twice by that function
but that could change in the future with the addition of more async callbacks.
2023-11-23 11:07:17 +01:00
Anthony Ramine a32783374f Properly drop overwritten ex data
We introduce new methods replace_ex_data for both SslContextBuilder
and Ssl in case anyone is relying on the leaking behaviour of their
set_ex_data methods, but we do document that they leak now.
2023-11-16 19:47:16 +01:00
Anthony Ramine 8a26577b5d Allow returning GetSessionPendingError from get session callbacks 2023-10-25 10:25:55 +01:00
Anthony Ramine 1e2a4812d2 Test set_get_session_callback 2023-10-25 10:25:55 +01:00
Anthony Ramine 965fde7bae Test new session callback on server side 2023-10-25 10:25:55 +01:00
Anthony Ramine c48ed2ef62 Move session tests to their own module 2023-10-25 10:25:55 +01:00
Anthony Ramine 9a0bd94f99 Replace feature no-patches with BORING_BSSL{,_FIPS}_ASSUME_PATCHED
Feature no-patches is ever only useful when setting other env variables
BORING_BSSL{,_FIPS}{,_SOURCE}_PATH, and it has no impact on the APIs
provided by any of the boring crates, so we may as well make it an env
variable itself so downstream users have less features to propagate
across their own crate graph.
2023-10-23 15:06:23 +02:00
Anthony Ramine 7ddb106c20 Introduce a new set of env variables for FIPS-like builds
Builds using feature fips or fips-link-precompiled now
read variables prefixed by BORING_BSSL_FIPS_ instead of
BORING_BSSL_. This helps complex builds where build dependencies
also use boring, where we may not want to use fips there.

Without those separate variables, the boring build for the
build dependencies end up relying on e.g. BORING_BSSL_PATH,
causing errors if this path is a boring checkout intended for
fips builds, while the fips feature isn't enabled for
the build dependency.
2023-10-23 12:28:12 +02:00
Anthony Ramine bc095478fc Use prefix BORING_BSSL_ for all boringssl env variables
This means BORING_SSL_PRECOMPILED_BCM_O is now
BORING_BSSL_PRECOMPILED_BCM_O.

Prefix BORING_BSSL_ has been chosen because that's the
one that is used the most among all the variables
the build script uses.
2023-10-23 12:28:12 +02:00
Anthony Ramine 84a80c1916 Change X509VerifyResult to Result<(), X509VerifyError>
This commit separates X509VerifyResult::OK from the rest
of the codes that actually represent errors, using
a Result type as usual.
2023-10-11 14:42:59 +02:00
Anthony Ramine ad4239d59c Introduce bindings for all X509_V_ERR_* constants 2023-10-11 14:42:59 +02:00
sabjank ea5b399487 Add SHA224, SHA512, SHA512-256 tests 2023-10-11 09:53:30 +02:00
sabjank 2f73d3148a Expose SHA512-256 2023-10-11 09:53:30 +02:00
Anthony Ramine 6c681a409c Remove boring::fips::enable (fixes #150)
In boringssl, FIPS_mode_set is more or less useless, and
it doesn't even set an error stack at all on failure,
so there is no point using it instead of FIPS_mode.
2023-10-10 15:34:56 +01:00
Anthony Ramine 5f88374d7b Introduce SslSignatureAlgorithm::RSA_PKCS1_MD5_SHA1 2023-10-10 09:22:36 +01:00
Anthony Ramine 273509ccb0 Introduce Ssl::set_certificate 2023-10-10 09:22:36 +01:00
Anthony Ramine 907eaf079c Introduce async callbacks
We introduce tokio_boring::SslContextBuilderExt, with 2 methods:

* set_async_select_certificate_callback
* set_async_private_key_method
2023-10-10 09:22:36 +01:00
Anthony Ramine 0ffbdb030f Implement SslContextBuilder::set_private_key_method 2023-10-10 09:22:36 +01:00