Skip to content

Commit

Permalink
Implement optional Hyper 1 support in hyper-boring
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Jul 26, 2024
1 parent 8786cda commit cd19f06
Show file tree
Hide file tree
Showing 16 changed files with 917 additions and 377 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,5 @@ jobs:
name: Run `rpk,underscore-wildcards` tests
- run: cargo test --features pq-experimental,rpk,underscore-wildcards
name: Run `pq-experimental,rpk,underscore-wildcards` tests
- run: cargo test -p hyper-boring --features hyper1
name: Run hyper 1.0 tests for hyper-boring
2 changes: 0 additions & 2 deletions .rusty-hook.toml

This file was deleted.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ boring = { version = "4.8.0", path = "./boring" }
tokio-boring = { version = "4.8.0", path = "./tokio-boring" }

bindgen = { version = "0.68.1", default-features = false, features = ["runtime"] }
bytes = "1"
cmake = "0.1.18"
fs_extra = "1.3.0"
fslock = "0.2"
Expand All @@ -36,9 +37,14 @@ futures = "0.3"
tokio = "1"
anyhow = "1"
antidote = "1.0.0"
http = "0.2"
hyper = { version = "0.14", default-features = false }
http = "1"
http-body-util = "0.1.2"
http_old = { package = "http", version = "0.2" }
hyper = "1"
hyper-util = "0.1.6"
hyper_old = { package = "hyper", version = "0.14", default-features = false }
linked_hash_set = "0.1"
once_cell = "1.0"
tower = "0.4"
tower-layer = "0.3"
tower-service = "0.3"
3 changes: 3 additions & 0 deletions boring-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ bindgen = { workspace = true }
cmake = { workspace = true }
fs_extra = { workspace = true }
fslock = { workspace = true }

[lints.rust]
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(const_fn)'] }
6 changes: 5 additions & 1 deletion boring-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ use std::convert::TryInto;
use std::ffi::c_void;
use std::os::raw::{c_char, c_int, c_uint, c_ulong};

#[allow(clippy::useless_transmute, clippy::derive_partial_eq_without_eq)]
#[allow(
clippy::useless_transmute,
clippy::derive_partial_eq_without_eq,
dead_code
)]
mod generated {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
Expand Down
14 changes: 7 additions & 7 deletions boring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@
//! agreements:
//!
//! - `X25519Kyber768Draft00Old` is the same as `X25519Kyber768Draft00`, but under its old codepoint.
//! -`X25519Kyber512Draft00`. Similar to `X25519Kyber768Draft00`, but uses level 1 parameter set for
//! Kyber. Not recommended. It's useful to test whether the shorter ClientHello upsets fewer middle
//! boxes.
//! - `X25519Kyber512Draft00`. Similar to `X25519Kyber768Draft00`, but uses level 1 parameter set for
//! Kyber. Not recommended. It's useful to test whether the shorter ClientHello upsets fewer middle
//! boxes.
//! - `P256Kyber768Draft00`. Similar again to `X25519Kyber768Draft00`, but uses P256 as classical
//! part. It uses a non-standard codepoint. Not recommended.
//! part. It uses a non-standard codepoint. Not recommended.
//! - `IPDWing`. A preliminary version of
//! [X-Wing](https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/02/).
//! Similar to `X25519Kyber768Draft00Old`, but uses a newer (but not yet final) version of Kyber
//! called ML-KEM-ipd. Not recommended.
//! [X-Wing](https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/02/).
//! Similar to `X25519Kyber768Draft00Old`, but uses a newer (but not yet final) version of Kyber
//! called ML-KEM-ipd. Not recommended.
//!
//! Presently all these key agreements are deployed by Cloudflare, but we do not guarantee continued
//! support for them.
Expand Down
1 change: 0 additions & 1 deletion boring/src/ssl/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ fn refcount_ssl_context() {

#[test]
#[cfg_attr(target_os = "windows", ignore)]
#[cfg_attr(all(target_os = "macos", feature = "vendored"), ignore)]
fn default_verify_paths() {
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_default_verify_paths().unwrap();
Expand Down
19 changes: 15 additions & 4 deletions hyper-boring/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["runtime"]

runtime = ["hyper/runtime"]
runtime = ["hyper_old/runtime"]

# Use a FIPS-validated version of boringssl.
fips = ["tokio-boring/fips"]
Expand All @@ -28,19 +28,30 @@ fips-link-precompiled = ["tokio-boring/fips-link-precompiled"]
# Enables experimental post-quantum crypto (https://blog.cloudflare.com/post-quantum-for-all/)
pq-experimental = ["tokio-boring/pq-experimental"]

# Enable Hyper 1 support
hyper1 = ["dep:http", "dep:hyper", "dep:hyper-util", "dep:tower-service"]

[dependencies]
antidote = { workspace = true }
http = { workspace = true }
hyper = { workspace = true, features = ["client"] }
http = { workspace = true, optional = true }
http_old = { workspace = true }
hyper = { workspace = true, optional = true }
hyper-util = { workspace = true, optional = true, features = ["client", "client-legacy"] }
hyper_old = { workspace = true, features = ["client"] }
linked_hash_set = { workspace = true }
once_cell = { workspace = true }
boring = { workspace = true }
tokio = { workspace = true }
tokio-boring = { workspace = true }
tower-layer = { workspace = true }
tower-service = { workspace = true, optional = true }

[dev-dependencies]
hyper = { workspace = true, features = [ "full" ] }
bytes = { workspace = true }
http-body-util = { workspace = true }
hyper-util = { workspace = true, features = ["http1", "http2", "service", "tokio"] }
hyper = { workspace = true, features = ["server"] }
hyper_old = { workspace = true, features = [ "full" ] }
tokio = { workspace = true, features = [ "full" ] }
tower = { workspace = true, features = ["util"] }
futures = { workspace = true }
Expand Down
Loading

0 comments on commit cd19f06

Please sign in to comment.