[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240416204004.3942393-1-vadfed@meta.com>
Date: Tue, 16 Apr 2024 13:40:00 -0700
From: Vadim Fedorenko <vadfed@...a.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
Jakub Kicinski
<kuba@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Andrii Nakryiko
<andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Mykola Lysenko
<mykolal@...com>,
Herbert Xu <herbert@...dor.apana.org.au>
CC: Vadim Fedorenko <vadfed@...a.com>, <netdev@...r.kernel.org>,
<linux-crypto@...r.kernel.org>, <bpf@...r.kernel.org>
Subject: [PATCH bpf-next v9 0/4] BPF crypto API framework
This series introduces crypto kfuncs to make BPF programs able to
utilize kernel crypto subsystem. Crypto operations made pluggable to
avoid extensive growth of kernel when it's not needed. Only skcipher is
added within this series, but it can be easily extended to other types
of operations. No hardware offload supported as it needs sleepable
context which is not available for TX or XDP programs. At the same time
crypto context initialization kfunc can only run in sleepable context,
that's why it should be run separately and store the result in the map.
Selftests show the common way to implement crypto actions in BPF
programs. Benchmark is also added to have a baseline.
Vadim Fedorenko (4):
bpf: make common crypto API for TC/XDP programs
bpf: crypto: add skcipher to bpf crypto
selftests: bpf: crypto skcipher algo selftests
selftests: bpf: crypto: add benchmark for crypto functions
MAINTAINERS | 8 +
crypto/Makefile | 3 +
crypto/bpf_crypto_skcipher.c | 82 ++++
include/linux/bpf.h | 1 +
include/linux/bpf_crypto.h | 24 ++
kernel/bpf/Makefile | 3 +
kernel/bpf/crypto.c | 377 ++++++++++++++++++
kernel/bpf/helpers.c | 2 +-
kernel/bpf/verifier.c | 1 +
tools/testing/selftests/bpf/Makefile | 2 +
tools/testing/selftests/bpf/bench.c | 6 +
.../selftests/bpf/benchs/bench_bpf_crypto.c | 190 +++++++++
tools/testing/selftests/bpf/config | 5 +
.../selftests/bpf/prog_tests/crypto_sanity.c | 200 ++++++++++
.../selftests/bpf/progs/crypto_basic.c | 70 ++++
.../selftests/bpf/progs/crypto_bench.c | 111 ++++++
.../selftests/bpf/progs/crypto_common.h | 67 ++++
.../selftests/bpf/progs/crypto_sanity.c | 161 ++++++++
.../selftests/bpf/progs/crypto_share.h | 10 +
19 files changed, 1322 insertions(+), 1 deletion(-)
create mode 100644 crypto/bpf_crypto_skcipher.c
create mode 100644 include/linux/bpf_crypto.h
create mode 100644 kernel/bpf/crypto.c
create mode 100644 tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/crypto_sanity.c
create mode 100644 tools/testing/selftests/bpf/progs/crypto_basic.c
create mode 100644 tools/testing/selftests/bpf/progs/crypto_bench.c
create mode 100644 tools/testing/selftests/bpf/progs/crypto_common.h
create mode 100644 tools/testing/selftests/bpf/progs/crypto_sanity.c
create mode 100644 tools/testing/selftests/bpf/progs/crypto_share.h
--
2.43.0
Powered by blists - more mailing lists