Skip to content

Commit 373728e

Browse files
authored
[fw_info] Add more information about how firmware was verified (#3631)
This adds the following fields to `FwInfoResp`: * vendor_pub_key_hash * image_manifest_pqc_type * vendor_ecc384_pub_key_index * vendor_pqc_pub_key_index These will be used by MCU key revocation APIs to make sure it is safe to revoke a key.
1 parent bc661f7 commit 373728e

5 files changed

Lines changed: 85 additions & 22 deletions

File tree

api/src/mailbox.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,6 +1864,10 @@ pub struct FwInfoResp {
18641864
pub owner_pub_key_hash: [u32; 12],
18651865
pub authman_sha384_digest: [u32; 12],
18661866
pub most_recent_fw_error: u32,
1867+
pub vendor_pub_key_hash: [u32; 12],
1868+
pub image_manifest_pqc_type: u32,
1869+
pub vendor_ecc384_pub_key_index: u32,
1870+
pub vendor_pqc_pub_key_index: u32,
18671871
}
18681872

18691873
// CAPABILITIES

libcaliptra/inc/caliptra_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ struct caliptra_fw_info_resp
216216
uint32_t owner_pub_key_hash[12];
217217
uint32_t authman_sha384_digest[12];
218218
uint32_t most_recent_fw_error;
219+
uint32_t vendor_pub_key_hash[12];
220+
uint32_t image_manifest_pqc_type;
221+
uint32_t vendor_ecc384_pub_key_index;
222+
uint32_t vendor_pqc_pub_key_index;
219223
};
220224

221225
struct caliptra_dpe_tag_tci_req

runtime/README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,30 +1159,34 @@ Command Code: `0x494E_464F` ("INFO")
11591159

11601160
*Table: `FW_INFO` input arguments*
11611161

1162-
| **Name** | **Type** | **Description**
1163-
| -------- | -------- | ---------------
1164-
| chksum | u32 | Checksum over other input arguments, computed by the caller. Little endian.
1162+
| **Name** | **Type** | **Description** |
1163+
| -------- | -------- | --------------------------------------------------------------------------- |
1164+
| chksum | u32 | Checksum over other input arguments, computed by the caller. Little endian. |
11651165

11661166
*Table: `FW_INFO` output arguments*
11671167

1168-
| **Name** | **Type** | **Description**
1169-
| -------- | -------- | ---------------
1170-
| chksum | u32 | Checksum over other input arguments, computed by the caller. Little endian.
1171-
| fips\_status | u32 | Indicates if the command is FIPS approved or an error.
1172-
| pl0_pauser | u32 | PAUSER with PL0 privileges (from image header).
1173-
| firmware_svn | u32 | Firmware SVN.
1174-
| min_firmware_svn | u32 | Min Firmware SVN.
1175-
| cold_boot_fw_svn | u32 | Cold-boot Firmware SVN.
1176-
| attestation_disabled | u32 | State of attestation disable.
1177-
| rom_revision | u8[20] | Revision (Git commit ID) of ROM build.
1178-
| fmc_revision | u8[20] | Revision (Git commit ID) of FMC build.
1179-
| runtime_revision | u8[20] | Revision (Git commit ID) of runtime build.
1180-
| rom_sha256_digest | u32[8] | Digest of ROM binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields).
1181-
| fmc_sha384_digest | u32[12] | Digest of FMC binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields).
1182-
| runtime_sha384_digest | u32[12] | Digest of runtime binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields).
1183-
| owner_pub_key_hash | u32[12] | Hash of the owner public keys provided in the image bundle manifest. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields).
1184-
| authman_sha384_digest | u32[12] | Hash of the authorization manifest provided by SET_AUTH_MANIFEST. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields).
1185-
| most_recent_fw_error | u32 | Most recent FW non-fatal error (shows current non-fatal error if non-zero)
1168+
| **Name** | **Type** | **Description** |
1169+
| --------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
1170+
| chksum | u32 | Checksum over other input arguments, computed by the caller. Little endian. |
1171+
| fips\_status | u32 | Indicates if the command is FIPS approved or an error. |
1172+
| pl0_pauser | u32 | PAUSER with PL0 privileges (from image header). |
1173+
| firmware_svn | u32 | Firmware SVN. |
1174+
| min_firmware_svn | u32 | Min Firmware SVN. |
1175+
| cold_boot_fw_svn | u32 | Cold-boot Firmware SVN. |
1176+
| attestation_disabled | u32 | State of attestation disable. |
1177+
| rom_revision | u8[20] | Revision (Git commit ID) of ROM build. |
1178+
| fmc_revision | u8[20] | Revision (Git commit ID) of FMC build. |
1179+
| runtime_revision | u8[20] | Revision (Git commit ID) of runtime build. |
1180+
| rom_sha256_digest | u32[8] | Digest of ROM binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields). |
1181+
| fmc_sha384_digest | u32[12] | Digest of FMC binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields). |
1182+
| runtime_sha384_digest | u32[12] | Digest of runtime binary. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields). |
1183+
| owner_pub_key_hash | u32[12] | Hash of the owner public keys provided in the image bundle manifest. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields). |
1184+
| authman_sha384_digest | u32[12] | Hash of the authorization manifest provided by SET_AUTH_MANIFEST. See [Byte order of cryptographic fields](#byte-order-of-cryptographic-fields). |
1185+
| most_recent_fw_error | u32 | Most recent FW non-fatal error (shows current non-fatal error if non-zero) |
1186+
| vendor_pub_key_hash | u32[12] | Hash of the vendor public key used to verify firmware. **Only present in FW 2.0.2+ and 2.1.1+.** |
1187+
| image_manifest_pqc_type | u32 | PQC key type from image manifest. **Only present in FW 2.0.2+ and 2.1.1+.** |
1188+
| vendor_ecc384_pub_key_index | u32 | Index of the vendor ECC public key used for verification. **Only present in FW 2.0.2+ and 2.1.1+.** |
1189+
| vendor_pqc_pub_key_index | u32 | Index of the vendor PQC public key used for verification. **Only present in FW 2.0.2+ and 2.1.1+.** |
11861190

11871191
### VERSION
11881192

runtime/src/info.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ impl FwInfoCmd {
4646
resp.runtime_sha384_digest = pdata.rom.manifest1.runtime.digest;
4747
resp.owner_pub_key_hash = pdata.rom.data_vault.owner_pk_hash().into();
4848
resp.authman_sha384_digest = pdata.fw.auth_manifest_digest;
49+
resp.vendor_pub_key_hash = drivers
50+
.soc_ifc
51+
.fuse_bank()
52+
.vendor_pub_key_info_hash()
53+
.into();
54+
resp.image_manifest_pqc_type = pdata.rom.manifest1.pqc_key_type as u32;
55+
resp.vendor_ecc384_pub_key_index = handoff.data_vault.vendor_ecc_pk_index();
56+
resp.vendor_pqc_pub_key_index = handoff.data_vault.vendor_pqc_pk_index();
4957
resp.most_recent_fw_error = match get_fw_error_non_fatal() {
5058
0 => drivers.persistent_data.get().rom.cleared_non_fatal_fw_error,
5159
e => e,

runtime/tests/runtime_integration_tests/test_info.rs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,18 @@ fn test_fw_info() {
108108
caliptra_builder::build_and_sign_image(&FMC_WITH_UART, app, image_opts10).unwrap();
109109

110110
// Set fuses
111-
let owner_pub_key_hash = ImageGenerator::new(Crypto::default())
111+
let image_generator = ImageGenerator::new(Crypto::default());
112+
let owner_pub_key_hash = image_generator
112113
.owner_pubkey_digest(&image.manifest.preamble)
113114
.unwrap();
115+
let vendor_pub_key_hash = image_generator
116+
.vendor_pubkey_info_digest(&image.manifest.preamble)
117+
.unwrap();
114118

115119
let fuses = Fuses {
116120
fuse_pqc_key_type: *pqc_key_type as u32,
117121
owner_pk_hash: owner_pub_key_hash,
122+
vendor_pk_hash: vendor_pub_key_hash,
118123
..Default::default()
119124
};
120125

@@ -195,6 +200,17 @@ fn test_fw_info() {
195200
assert_eq!(info.fmc_sha384_digest, image.manifest.fmc.digest);
196201
assert_eq!(info.runtime_sha384_digest, image.manifest.runtime.digest);
197202
assert_eq!(info.most_recent_fw_error, 0x0);
203+
assert_eq!(info.owner_pub_key_hash, owner_pub_key_hash);
204+
assert_eq!(info.vendor_pub_key_hash, vendor_pub_key_hash);
205+
assert_eq!(info.image_manifest_pqc_type, *pqc_key_type as u32);
206+
assert_eq!(
207+
info.vendor_ecc384_pub_key_index,
208+
image.manifest.preamble.vendor_ecc_pub_key_idx
209+
);
210+
assert_eq!(
211+
info.vendor_pqc_pub_key_index,
212+
image.manifest.preamble.vendor_pqc_pub_key_idx
213+
);
198214

199215
// Make image with newer SVN.
200216
let mut image_opts20 = image_opts.clone();
@@ -212,6 +228,15 @@ fn test_fw_info() {
212228
assert_eq!(info.fw_svn, 20);
213229
assert_eq!(info.min_fw_svn, 10);
214230
assert_eq!(info.cold_boot_fw_svn, 10);
231+
assert_eq!(info.image_manifest_pqc_type, *pqc_key_type as u32);
232+
assert_eq!(
233+
info.vendor_ecc384_pub_key_index,
234+
image.manifest.preamble.vendor_ecc_pub_key_idx
235+
);
236+
assert_eq!(
237+
info.vendor_pqc_pub_key_index,
238+
image.manifest.preamble.vendor_pqc_pub_key_idx
239+
);
215240

216241
// Make image with older SVN.
217242
let mut image_opts5 = image_opts;
@@ -227,13 +252,31 @@ fn test_fw_info() {
227252
assert_eq!(info.fw_svn, 5);
228253
assert_eq!(info.min_fw_svn, 5);
229254
assert_eq!(info.cold_boot_fw_svn, 10);
255+
assert_eq!(info.image_manifest_pqc_type, *pqc_key_type as u32);
256+
assert_eq!(
257+
info.vendor_ecc384_pub_key_index,
258+
image.manifest.preamble.vendor_ecc_pub_key_idx
259+
);
260+
assert_eq!(
261+
info.vendor_pqc_pub_key_index,
262+
image.manifest.preamble.vendor_pqc_pub_key_idx
263+
);
230264

231265
// Go back to SVN 20
232266
update_to(&mut model, &image20);
233267
let info = get_fwinfo(&mut model);
234268
assert_eq!(info.fw_svn, 20);
235269
assert_eq!(info.min_fw_svn, 5);
236270
assert_eq!(info.cold_boot_fw_svn, 10);
271+
assert_eq!(info.image_manifest_pqc_type, *pqc_key_type as u32);
272+
assert_eq!(
273+
info.vendor_ecc384_pub_key_index,
274+
image.manifest.preamble.vendor_ecc_pub_key_idx
275+
);
276+
assert_eq!(
277+
info.vendor_pqc_pub_key_index,
278+
image.manifest.preamble.vendor_pqc_pub_key_idx
279+
);
237280
}
238281
}
239282

0 commit comments

Comments
 (0)