Commit Graph

3246 Commits

Author SHA1 Message Date
Rushil Mehra ef8146be7c Add tests for X509Ref::subject_key_id, X509Ref::authority_key_id, and X509NameRef::print_ex 2024-08-15 15:09:02 -07:00
Rushil Mehra 96981dd6c6 Expose X509NameRef::print_ex 2024-08-15 15:09:02 -07:00
Rushil Mehra fae2f7fbf1 Introduce `corresponds` macro from openssl-macros
Our rustdocs are miserably broken. We manually link to openssl docs in
most binding definitions, and openssl keeps changing their documentation
URL, so in order to fix everything I'd have to touch every single
binding definition in every single file. Instead, we should use the
`corresponds` macro from the openssl-macros crate which nicely adds a
link to the openssl documentation on our behalf. If the openssl
documentation url ever changes again in the future, a simple dependency
bump should solve the issue.
2024-08-15 15:09:02 -07:00
Rushil Mehra 2be6e100b6 Introduce ForeignTypeExt and ForeignTypeRefExt
`ForeignTypeExt` and `ForeignTypeRefExt` are inspired by
https://github.com/sfackler/rust-openssl/pull/1345, which make dealing
with FFI safer and more ergonomic. The new APIs (e.g.
from_const_ptr_opt`) also allow for gracefully handling instances where
the initial API call results in `NULL`. Instead of crashing the program,
`None` will be returned.
2024-08-15 15:09:02 -07:00
Rushil Mehra 1b5ae3251f Expose mTLS related APIs 2024-08-15 15:09:02 -07:00
0x676e67 9053b5d905
chore(boring-sys): Fix git apply patch on Windows (#261)
* chore(boring-sys): Fix git apply patch on Windows

* cargo fmt --all
2024-08-14 02:53:57 -07:00
0x676e67 9523ac82c9
Merge patch (#8) 2024-08-12 09:56:42 +08:00
Rushil Mehra 72b343def1
Release 4.9.1 (#259) 2024-08-04 12:40:55 -07:00
Rushil Mehra 89dc444fb3 Properly handle `Option<i32>` in `SslRef::set_curves` 2024-08-04 11:49:30 -07:00
Rushil Mehra cfc8f2db4f Actually Release 4.9.0 2024-08-02 02:14:46 -07:00
Rushil Mehra 291aaba3ea Release 4.9.0 2024-08-02 01:19:08 -07:00
Anthony Ramine 8ece78238c
Guard against empty strings given to select_next_proto (#252) 2024-08-02 09:26:03 +02:00
Rushil Mehra 5e304d9248 Document `SslCurve::nid()` 2024-08-01 23:18:30 -07:00
Rushil Mehra 0e33475b93 Add SslCurve::to_nid() and remove SslCurveId
We previously added an `SslCurveId` struct to house SSL_CURVE variants of
the internal NID constants, to allow `SslRef::curve()` to properly
instantiate `SslCurve` structures. This was done to ensure
`SslRef::set_curves()` did not break, as it expects the internal NID
constants instead of the public SSL_CURVE ones. In future versions of
boringssl, this problem is solved by virtue of the
SSL_CTX_set1_group_ids API. Since we don't have this yet, this commit
adds `SslCurve::nid()` so `SslRef::set_curves()` can convert the
SSL_CURVE constants to the NID representation internally
without breaking the public API.
2024-08-01 12:34:33 -07:00
Evan Rittenhouse 07bfd55a4d Fix x509_check_host return value
The [x509_check_host docs](https://www.openssl.org/docs/man1.1.1/man3/X509_check_host.html)
state:
> The functions return 1 for a successful match, 0 for a failed match
and -1 for an internal error: typically a memory allocation failure or
an ASN.1 decoding error.
All functions can also return -2 if the input is malformed. For example,
X509_check_host() returns -2 if the provided name contains embedded
NULs.

The current implementation will return `true` for 1, -1, and -2,
therefore returning an incorrect value if any of the above error cases
are hit.
2024-07-31 11:20:47 -07:00
Rushil Mehra 04abc99fb2 Fix clippy lints re: docs indentation + unused feature 2024-07-30 12:28:38 -07:00
Rushil Mehra 5dce4d331b Ignore clippy / rustfmt on autogenerated code 2024-07-30 12:28:38 -07:00
Rushil Mehra 6e9ba1cb96 Clean up legacy const_fn feature gates 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
Rushil Mehra 8786cda639 (ci): Fix macos crossbuild action by forcing brew link w python@3.11 2024-07-24 18:19:22 +01: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 6ca7b34fd0 Release 4.8.0 2024-07-05 11:55:30 -07:00
Ivan Nikulin d8e821bae9 Expose hmac_sha1 function 2024-06-28 10:51:46 +01:00
Rushil Mehra b7baacc047 Fix workflows file, pin mac os FIPS crossbuild runner to macos-13
The macos-13 runner uses intel chips and thus x86, so clang 12.0.0 is
easily available.
2024-06-26 16:13:58 +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
Isaiah Becker-Mayer b3eaacc33a Updates license field to valid SPDX format 2024-06-02 10:40:17 +01:00
Ivan Nikulin 7b97ff7bf5 Release 4.7.0 2024-05-31 18:18:56 +01:00
Ivan Nikulin d9f7e4daf6 Fix crosscompile 2024-05-31 09:38:29 +01:00
Ivan Nikulin 738d80a653 Expose hmac_sha256/512 functions 2024-05-31 09:38:29 +01:00
Anthony Ramine b8044706ad Release 4.6.0 2024-04-09 11:25:44 +02:00
Anthony Ramine 87ed6ab9bb Tweak cliff config to exclude merge and release commits from changelog 2024-04-09 11:18:05 +02:00
Eric Rosenberg 870ccd9084 builder 2024-04-07 17:03:52 -07:00
Eric Rosenberg 2cee0af3d2 HttpsLayerSettings 2024-04-07 17:03:52 -07:00
Eric Rosenberg 8db6134c75 bound session cache
When establishing new TLS sessions, servers may send multiple session
tickets (RFC8446 4.6.1). hyper-boring caches tickets without placing a
limit on how many tickets are cached. This leads to unbounded growth of
hyper-boring's cache and leaves clients vulnerable to malicious servers
who might send many session tickets to exhaust a client's available
memory.

This change bounds the cache to a default of 8 tickets.
2024-04-07 17:03:52 -07: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
Liu Dingming b96d2b88a4 Enable layout tests on iOS target 2024-03-24 11:11:05 -07:00
Anthony Ramine 30b33991e5 Fix clippy lints 2024-03-24 10:52:05 -07:00
Julien Rouviere 713558993a Add getters for client hello message 2024-03-22 20:44:55 +01:00
Isaiah Becker-Mayer ba85412229 Removes vestigial build script 2024-02-26 13:25:46 +01:00