[[PATCH v2] tpm: Add wolfTPM library support for TPM 2.0 02/12] include: add byteorder macro guards and SHA384 hash wrapper
Ilias Apalodimas
ilias.apalodimas at linaro.org
Fri May 8 12:55:23 CEST 2026
> + */
[...]
> +int wc_Sha384Hash(const unsigned char *data, unsigned int len,
> + unsigned char *hash);
> +#endif /* WOLFTPM2_NO_WOLFCRYPT */
> +
> #endif
> diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
> index bee0ff60336..def601eed2b 100644
> --- a/include/linux/byteorder/generic.h
> +++ b/include/linux/byteorder/generic.h
> @@ -89,12 +89,6 @@
> #define le32_to_cpu __le32_to_cpu
> #define cpu_to_le16 __cpu_to_le16
> #define le16_to_cpu __le16_to_cpu
> -#define cpu_to_be64 __cpu_to_be64
> -#define be64_to_cpu __be64_to_cpu
> -#define cpu_to_be32 __cpu_to_be32
> -#define be32_to_cpu __be32_to_cpu
> -#define cpu_to_be16 __cpu_to_be16
> -#define be16_to_cpu __be16_to_cpu
I'd prefer leaving this as is and add any required ifndefs to the wolfTPM part
Cheers
/Ilias
> #define cpu_to_le64p __cpu_to_le64p
> #define le64_to_cpup __le64_to_cpup
> #define cpu_to_le32p __cpu_to_le32p
> @@ -120,6 +114,31 @@
> #define cpu_to_be16s __cpu_to_be16s
> #define be16_to_cpus __be16_to_cpus
>
> +/*
> + * Check if byte-order functions are already defined by the system:
> + * wolfTPM, wolfCrypt, and U-boot all define these functions, so
> + * we need to check if they are already defined before defining
> + * them again.
> + */
> +#ifndef cpu_to_be16
> +#define cpu_to_be16 __cpu_to_be16
> +#endif
> +#ifndef cpu_to_be32
> +#define cpu_to_be32 __cpu_to_be32
> +#endif
> +#ifndef cpu_to_be64
> +#define cpu_to_be64 __cpu_to_be64
> +#endif
> +#ifndef be16_to_cpu
> +#define be16_to_cpu __be16_to_cpu
> +#endif
> +#ifndef be32_to_cpu
> +#define be32_to_cpu __be32_to_cpu
> +#endif
> +#ifndef be64_to_cpu
> +#define be64_to_cpu __be64_to_cpu
> +#endif
> +
> /*
> * They have to be macros in order to do the constant folding
> * correctly - if the argument passed into a inline function
More information about the U-Boot
mailing list