Skip to content

Commit

Permalink
Addressing PR feedback: Iteration 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mhatrevi committed Nov 13, 2024
1 parent 0ba7364 commit e56b07f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ use sha2::{Digest, Sha384};
use zerocopy::AsBytes;
use zerocopy::FromBytes;

pub const image_digest1: [u8; 48] = [
0x38, 0xB0, 0x60, 0xA7, 0x51, 0xAC, 0x96, 0x38, 0x4C, 0xD9, 0x32, 0x7E, 0xB1, 0xB1, 0xE3,
0x6A, 0x21, 0xFD, 0xB7, 0x11, 0x14, 0xBE, 0x07, 0x43, 0x4C, 0x0C, 0xC7, 0xBF, 0x63, 0xF6,
0xE1, 0xDA, 0x27, 0x4E, 0xDE, 0xBF, 0xE7, 0x6F, 0x65, 0xFB, 0xD5, 0x1A, 0xD2, 0xF1, 0x48,
0x98, 0xB9, 0x5B,
];

#[test]
fn test_authorize_and_stash_cmd_deny_authorization() {
let mut model = run_rt_test(RuntimeTestArgs::default());
Expand All @@ -26,13 +33,6 @@ fn test_authorize_and_stash_cmd_deny_authorization() {
m.soc_ifc().cptra_boot_status().read() == u32::from(RtBootStatus::RtReadyForCommands)
});

let image_digest1: [u8; 48] = [
0x38, 0xB0, 0x60, 0xA7, 0x51, 0xAC, 0x96, 0x38, 0x4C, 0xD9, 0x32, 0x7E, 0xB1, 0xB1, 0xE3,
0x6A, 0x21, 0xFD, 0xB7, 0x11, 0x14, 0xBE, 0x07, 0x43, 0x4C, 0x0C, 0xC7, 0xBF, 0x63, 0xF6,
0xE1, 0xDA, 0x27, 0x4E, 0xDE, 0xBF, 0xE7, 0x6F, 0x65, 0xFB, 0xD5, 0x1A, 0xD2, 0xF1, 0x48,
0x98, 0xB9, 0x5B,
];

let mut authorize_and_stash_cmd = MailboxReq::AuthorizeAndStash(AuthorizeAndStashReq {
hdr: MailboxReqHeader { chksum: 0 },
measurement: image_digest1,
Expand Down Expand Up @@ -115,13 +115,6 @@ fn test_authorize_and_stash_cmd_succes() {
.unwrap()
.expect("We should have received a response");

let image_digest1: [u8; 48] = [
0x38, 0xB0, 0x60, 0xA7, 0x51, 0xAC, 0x96, 0x38, 0x4C, 0xD9, 0x32, 0x7E, 0xB1, 0xB1, 0xE3,
0x6A, 0x21, 0xFD, 0xB7, 0x11, 0x14, 0xBE, 0x07, 0x43, 0x4C, 0x0C, 0xC7, 0xBF, 0x63, 0xF6,
0xE1, 0xDA, 0x27, 0x4E, 0xDE, 0xBF, 0xE7, 0x6F, 0x65, 0xFB, 0xD5, 0x1A, 0xD2, 0xF1, 0x48,
0x98, 0xB9, 0x5B,
];

let mut authorize_and_stash_cmd = MailboxReq::AuthorizeAndStash(AuthorizeAndStashReq {
hdr: MailboxReqHeader { chksum: 0 },
measurement: image_digest1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Licensed under the Apache-2.0 license

use crate::common::{assert_error, run_rt_test_lms, RuntimeTestArgs};
use crate::{common::{assert_error, run_rt_test_lms, RuntimeTestArgs}, test_authorize_and_stash::image_digest1};
use caliptra_api::SocManager;
use caliptra_auth_man_gen::{
AuthManifestGenerator, AuthManifestGeneratorConfig, AuthManifestGeneratorKeyConfig,
Expand Down Expand Up @@ -64,13 +64,6 @@ pub fn test_auth_manifest() -> AuthorizationManifest {
}),
});

let image_digest1: [u8; 48] = [
0x38, 0xB0, 0x60, 0xA7, 0x51, 0xAC, 0x96, 0x38, 0x4C, 0xD9, 0x32, 0x7E, 0xB1, 0xB1, 0xE3,
0x6A, 0x21, 0xFD, 0xB7, 0x11, 0x14, 0xBE, 0x07, 0x43, 0x4C, 0x0C, 0xC7, 0xBF, 0x63, 0xF6,
0xE1, 0xDA, 0x27, 0x4E, 0xDE, 0xBF, 0xE7, 0x6F, 0x65, 0xFB, 0xD5, 0x1A, 0xD2, 0xF1, 0x48,
0x98, 0xB9, 0x5B,
];

let image_digest2: [u8; 48] = [
0xCB, 0x00, 0x75, 0x3F, 0x45, 0xA3, 0x5E, 0x8B, 0xB5, 0xA0, 0x3D, 0x69, 0x9A, 0xC6, 0x50,
0x07, 0x27, 0x2C, 0x32, 0xAB, 0x0E, 0xDE, 0xD1, 0x63, 0x1A, 0x8B, 0x60, 0x5A, 0x43, 0xFF,
Expand Down

0 comments on commit e56b07f

Please sign in to comment.