Skip to content

Commit 9ad76bc

Browse files
[rom_ext] fix CDI_* update bug
If non-CWT CDI certs are found in flash info page 19, we should treat this case as if the cert page is empty, and regenerate the certs. This enables running an X.509 ROM_EXT first and changing to a CWT ROM_EXT later. Since UDS cert is never generated outside perso (and is on a separate flash page), the UDS cert format is defined at provisioning time. Signed-off-by: Tim Trippel <[email protected]>
1 parent 2d37e7b commit 9ad76bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sw/device/silicon_creator/rom_ext/rom_ext.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,14 @@ static rom_error_t dice_chain_load_cert_obj(const char *name,
630630

631631
HARDENED_RETURN_IF_ERROR(err);
632632

633-
// Check if this cert is what we are looking for.
633+
// Check if this cert is what we are looking for. The name and type (X.509 vs
634+
// CWT) should match.
634635
HARDENED_CHECK_LE(name_size, sizeof(dice_chain.cert_obj.name));
635-
if (name == NULL || memcmp(dice_chain.cert_obj.name, name, name_size) != 0) {
636+
const perso_tlv_object_type_t kExpectedCertType =
637+
kDiceCertFormat == kDiceCertFormatX509TcbInfo ? kPersoObjectTypeX509Cert
638+
: kPersoObjectTypeCwtCert;
639+
if (name == NULL || memcmp(dice_chain.cert_obj.name, name, name_size) != 0 ||
640+
kExpectedCertType != dice_chain.cert_obj.obj_type) {
636641
// Name unmatched, keep the cert_obj but mark it as invalid.
637642
dice_chain.cert_valid = kHardenedBoolFalse;
638643
return kErrorOk;

0 commit comments

Comments
 (0)