Skip to content

Commit

Permalink
fips feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
toidiu committed May 3, 2024
1 parent 161df90 commit 5baaa57
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions quic/s2n-quic-tls-default/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ license = "Apache-2.0"
# Exclude corpus files when publishing to crates.io
exclude = ["corpus.tar.gz"]

[features]
# The [`?`](https://doc.rust-lang.org/cargo/reference/features.html?highlight=addative#dependency-features)
# syntax only enable `fips` for `s2n-quic-tls` if something else enables `s2n-quic-tls`. This
# preserves the selective compilation of the two tls crates.
fips = ["s2n-quic-tls?/fips"]

# Declare `s2n-quic-tls` as an optional dependency since the `?` syntax for features requires
# the dependency be optional.
#
# It is not possible to enable a feature flag based on target since Cargo currently doesn't
# support platform specific feature flags: https://github.com/rust-lang/cargo/issues/1197. In
# order to support the `?` syntax, we declare s2n-quic-tls as an optional dependency.
# `s2n-quic-tls` only gets enabled based on the target.
[dependencies]
s2n-quic-tls = { path = "../s2n-quic-tls", optional = true }

[target.'cfg(unix)'.dependencies]
s2n-quic-tls = { version = "=0.37.0", path = "../s2n-quic-tls" }

Expand Down
1 change: 1 addition & 0 deletions quic/s2n-quic-tls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license = "Apache-2.0"
exclude = ["corpus.tar.gz"]

[features]
fips = ["s2n-quic-crypto/fips"]
unstable_client_hello = []
unstable_private_key = []

Expand Down
5 changes: 4 additions & 1 deletion quic/s2n-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ default = [
"provider-address-token-default",
"provider-tls-default",
]
provider-crypto-fips = ["s2n-quic-crypto/fips"]
provider-crypto-fips = [
"s2n-quic-tls-default?/fips",
"s2n-quic-tls?/fips",
]
provider-address-token-default = [
"cuckoofilter",
"hash_hasher",
Expand Down

0 comments on commit 5baaa57

Please sign in to comment.