]> Git Repo - J-u-boot.git/blobdiff - include/tpm-v2.h
tpm: add flag in hash_algo_list and API to check if algorithm is supported
[J-u-boot.git] / include / tpm-v2.h
index 4fd19c52fd70e5d3d8864ed8bfde0fd1443139c1..c49eadda26c70c1fb4279c36093c08b41133f984 100644 (file)
@@ -268,6 +268,7 @@ struct digest_info {
        u16 hash_alg;
        u32 hash_mask;
        u16 hash_len;
+       bool supported;
 };
 
 /* Algorithm Registry */
@@ -278,38 +279,50 @@ struct digest_info {
 #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 */
@@ -704,6 +717,14 @@ enum tpm2_algorithms tpm2_name_to_algorithm(const char *name);
  */
 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
  *
@@ -732,20 +753,21 @@ u16 tpm2_algorithm_to_len(enum tpm2_algorithms algo);
  */
 
 /**
- * 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 */
This page took 0.02817 seconds and 4 git commands to generate.