Skip to content

Commit bf74459

Browse files
tpm: Add checks for the TPM v2 capabilities
1 parent 23fd8a2 commit bf74459

File tree

1 file changed

+23
-1
lines changed
  • uefi-test-runner/src/proto

1 file changed

+23
-1
lines changed

uefi-test-runner/src/proto/tcg.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,30 @@ pub fn test_tcg_v2(bt: &BootServices) {
173173
.open_protocol_exclusive::<v2::Tcg>(handle)
174174
.expect("failed to open TCG protocol");
175175

176+
let expected_banks =
177+
HashAlgorithm::SHA1 | HashAlgorithm::SHA256 | HashAlgorithm::SHA384 | HashAlgorithm::SHA512;
178+
179+
// Check basic TPM info.
176180
let capability = tcg.get_capability().expect("failed to call get_capability");
177-
info!("capability: {:?}", capability);
181+
assert_eq!(
182+
capability.structure_version,
183+
v2::Version { major: 1, minor: 1 }
184+
);
185+
assert_eq!(
186+
capability.protocol_version,
187+
v2::Version { major: 1, minor: 1 }
188+
);
189+
assert_eq!(capability.hash_algorithm_bitmap, expected_banks,);
190+
assert_eq!(
191+
capability.supported_event_logs,
192+
v2::EventLogFormat::TCG_1_2 | v2::EventLogFormat::TCG_2
193+
);
194+
assert!(capability.tpm_present());
195+
assert_eq!(capability.max_command_size, 4096);
196+
assert_eq!(capability.max_response_size, 4096);
197+
assert_eq!(capability.manufacturer_id, 0x4d4249);
198+
assert_eq!(capability.number_of_pcr_banks, 4);
199+
assert_eq!(capability.active_pcr_banks, expected_banks);
178200
}
179201

180202
pub fn test(bt: &BootServices) {

0 commit comments

Comments
 (0)