File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -172,4 +172,12 @@ diff nv_ecc_ek_cert.der ecc_ek_cert.der
172172
173173rm nv_rsa_ek_cert.der rsa_ek_cert.der nv_ecc_ek_cert.der ecc_ek_cert.der priv_key.pem -f
174174
175+ # # Make sure that if there are several certificates of the same type, then the one belonging to low range has priority
176+ openssl x509 -in ecc_ek_cert.bin -out ecc_low_range_ek_cert.der -outform DER
177+ define_ek_cert_nv_index ecc_low_range_ek_cert.der $ECC_EK_CERT_NV_INDEX
178+
179+ tpm2 getekcertificate -o nv_ecc_ek_cert.der
180+
181+ diff nv_ecc_ek_cert.der ecc_low_range_ek_cert.der
182+
175183exit 0
Original file line number Diff line number Diff line change @@ -665,6 +665,9 @@ tool_rc get_tpm_properties(ESYS_CONTEXT *ectx) {
665665 goto get_tpm_properties_out ;
666666 }
667667
668+ ctx .rsa_ek_cert_nv_location = 0xffffffff ;
669+ ctx .ecc_ek_cert_nv_location = 0xffffffff ;
670+
668671 UINT32 i ;
669672 for (i = 0 ; i < capability_data -> data .handles .count ; i ++ ) {
670673 TPMI_RH_NV_INDEX index = capability_data -> data .handles .handle [i ];
@@ -673,12 +676,12 @@ tool_rc get_tpm_properties(ESYS_CONTEXT *ectx) {
673676 continue ;
674677 }
675678
676- if (m -> key_type == KTYPE_RSA ) {
679+ if (m -> key_type == KTYPE_RSA && index < ctx . rsa_ek_cert_nv_location ) {
677680 LOG_INFO ("Found pre-provisioned RSA EK certificate at %u [type=%s]" , index , m -> name );
678681 ctx .is_rsa_ek_cert_nv_location_defined = true;
679682 ctx .rsa_ek_cert_nv_location = m -> index ;
680683 }
681- if (m -> key_type == KTYPE_ECC ) {
684+ if (m -> key_type == KTYPE_ECC && index < ctx . ecc_ek_cert_nv_location ) {
682685 LOG_INFO ("Found pre-provisioned ECC EK certificate at %u [type=%s]" , index , m -> name );
683686 ctx .is_ecc_ek_cert_nv_location_defined = true;
684687 ctx .ecc_ek_cert_nv_location = m -> index ;
You can’t perform that action at this time.
0 commit comments