Skip to content

Commit 4493aec

Browse files
varshaprasad96akram
authored andcommitted
fix(crypto): let library consumers select their backend
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
1 parent af02016 commit 4493aec

51 files changed

Lines changed: 4446 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/watch-github-actions/SKILL.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,11 @@ gh run rerun <run-id>
344344
```bash
345345
gh run rerun <run-id> --failed
346346
```
347+
348+
## Crypto backend independence
349+
350+
For failures in Branch Checks' crypto independence step, run
351+
`mise run rust:verify:library-crypto` from the checkout. It checks external library
352+
consumer graphs and TLS/JWT behavior separately from workspace tests, then checks
353+
executable backend defaults. Do not add AWS-LC to a shared library to make a test
354+
pass; standalone library tests select their backend in development dependencies.

‎.github/workflows/branch-checks.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ jobs:
342342
exit 1
343343
fi
344344
cargo test --locked -p openshell-crypto --no-default-features --test independent_backend
345+
mise run rust:verify:library-crypto
345346
346347
- name: Verify OpenSSL backend
347348
shell: nix develop .#crypto -c bash -euo pipefail {0}

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ license = "Apache-2.0"
1313
repository = "https://github.com/NVIDIA/OpenShell"
1414

1515
[workspace.dependencies]
16-
# Product backend selection. Consumer crates inherit this choice.
17-
openshell-crypto = { path = "crates/openshell-crypto", default-features = false, features = ["aws-lc"] }
16+
# Libraries inherit only the facade. Executable packages select their backend.
17+
openshell-crypto = { path = "crates/openshell-crypto", default-features = false }
1818
# Async runtime
1919
tokio = { version = "1.53.3", features = ["full"] }
2020

@@ -74,7 +74,7 @@ opentelemetry-proto = { version = "0.33", default-features = false, features = [
7474
opentelemetry = "0.33"
7575
opentelemetry_sdk = { version = "0.33", features = ["rt-tokio"] }
7676
opentelemetry-http = { version = "0.33", default-features = false }
77-
opentelemetry-otlp = { version = "0.33", default-features = false, features = ["grpc-tonic", "gzip-tonic", "tls-aws-lc", "tls-roots", "trace"] }
77+
opentelemetry-otlp = { version = "0.33", default-features = false, features = ["grpc-tonic", "gzip-tonic", "tls-provider-agnostic", "tls-roots", "trace"] }
7878
tracing-opentelemetry = { version = "0.34", default-features = false, features = ["tracing-log"] }
7979

8080
# Metrics

‎crates/openshell-binary-identity/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ openshell-crypto = { workspace = true }
1616

1717
[lints]
1818
workspace = true
19+
20+
[dev-dependencies]
21+
openshell-crypto = { workspace = true, features = ["aws-lc"] }

‎crates/openshell-bootstrap/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ tokio = { workspace = true }
2222
tracing = { workspace = true }
2323

2424
[dev-dependencies]
25+
openshell-crypto = { workspace = true, features = ["aws-lc"] }
2526
x509-parser = "0.16"
2627

2728
[lints]

‎crates/openshell-cli/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ name = "openshell"
1515
path = "src/main.rs"
1616

1717
[dependencies]
18-
openshell-crypto = { workspace = true }
18+
openshell-crypto = { workspace = true, features = ["aws-lc"] }
1919
openshell-bootstrap = { path = "../openshell-bootstrap" }
2020
openshell-core = { path = "../openshell-core", default-features = false }
2121
openshell-otel = { path = "../openshell-otel", default-features = false }

‎crates/openshell-core/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ tonic-prost-build = { workspace = true }
7171
protoc-bin-vendored = { workspace = true }
7272

7373
[dev-dependencies]
74+
openshell-crypto = { workspace = true, features = ["aws-lc"] }
7475
h2 = "0.4"
7576
rcgen = { workspace = true }
7677
tempfile = "3"

‎crates/openshell-core/src/grpc_client.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ fn configure_gateway_tls(
379379
ca_pem: Vec<u8>,
380380
server_name: Option<&str>,
381381
) -> Result<Endpoint> {
382+
openshell_crypto::tls::ensure_default_provider();
382383
let mut tls_config = ClientTlsConfig::new().ca_certificate(Certificate::from_pem(ca_pem));
383384
if let Some(server_name) = server_name.filter(|name| !name.is_empty()) {
384385
tls_config = tls_config.domain_name(server_name);

‎crates/openshell-core/src/lib.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
//! - Configuration management
99
//! - Common error types
1010
//! - Build version metadata
11+
//!
12+
//! # Cryptography
13+
//!
14+
//! This library does not select a crypto implementation. Add `openshell-crypto`
15+
//! with its default features for AWS-LC, or disable those defaults and install
16+
//! your own `CryptoContext` before constructing TLS/JWT clients or using crypto.
17+
//! Existing Rustls process providers are preserved by dependency-owned clients;
18+
//! selecting a context does not replace an already installed process provider.
1119
1220
pub mod activity;
1321
pub mod app_listener;

0 commit comments

Comments
 (0)