Skip to content

Commit f304e3d

Browse files
committed
add DifferentPCR0 logging
this should be removed later
1 parent 2ffaf6c commit f304e3d

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/qos_core/src/protocol/services/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ mod test {
873873
&manifest_envelope,
874874
&att_doc
875875
),
876-
Err(ProtocolError::QosAttestError("DifferentPcr0".to_string()))
876+
Err(ProtocolError::QosAttestError("DifferentPcr0(\"8080808080808080808080808080808080808080808080808080808080808080\", \"0404040404040404040404040404040404040404040404040404040404040404\")".to_string()))
877877
);
878878
}
879879

src/qos_enclave/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ fn boot() -> String {
7373
let memory_mib = std::env::var("MEMORY_MIB").unwrap_or("1024".to_string());
7474
let cpu_count = std::env::var("CPU_COUNT").unwrap_or("2".to_string());
7575
let debug_mode = std::env::var("DEBUG").unwrap_or("false".to_string());
76-
let attach_console =
77-
std::env::var("ATTACH_CONSOLE").unwrap_or("false".to_string());
7876
let enclave_name =
7977
std::env::var("ENCLAVE_NAME").unwrap_or("nitro".to_string());
8078
let run_args = RunEnclavesArgs {
@@ -83,7 +81,7 @@ fn boot() -> String {
8381
memory_mib: memory_mib.parse::<u64>().unwrap(),
8482
cpu_ids: None,
8583
debug_mode: debug_mode.parse::<bool>().unwrap(),
86-
attach_console: attach_console.parse::<bool>().unwrap(), // TODO: I think we don't want this variable, remove once debug is done
84+
attach_console: false,
8785
cpu_count: Some(cpu_count.parse::<u32>().unwrap()),
8886
enclave_name: Some(enclave_name.clone()),
8987
};

src/qos_nsm/src/nitro/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum AttestError {
5555
/// The attestation doc does not contain a pcr0.
5656
MissingPcr0,
5757
/// The pcr3 in the attestation doc does not match.
58-
DifferentPcr0,
58+
DifferentPcr0(String, String), // TODO: DEBUG: ales - remove later
5959
/// The attestation doc does not have a pcr1.
6060
MissingPcr1,
6161
/// The attestation doc has a different pcr1.

src/qos_nsm/src/nitro/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ pub fn verify_attestation_doc_against_user_input(
8787
return Err(AttestError::UnexpectedAttestationDocNonce);
8888
}
8989

90-
if pcr0
91-
!= attestation_doc
92-
.pcrs
93-
.get(&0)
94-
.ok_or(AttestError::MissingPcr0)?
95-
.clone()
96-
.into_vec()
97-
{
98-
return Err(AttestError::DifferentPcr0);
90+
let doc_pcr0 = attestation_doc
91+
.pcrs
92+
.get(&0)
93+
.ok_or(AttestError::MissingPcr0)?
94+
.clone()
95+
.into_vec();
96+
if pcr0 != doc_pcr0 {
97+
return Err(AttestError::DifferentPcr0(
98+
qos_hex::encode(pcr0),
99+
qos_hex::encode(&doc_pcr0),
100+
));
99101
}
100102

101103
// pcr1 matches
@@ -707,7 +709,7 @@ mod test {
707709
.unwrap_err();
708710

709711
match err {
710-
AttestError::DifferentPcr0 => (),
712+
AttestError::DifferentPcr0(_, _) => (),
711713
_ => panic!(),
712714
}
713715
}

0 commit comments

Comments
 (0)