Re: [PATCH bpf-next v4 3/6] bpf: Add hash kfunc for cryptographic hashing
From: Vadim Fedorenko
Date: Tue Jan 06 2026 - 17:12:33 EST
On 05/01/2026 17:37, Daniel Hodges wrote:
Extend bpf_crypto_type structure with hash operations:
- hash(): Performs hashing operation
- digestsize(): Returns hash output size
well, as I've already mentioned, none of them are actually introduced in
the patchset.
Update bpf_crypto_ctx_create() to support keyless operations:
- Hash algorithms don't require keys, unlike ciphers
- Only validates key presence if type->setkey is defined
- Conditionally sets IV/state length for cipher operations only
Add bpf_crypto_hash() kfunc that works with any hash algorithm
registered in the kernel's crypto API through the BPF crypto type
system. This enables BPF programs to compute cryptographic hashes for
use cases such as content verification, integrity checking, and data
authentication.
Signed-off-by: Daniel Hodges <git@xxxxxxxxxxxxxxxx>
---
kernel/bpf/crypto.c | 78 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 70 insertions(+), 8 deletions(-)