On 05/01/2026 17:37, Daniel Hodges wrote:
Add bpf_crypto_shash module that registers a hash type with the BPF
crypto infrastructure, enabling BPF programs to access kernel hash
algorithms through a unified interface.

Update the bpf_crypto_type interface with hash-specific callbacks:
    - alloc_tfm: Allocates crypto_shash context with proper descriptor size
    - free_tfm: Releases hash transform and context memory
    - has_algo: Checks algorithm availability via crypto_has_shash()
    - hash: Performs single-shot hashing via crypto_shash_digest()
    - digestsize: Returns the output size for the hash algorithm
    - get_flags: Exposes transform flags to BPF programs

Update bpf_shash_ctx to contain crypto_shash transform and shash_desc
descriptor to accommodate algorithm-specific descriptor requirements.

Signed-off-by: Daniel Hodges <[email protected]>
---
  MAINTAINERS               |  1 +
  crypto/Makefile           |  3 ++
  crypto/bpf_crypto_shash.c | 95 +++++++++++++++++++++++++++++++++++++++
  3 files changed, 99 insertions(+)
  create mode 100644 crypto/bpf_crypto_shash.c

[...]

+static const struct bpf_crypto_type bpf_crypto_shash_type = {
+       .alloc_tfm      = bpf_crypto_shash_alloc_tfm,
+       .free_tfm       = bpf_crypto_shash_free_tfm,
+       .has_algo       = bpf_crypto_shash_has_algo,
+       .hash           = bpf_crypto_shash_hash,

I don't see a definition of hash() callback in struct bpf_crypto_type

+       .digestsize     = bpf_crypto_shash_digestsize,
+       .get_flags      = bpf_crypto_shash_get_flags,
+       .owner          = THIS_MODULE,
+       .name           = "hash",
+};

Reply via email to