From 4165a15e61586d67d7edd255c142bca1c6ccddb4 Mon Sep 17 00:00:00 2001 From: sstone Date: Tue, 22 Nov 2022 14:44:57 +0100 Subject: [PATCH] enclave_build: fix argument parsing Fixed inconsistencies in argument names that make it impossible to generate a signed image. Fixed potential image corruption if the output image already exists by truncating it before writing to it. Bump version to 0.2.0. Signed-off-by: sstone --- Cargo.lock | 2 +- enclave_build/Cargo.toml | 2 +- enclave_build/src/main.rs | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0624f994e..706f906bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -303,7 +303,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enclave_build" -version = "0.1.0" +version = "0.2.0" dependencies = [ "aws-nitro-enclaves-image-format", "base64", diff --git a/enclave_build/Cargo.toml b/enclave_build/Cargo.toml index fae9fbe55..b26445169 100644 --- a/enclave_build/Cargo.toml +++ b/enclave_build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "enclave_build" -version = "0.1.0" +version = "0.2.0" authors = ["The AWS Nitro Enclaves Team "] edition = "2018" rust-version = "1.58" diff --git a/enclave_build/src/main.rs b/enclave_build/src/main.rs index 52af2265d..ba69d40c2 100644 --- a/enclave_build/src/main.rs +++ b/enclave_build/src/main.rs @@ -131,11 +131,9 @@ fn main() { let linuxkit_path = matches.value_of("linuxkit_path").unwrap(); let output = matches.value_of("output").unwrap(); let signing_certificate = matches - .value_of("signing_certificate") - .map(|val| val.to_string()); - let private_key = matches - .value_of("private_certificate") + .value_of("signing-certificate") .map(|val| val.to_string()); + let private_key = matches.value_of("private-key").map(|val| val.to_string()); let img_name = matches.value_of("image_name").map(|val| val.to_string()); let img_version = matches.value_of("image_version").map(|val| val.to_string()); let metadata = matches.value_of("metadata").map(|val| val.to_string()); @@ -144,6 +142,7 @@ fn main() { .read(true) .write(true) .create(true) + .truncate(true) .open(output) .expect("Failed to create output file");