Re: [PATCH bpf-next 1/2] bpf: add skcipher API support to TC/XDP programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 25, 2023 at 6:59 PM Vadim Fedorenko <vadfed@xxxxxxxx> 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.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux