From: Aidan <[email protected]> Add #include <linux/types.h> to include/hash.h so that basic types (u8, u32, etc.) are available to all includers.
Add a wc_Sha384Hash() wrapper declaration in include/hash.h, gated by WOLFTPM2_NO_WOLFCRYPT. When wolfTPM is built without wolfCrypt, this wrapper provides SHA-384 hashing via U-Boot's hash subsystem, which is needed for Infineon TPM firmware update manifest validation. Signed-off-by: Aidan Garske <[email protected]> --- include/hash.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/hash.h b/include/hash.h index 8b3f79ec473..26043c43a9c 100644 --- a/include/hash.h +++ b/include/hash.h @@ -6,6 +6,8 @@ #ifndef _HASH_H #define _HASH_H +#include <linux/types.h> + #ifdef USE_HOSTCC #include <linux/kconfig.h> #endif @@ -163,4 +165,20 @@ int hash_progressive_lookup_algo(const char *algo_name, */ int hash_parse_string(const char *algo_name, const char *str, uint8_t *result); +#ifdef WOLFTPM2_NO_WOLFCRYPT +/** + * wc_Sha384Hash() - Calculate SHA384 hash + * @data: Data to hash + * @len: Length of data + * @hash: Output buffer for hash + * + * This is a wrapper function to provide wolfCrypt-compatible SHA384 hashing + * when wolfCrypt is not available. + * + * Return: 0 on success, -1 on error + */ +int wc_Sha384Hash(const unsigned char *data, unsigned int len, + unsigned char *hash); +#endif /* WOLFTPM2_NO_WOLFCRYPT */ + #endif -- 2.49.0

