diff options
| author | Tom Rini <[email protected]> | 2025-01-18 17:13:01 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-01-18 17:13:01 -0600 |
| commit | 639cd409987acf173eaffebe7876968b42fd7c32 (patch) | |
| tree | 749d7fdb6e091998fd39621c918e90a128c22e83 /include | |
| parent | a1e7dd7e1426b263cb832952eda4a0971e4803d0 (diff) | |
| parent | 3f9d18254bff2ba869a65f9e1e03277705338f9e (diff) | |
Merge patch series "add the support of sha256_hmac and sha256_hkdf"
Philippe Reynes <[email protected]> says:
This serie adds the support of sha256_hmac and sha256_hkdf.
A first version was sent several months ago just before the
integration of mbedtls. This new version is based on mbedtls.
The first patch of this serie add the support of hkdf
using mbedtls.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
| -rw-r--r-- | include/u-boot/sha256.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/u-boot/sha256.h b/include/u-boot/sha256.h index 44a9b528b48..d7a3403270b 100644 --- a/include/u-boot/sha256.h +++ b/include/u-boot/sha256.h @@ -1,6 +1,8 @@ #ifndef _SHA256_H #define _SHA256_H +#include <linux/compiler_attributes.h> +#include <linux/errno.h> #include <linux/kconfig.h> #include <linux/types.h> @@ -45,4 +47,26 @@ void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]); void sha256_csum_wd(const unsigned char *input, unsigned int ilen, unsigned char *output, unsigned int chunk_sz); +int sha256_hmac(const unsigned char *key, int keylen, + const unsigned char *input, unsigned int ilen, + unsigned char *output); + +#if CONFIG_IS_ENABLED(HKDF_MBEDTLS) +int sha256_hkdf(const unsigned char *salt, int saltlen, + const unsigned char *ikm, int ikmlen, + const unsigned char *info, int infolen, + unsigned char *output, int outputlen); +#else +static inline int sha256_hkdf(const unsigned char __always_unused *salt, + int __always_unused saltlen, + const unsigned char __always_unused *ikm, + int __always_unused ikmlen, + const unsigned char __always_unused *info, + int __always_unused infolen, + unsigned char __always_unused *output, + int __always_unused outputlen) { + return -EOPNOTSUPP; +} +#endif + #endif /* _SHA256_H */ |
