lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 26 Oct 2023 15:53:20 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Vadim Fedorenko <vadfed@...a.com>
Cc: Martin KaFai Lau <martin.lau@...ux.dev>, Andrii Nakryiko <andrii@...nel.org>, 
	Alexei Starovoitov <ast@...nel.org>, Mykola Lysenko <mykolal@...com>, 
	Vadim Fedorenko <vadim.fedorenko@...ux.dev>, bpf <bpf@...r.kernel.org>, 
	Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/2] bpf: add skcipher API support to TC/XDP programs

On Wed, Oct 25, 2023 at 6:59 PM Vadim Fedorenko <vadfed@...a.com> wrote:
>
> +__bpf_kfunc struct bpf_crypto_skcipher_ctx *
> +bpf_crypto_skcipher_ctx_create(const struct bpf_dynptr_kern *algo, const struct bpf_dynptr_kern *key,
> +                              int *err)
> +{
> +       struct bpf_crypto_skcipher_ctx *ctx;
> +
> +       if (__bpf_dynptr_size(algo) > CRYPTO_MAX_ALG_NAME) {
> +               *err = -EINVAL;
> +               return NULL;
> +       }
> +
> +       if (!crypto_has_skcipher(algo->data, CRYPTO_ALG_TYPE_SKCIPHER, CRYPTO_ALG_TYPE_MASK)) {
> +               *err = -EOPNOTSUPP;
> +               return NULL;
> +       }
> +
> +       ctx = bpf_mem_cache_alloc(&bpf_crypto_ctx_ma);

Since this kfunc is sleepable, just kmalloc(GFP_KERNEL) here.
No need to use bpf_mem_alloc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ