Skip to content

Commit 857c5a6

Browse files
committed
fix compilation warnings
1 parent 91ca067 commit 857c5a6

File tree

5 files changed

+39
-135
lines changed

5 files changed

+39
-135
lines changed

attestation-service/src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,16 @@ async fn verify_sgx_report(
355355

356356
// WARNING: the SGX-SDK only implements AES 128, so we must use it here
357357
// instead of AES 256
358-
let aes_key = aes_gcm::Key::<Aes128Gcm>::from_slice(&shared_secret[..16]);
359-
let cipher = Aes128Gcm::new(aes_key);
358+
let cipher = match Aes128Gcm::new_from_slice(&shared_secret[..16]) {
359+
Ok(cipher) => cipher,
360+
Err(e) => {
361+
eprintln!("error initializing AES 128 GCM cipher: {:?}", e);
362+
return (
363+
StatusCode::INTERNAL_SERVER_ERROR,
364+
Json(json!({ "error": "JWT encoding failed" })),
365+
);
366+
}
367+
};
360368

361369
let claims = JwtClaims {
362370
sub: "attested-client".to_string(),
@@ -385,9 +393,9 @@ async fn verify_sgx_report(
385393
// Encrypt the JWT
386394
let mut nonce_bytes = [0u8; 12];
387395
OsRng.fill_bytes(&mut nonce_bytes);
388-
let nonce = Nonce::from_slice(&nonce_bytes);
396+
let nonce = Nonce::from(nonce_bytes);
389397

390-
let ciphertext = match cipher.encrypt(nonce, jwt.as_bytes()) {
398+
let ciphertext = match cipher.encrypt(&nonce, jwt.as_bytes()) {
391399
Ok(ct) => ct,
392400
Err(_) => {
393401
return (

invrs/Cargo.lock

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

invrs/Cargo.toml

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

66
[dependencies]
7-
aes-gcm = "0.10"
8-
aes-gcm-siv = { version = "0.10", optional = true }
7+
aes-gcm = "0.10.3"
8+
aes-gcm-siv = { version = "0.11.1", optional = true }
99
anyhow = "^1.0.0"
1010
base64 = "^0.22"
1111
bytes = "1.4"
1212
chrono = "^0.4.38"
1313
clap = { version = "4.0", features = ["derive"] }
1414
csv = "^1.1"
15-
env_logger = "^0.10"
15+
env_logger = "0.11.8"
1616
futures = "^0.3"
1717
futures-util = "0.3"
1818
hex = "0.4.3"
@@ -21,13 +21,14 @@ log = "^0.4"
2121
minio = { git = "https://github.com/minio/minio-rs.git", rev = "b254b2f7aeaf18a1588a8800ff9b877b7885236e" }
2222
plotters = "^0.3.7"
2323
rabe = { git = "https://github.com/faasm/rabe.git", rev = "0dc7696a95eef44dd051e1d9c2e5c2c8c35211bf" }
24-
rand = "0.8.5"
24+
rand = "0.9.2"
2525
reqwest = "0.12.15"
2626
serde = { version = "^1.0", features = ["derive"] }
2727
serde_json = "^1.0"
2828
serde_yaml = "0.9"
2929
shellexpand = "^3.1"
3030
sha2 = "0.10"
3131
shell-words = "^1.1.0"
32+
subtle = "2.6.1"
3233
tokio = { version = "1", features = ["full"] }
3334
walkdir = "2"

invrs/src/tasks/dag.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::attestation_service;
22
use crate::tasks::s3::S3;
33
use aes_gcm::aead::{Aead, AeadCore, KeyInit, OsRng};
4-
use aes_gcm::{Aes256Gcm, Key};
4+
use aes_gcm::Aes256Gcm;
55
use rabe;
66
use serde::{Deserialize, Serialize};
77
use serde_yaml;
@@ -103,7 +103,7 @@ impl Dag {
103103

104104
// Encrypt it with the shared symmetric key, so that any TEE can use
105105
// the CP-ABE encryption/decryption context
106-
let cipher = Aes256Gcm::new(Key::<Aes256Gcm>::from_slice(&tee_sym_key));
106+
let cipher = Aes256Gcm::new_from_slice(&tee_sym_key)?;
107107
let ctx_nonce = Aes256Gcm::generate_nonce(&mut OsRng);
108108
let ctx_ct = cipher.encrypt(&ctx_nonce, serial_ctx).unwrap();
109109
let mut encrypted_ctx = ctx_nonce.to_vec();

invrs/src/tasks/docker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl Docker {
7777
.arg(format!("TLESS_VERSION={}", Env::get_version().unwrap()))
7878
// TODO: delete this build arg
7979
.arg("--build-arg")
80-
.arg(format!("TMP_VER={}", rand::thread_rng().gen_range(0..1000)))
80+
.arg(format!("TMP_VER={}", rand::rng().random_range(0..1000)))
8181
.arg(".");
8282

8383
if nocache {

0 commit comments

Comments
 (0)