Skip to content

Commit ba08468

Browse files
committed
Merge pull-request #565
2 parents 38db284 + e5c625d commit ba08468

File tree

16 files changed

+163
-127
lines changed

16 files changed

+163
-127
lines changed

src/Cargo.lock

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

src/integration/Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@ qos_hex = { path = "../qos_hex" }
1515
qos_p256 = { path = "../qos_p256", features = ["mock"] }
1616
qos_test_primitives = { path = "../qos_test_primitives" }
1717

18-
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"], default-features = false }
18+
tokio = { version = "1.43.1", features = ["macros", "rt-multi-thread"], default-features = false }
1919
borsh = { version = "1.0", features = ["std", "derive"] , default-features = false}
2020
nix = { version = "0.26", features = ["socket"], default-features = false }
2121
rustls = { version = "0.23.5" }
22-
webpki-roots = { version = "0.26.1" }
22+
webpki-roots = { version = "1.0.2" }
2323

2424
[dev-dependencies]
25-
qos_core = { path = "../qos_core", features = ["mock"], default-features = false }
26-
aws-nitro-enclaves-nsm-api = { version = "0.4", default-features = false }
27-
rand = "0.8"
25+
rand = "0.9"
2826
ureq = { version = "2.9", features = ["json"], default-features = false }
29-
serde = { version = "1", features = ["derive"] }

src/integration/tests/genesis.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use qos_crypto::{sha_512, shamir::shares_reconstruct};
1212
use qos_nsm::nitro::unsafe_attestation_doc_from_der;
1313
use qos_p256::{P256Pair, P256Public};
1414
use qos_test_primitives::{ChildWrapper, PathWrapper};
15-
use rand::{seq::SliceRandom, thread_rng};
15+
use rand::{seq::SliceRandom, rng};
1616

1717
const DR_KEY_PUBLIC_PATH: &str = "./mock/mock_p256_dr.pub";
1818
const DR_KEY_PRIVATE_PATH: &str = "./mock/mock_p256_dr.secret.keep";
@@ -197,7 +197,7 @@ async fn genesis_e2e() {
197197
.collect();
198198

199199
// Try recovering from a random permutation
200-
decrypted_shares.shuffle(&mut thread_rng());
200+
decrypted_shares.shuffle(&mut rng());
201201
let master_secret: [u8; qos_p256::MASTER_SEED_LEN] =
202202
shares_reconstruct(&decrypted_shares[0..threshold])
203203
.unwrap()

src/qos_client/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ ureq = { version = "2.9", default-features = false }
1616
aws-nitro-enclaves-nsm-api = { version = "0.4", default-features = false }
1717
borsh = { version = "1.0", features = ["std", "derive"] , default-features = false}
1818
p256 = { version = "0.12.0", default-features = false }
19-
rand_core = { version = "0.6", default-features = false }
19+
rand_core = { version = "0.9", features = ["os_rng"], default-features = false }
2020
zeroize = { version = "1.6", default-features = false }
2121
rpassword = { version = "7", default-features = false }
2222
serde_json = { version = "1" }
2323

2424
x509 = { version = "0.2", default-features = false, optional = true }
25-
yubikey = { version = "*", features = ["untested"], default-features = false, optional = true }
25+
# As of 7/2025, upgrading this to 0.8.0 is blocked due to dependency conflicts
26+
yubikey = { version = "0.7", features = ["untested"], default-features = false, optional = true }
2627

2728
[dev-dependencies]
2829
# We need mock enabled to grab things related to the mock NSM.

src/qos_client/src/yubikey.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use p256::{
77
SecretKey,
88
};
99
use qos_p256::encrypt::Envelope;
10-
use rand_core::{OsRng, RngCore};
10+
use rand_core::{OsRng, TryRngCore};
1111
use x509::RelativeDistinguishedName;
1212
use yubikey::{
1313
certificate::{Certificate, PublicKeyInfo},
@@ -70,6 +70,9 @@ pub enum YubiKeyError {
7070
/// Generate a signed certificate with a p256 key for the given `slot`.
7171
///
7272
/// Returns the public key as an uncompressed encoded point.
73+
///
74+
/// # Panics
75+
/// Panics if the `OsRng` is unable to provide data, which shouldn't happen in normal operation.
7376
pub fn generate_signed_certificate(
7477
yubikey: &mut YubiKey,
7578
slot: SlotId,
@@ -95,7 +98,9 @@ pub fn generate_signed_certificate(
9598

9699
// Create a random serial number
97100
let mut serial = [0u8; 20];
98-
OsRng.fill_bytes(&mut serial);
101+
OsRng.try_fill_bytes(&mut serial).expect(
102+
"The OsRng was unable to provide data, which should never happen",
103+
);
99104

100105
// Don't add any extensions
101106
let extensions: &[x509::Extension<'_, &[u64]>] = &[];
@@ -117,6 +122,9 @@ pub fn generate_signed_certificate(
117122

118123
/// Import the given `key_data` onto the `yubikey` and create a signed
119124
/// certificate for the key.
125+
///
126+
/// # Panics
127+
/// Panics if the `OsRng` is unable to provide data, which shouldn't happen in normal operation.
120128
pub fn import_key_and_generate_signed_certificate(
121129
yubikey: &mut YubiKey,
122130
key_data: &[u8],
@@ -156,7 +164,9 @@ pub fn import_key_and_generate_signed_certificate(
156164

157165
// Create a random serial number
158166
let mut serial = [0u8; 20];
159-
OsRng.fill_bytes(&mut serial);
167+
OsRng.try_fill_bytes(&mut serial).expect(
168+
"The OsRng was unable to provide data, which should never happen",
169+
);
160170

161171
// Don't add any extensions
162172
let extensions: &[x509::Extension<'_, &[u64]>] = &[];

src/qos_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ qos_test_primitives = { path = "../qos_test_primitives" }
2626
qos_p256 = { path = "../qos_p256", features = ["mock"] }
2727
qos_nsm = { path = "../qos_nsm", features = ["mock"], default-features = false }
2828
rustls = { version = "0.23.5" }
29-
webpki-roots = { version = "0.26.1" }
29+
webpki-roots = { version = "1.0.2" }
3030

3131
[features]
3232
# Support for VSOCK

src/qos_crypto/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ version = "0.1.0"
44
edition = "2021"
55
publish = false
66

7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8-
97
[dependencies]
108
sha2 = { version = "0.10", default-features = false }
11-
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
9+
thiserror = { version = "2.0.12", features = ["std"], default-features = false }
1210
vsss-rs = { version = "5.1", default-features = false, features = ["std", "zeroize"] }
11+
# dependent on rand_core version used in vsss-rs
12+
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
13+
# dependent on rand_core version used in vsss-rs
1314
rand_core = { version = "0.6.4", default-features = false }
14-
thiserror = "1.0.63"
1515

1616
[dev-dependencies]
1717
qos_hex = { path = "../qos_hex" }

src/qos_enclave/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ rust-version = "1.61"
77
publish = false
88

99
[dependencies]
10+
# newer versions 1.4.1 and 1.4.2 available
11+
# as of 7/2025, AWS doesn't have a recent crate version of aws-nitro-enclaves-cli published
12+
# directly use the git version as a workaround
1013
nitro-cli = { git = "https://github.com/aws/aws-nitro-enclaves-cli", version = "1.4.0" }
1114
libc = "0.2.172" # NOTE: nitro-cli requires ^0.2.161
1215

src/qos_hex/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
serde = {version = "1", optional = true, default-features = false }
8+
serde = { version = "1", optional = true, default-features = false }
99

1010
[features]
11-
serde =["dep:serde"]
11+
serde = ["dep:serde"]

src/qos_host/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ qos_hex = { path = "../qos_hex", features = ["serde"], default-features = false
1010

1111
# Third party
1212
axum = { version = "0.6.20", features = ["http1", "tokio", "json"], default-features = false }
13-
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"], default-features = false }
13+
tokio = { version = "1.43.1", features = ["macros", "rt-multi-thread"], default-features = false }
1414
borsh = { version = "1.0", features = ["std", "derive"] , default-features = false}
1515
serde_json = { version = "1" }
1616
serde = { version = "1", features = ["derive"], default-features = false }

0 commit comments

Comments
 (0)