u16 hash_alg;
u32 hash_mask;
u16 hash_len;
+ bool supported;
};
/* Algorithm Registry */
#define TCG2_BOOT_HASH_ALG_SM3_256 0x00000010
static const struct digest_info hash_algo_list[] = {
-#if IS_ENABLED(CONFIG_SHA1)
{
"sha1",
TPM2_ALG_SHA1,
TCG2_BOOT_HASH_ALG_SHA1,
TPM2_SHA1_DIGEST_SIZE,
- },
+#if IS_ENABLED(CONFIG_SHA1)
+ true,
+#else
+ false,
#endif
-#if IS_ENABLED(CONFIG_SHA256)
+ },
{
"sha256",
TPM2_ALG_SHA256,
TCG2_BOOT_HASH_ALG_SHA256,
TPM2_SHA256_DIGEST_SIZE,
- },
+#if IS_ENABLED(CONFIG_SHA256)
+ true,
+#else
+ false,
#endif
-#if IS_ENABLED(CONFIG_SHA384)
+ },
{
"sha384",
TPM2_ALG_SHA384,
TCG2_BOOT_HASH_ALG_SHA384,
TPM2_SHA384_DIGEST_SIZE,
- },
+#if IS_ENABLED(CONFIG_SHA384)
+ true,
+#else
+ false,
#endif
-#if IS_ENABLED(CONFIG_SHA512)
+ },
{
"sha512",
TPM2_ALG_SHA512,
TCG2_BOOT_HASH_ALG_SHA512,
TPM2_SHA512_DIGEST_SIZE,
- },
+#if IS_ENABLED(CONFIG_SHA512)
+ true,
+#else
+ false,
#endif
+ },
};
/* NV index attributes */
*/
const char *tpm2_algorithm_name(enum tpm2_algorithms);
+/**
+ * tpm2_algorithm_supported() - Check if the algorithm supported by U-Boot
+ *
+ * @algorithm_id: algorithm defined in enum tpm2_algorithms
+ * Return: true if supported, otherwise false
+ */
+bool tpm2_algorithm_supported(enum tpm2_algorithms algo);
+
/**
* tpm2_algorithm_to_len() - Return an algorithm length for supported algorithm id
*
*/
/**
- * tpm2_allow_extend() - Check if extending PCRs is allowed and safe
+ * tpm2_check_active_banks() - Check if the active PCR banks are supported by
+ * our configuration
*
* @dev: TPM device
* Return: true if allowed
*/
-bool tpm2_allow_extend(struct udevice *dev);
+bool tpm2_check_active_banks(struct udevice *dev);
/**
- * tpm2_is_active_pcr() - check the pcr_select. If at least one of the PCRs
- * supports the algorithm add it on the active ones
+ * tpm2_is_active_bank() - check the pcr_select. If at least one of the PCRs
+ * supports the algorithm add it on the active ones
*
* @selection: PCR selection structure
* Return: True if the algorithm is active
*/
-bool tpm2_is_active_pcr(struct tpms_pcr_selection *selection);
+bool tpm2_is_active_bank(struct tpms_pcr_selection *selection);
#endif /* __TPM_V2_H */