Add function to get the hash size for a hash algorithm
return 0;
}
+int tpm2_hash_alg_to_size(uint16_t alg) {
+ if (alg == TPM2_ALG_SHA1)
+ return 20;
+ if (alg == TPM2_ALG_SHA256)
+ return 32;
+ if (alg == TPM2_ALG_SHA384)
+ return 48;
+ if (alg == TPM2_ALG_SHA512)
+ return 64;
+ return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown hash algorithm id 0x%" PRIx16, alg);
+}
+
const char *tpm2_hash_alg_to_string(uint16_t alg) {
if (alg == TPM2_ALG_SHA1)
return "sha1";
#define TPM2_ALG_RSA 0x1
#endif
+int tpm2_hash_alg_to_size(uint16_t alg);
+
const char *tpm2_hash_alg_to_string(uint16_t alg);
int tpm2_hash_alg_from_string(const char *alg);