11 #include "sw/device/lib/testing/keymgr_testutils.h"
12 #include "sw/device/lib/testing/test_framework/check.h"
14 #include "sw/device/silicon_creator/lib/base/boot_measurements.h"
16 #include "sw/device/silicon_creator/lib/drivers/hmac.h"
17 #include "sw/device/silicon_creator/lib/drivers/otp.h"
18 #include "sw/device/silicon_creator/lib/manifest.h"
19 #include "sw/device/silicon_creator/lib/manifest_def.h"
22 #include "otp_ctrl_regs.h"
24 OTTF_DEFINE_TEST_CONFIG();
26 static uint32_t otp_state[kHmacDigestNumWords + 4] = {0};
30 CHECK_DIF_OK(dif_keymgr_init(
40 if (otp_read32(OTP_CTRL_PARAM_OWNER_SW_CFG_ROM_KEYMGR_OTP_MEAS_EN_OFFSET) ==
46 otp_dai_read(kOtpPartitionCreatorSwCfg,
48 kOtpPartitions[kOtpPartitionCreatorSwCfg].digest_addr -
49 OTP_CTRL_PARAM_CREATOR_SW_CFG_OFFSET,
52 otp_dai_read(kOtpPartitionOwnerSwCfg,
54 kOtpPartitions[kOtpPartitionOwnerSwCfg].digest_addr -
55 OTP_CTRL_PARAM_OWNER_SW_CFG_OFFSET,
58 otp_dai_read(kOtpPartitionRotCreatorAuthCodesign,
60 OTP_CTRL_PARAM_ROTCREATORAUTHCODESIGNBLOCKSHA2_256HASHOFFSET -
61 OTP_CTRL_PARAM_ROT_CREATOR_AUTH_CODESIGN_OFFSET,
65 hmac_sha256(otp_state, (kHmacDigestNumWords + 4) *
sizeof(uint32_t),
67 CHECK_ARRAYS_EQ(bindings.
attestation, otp_measurement.digest,