Add hash operation callbacks to bpf_crypto_type structure:
 - hash(): Performs hashing operation on input data
 - digestsize(): Returns the output size for the hash algorithm

These additions enable BPF programs to use cryptographic hash functions
through the unified bpf_crypto_type interface, supporting use cases such
as content verification, integrity checking, and data authentication.

Signed-off-by: Daniel Hodges <[email protected]>
---
 include/linux/bpf_crypto.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/bpf_crypto.h b/include/linux/bpf_crypto.h
index a41e71d4e2d9..c84371cc4e47 100644
--- a/include/linux/bpf_crypto.h
+++ b/include/linux/bpf_crypto.h
@@ -11,8 +11,10 @@ struct bpf_crypto_type {
        int (*setauthsize)(void *tfm, unsigned int authsize);
        int (*encrypt)(void *tfm, const u8 *src, u8 *dst, unsigned int len, u8 
*iv);
        int (*decrypt)(void *tfm, const u8 *src, u8 *dst, unsigned int len, u8 
*iv);
+       int (*hash)(void *tfm, const u8 *data, u8 *out, unsigned int len);
        unsigned int (*ivsize)(void *tfm);
        unsigned int (*statesize)(void *tfm);
+       unsigned int (*digestsize)(void *tfm);
        u32 (*get_flags)(void *tfm);
        struct module *owner;
        char name[14];
-- 
2.51.0


Reply via email to