[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mgkjpyvhv5lnk5qwsj5q7f7e5zcxkmucefoik5n5c4c5otjrhi@5xjigugmoith>
Date: Tue, 16 Dec 2025 18:31:53 -0500
From: Daniel Hodges <daniel@...ielhodges.dev>
To: Song Liu <song@...nel.org>
Cc: Daniel Hodges <git@...ielhodges.dev>, bpf@...r.kernel.org,
ast@...nel.org, andrii@...nel.org, daniel@...earbox.net,
vadim.fedorenko@...ux.dev, yatsenko@...a.com, martin.lau@...ux.dev, eddyz87@...il.com,
haoluo@...gle.com, jolsa@...nel.org, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, yonghong.song@...ux.dev, herbert@...dor.apana.org.au,
davem@...emloft.net, linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 3/6] bpf: Add SHA hash kfunc for
cryptographic hashing
On Wed, Dec 17, 2025 at 06:58:43AM +0900, Song Liu wrote:
> On Sun, Dec 7, 2025 at 7:01 PM Daniel Hodges <git@...ielhodges.dev> wrote:
> [...]
> > +
> > + if (!ctx->type->hash)
> > + return -EOPNOTSUPP;
> > +
> > + data_len = __bpf_dynptr_size(data_kern);
> > + out_len = __bpf_dynptr_size(out_kern);
> > +
> > + if (data_len == 0)
> > + return -EINVAL;
> > +
> > + if (!ctx->type->digestsize)
> > + return -EOPNOTSUPP;
> > +
> > + unsigned int digestsize = ctx->type->digestsize(ctx->tfm);
>
> ./scripts/checkpatch.pl will complain about this:
>
> WARNING: Missing a blank line after declarations
> #109: FILE: kernel/bpf/crypto.c:387:
> + unsigned int digestsize = ctx->type->digestsize(ctx->tfm);
> + if (out_len < digestsize)
>
> Please run ./scripts/checkpatch.pl on all the patches. It also highlights
> some other issues, such as we need to update the MAINTAINERS file.
>
> Also, we don't want variable declaration in the middle of a code
> block.
>
> > + if (out_len < digestsize)
> > + return -EINVAL;
> > +
> [...]
> > static const struct btf_kfunc_id_set crypt_kfunc_set = {
> > @@ -383,6 +442,7 @@ static int __init crypto_kfunc_init(void)
> > ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, &crypt_kfunc_set);
> > ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_ACT, &crypt_kfunc_set);
> > ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_XDP, &crypt_kfunc_set);
> > + ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL, &crypt_kfunc_set);
>
> This enables all kfuncs in crypt_kfunc_set for BPF_PROG_TYPE_SYSCALL.
> We need a clear explanation why this is needed.
>
> Thanks,
> Song
Sounds good! It might take me a day or so for the next set as I'm
traveling.
Powered by blists - more mailing lists