Add cryptographic hash and signature verification kfuncs to BPF
Subsystems (6)
PATCH v6 1/4 bpf: Add hash kfunc for cryptographic hashing
In reply to Daniel HodgesAdd 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.
The bpf_crypto_type interface is extended 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
Add bpf_crypto_hash() kfunc that works with any hash algorithm registered in the kernel's crypto API through the BPF crypto type system. This enables BPF programs to compute cryptographic hashes for use cases such as content verification, integrity checking, and data authentication.
Update bpf_crypto_ctx_create() to support keyless operations:
- Hash algorithms don't require keys, unlike ciphers
- Only validates key presence if type->setkey is defined
- Conditionally sets IV/state length for cipher operations only
--- MAINTAINERS | 1 + crypto/Makefile | 3 ++ crypto/bpf_crypto_shash.c | 96 ++++++++++++++++++++++++++++++++++++++ include/linux/bpf_crypto.h | 9 ++++ kernel/bpf/crypto.c | 93 ++++++++++++++++++++++++++++++++---- 5 files changed, 193 insertions(+), 9 deletions(-) create mode 100644 crypto/bpf_crypto_shash.c
MAINTAINERS +1 -0
@@ -4713,6 +4713,7 @@ BPF [CRYPTO] M: Vadim Fedorenko <[email protected]> L: [email protected] S: Maintained +F: crypto/bpf_crypto_shash.c F: crypto/bpf_crypto_skcipher.c F: include/linux/bpf_crypto.h F: kernel/bpf/crypto.c
crypto/Makefile +3 -0
@@ -30,6 +30,9 @@ obj-$(CONFIG_CRYPTO_ECHAINIV) += echainiv.o crypto_hash-y += ahash.o crypto_hash-y += shash.o obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o +ifeq ($(CONFIG_BPF_SYSCALL),y) +obj-$(CONFIG_CRYPTO_HASH2) += bpf_crypto_shash.o +endif obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o obj-$(CONFIG_CRYPTO_SIG2) += sig.o
crypto/bpf_crypto_shash.c new file +96 -0
96 lines not on this page · raw message
include/linux/bpf_crypto.h +9 -0
@@ -3,6 +3,12 @@ #ifndef _BPF_CRYPTO_H #define _BPF_CRYPTO_H +enum bpf_crypto_type_id { + BPF_CRYPTO_TYPE_SKCIPHER = 1, + BPF_CRYPTO_TYPE_HASH, + BPF_CRYPTO_TYPE_SIG, +}; + struct bpf_crypto_type { void *(*alloc_tfm)(const char *algo); void (*free_tfm)(void *tfm);
@@ -11,10 +17,13 @@ struct bpf_crypto_type {int (*setauthsize)(void *tfm,unsigned int authsize);int (*encrypt)(void *tfm,const u8 *src,u8 *dst,unsigned int len,u8 *iv);int (*decrypt)(void *tfm,const u8 *src,u8 *dst,unsigned int len,u8 *iv); +int (*hash)(void *tfm,const u8 *data,u8 *out,unsigned int len);unsigned int (*ivsize)(void *tfm);unsigned int (*statesize)(void *tfm); +unsigned int (*digestsize)(void *tfm);u32 (*get_flags)(void *tfm);struct module *owner; +enum bpf_crypto_type_id type_id;char name[14 ]; };
kernel/bpf/crypto.c +84 -9
141 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v6 2/4 selftests/bpf: Add tests for bpf_crypto_hash kfunc
In reply to Daniel HodgesAdd selftests to validate the bpf_crypto_hash works properly. The tests verify both correct functionality and proper error handling.
Test Data:
All tests use the well-known NIST test vector input "abc" and validate against the standardized expected outputs for each algorithm. This ensures the BPF kfunc wrappers correctly delegate to the kernel crypto library.
--- MAINTAINERS | 2 + tools/testing/selftests/bpf/config | 2 + .../selftests/bpf/prog_tests/crypto_hash.c | 210 ++++++++++++++++ .../selftests/bpf/progs/crypto_common.h | 2 + .../testing/selftests/bpf/progs/crypto_hash.c | 231 ++++++++++++++++++ 5 files changed, 447 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/crypto_hash.c create mode 100644 tools/testing/selftests/bpf/progs/crypto_hash.c
MAINTAINERS +2 -0
@@ -4717,6 +4717,8 @@ F: crypto/bpf_crypto_shash.c F: crypto/bpf_crypto_skcipher.c F: include/linux/bpf_crypto.h F: kernel/bpf/crypto.c +F: tools/testing/selftests/bpf/prog_tests/crypto_hash.c +F: tools/testing/selftests/bpf/progs/crypto_hash.c BPF [DOCUMENTATION] (Related to Standardization) R: David Vernet <[email protected]>
tools/testing/selftests/bpf/config +2 -0
@@ -13,6 +13,8 @@ CONFIG_BPF_SYSCALL=y CONFIG_CGROUP_BPF=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_USER_API=y CONFIG_CRYPTO_USER_API_HASH=y CONFIG_CRYPTO_USER_API_SKCIPHER=y
tools/testing/selftests/bpf/prog_tests/crypto_hash.c new file +210 -0
210 lines not on this page · raw message
tools/testing/selftests/bpf/progs/crypto_common.h +2 -0
@@ -15,6 +15,8 @@ int bpf_crypto_encrypt(struct bpf_crypto_ctx *ctx, const struct bpf_dynptr *src, const struct bpf_dynptr *dst, const struct bpf_dynptr *iv) __ksym; int bpf_crypto_decrypt(struct bpf_crypto_ctx *ctx, const struct bpf_dynptr *src, const struct bpf_dynptr *dst, const struct bpf_dynptr *iv) __ksym; +int bpf_crypto_hash(struct bpf_crypto_ctx *ctx, const struct bpf_dynptr *data, + const struct bpf_dynptr *out) __ksym;struct __crypto_ctx_value { struct bpf_crypto_ctx __kptr * ctx;
tools/testing/selftests/bpf/progs/crypto_hash.c new file +231 -0
231 lines not on this page · raw message
Signature · 1 line
2.52.0
v6 cover Add cryptographic hash and signature verification kfuncs to BPF
This patch series enhances BPF's cryptographic functionality by introducing kernel functions for SHA hashing and ECDSA signature verification. The changes enable BPF programs to verify data integrity and authenticity across networking, security, and observability use cases.
The series addresses two gaps in BPF's cryptographic toolkit:
1. Cryptographic hashing - supports content verification and message digest preparation
2. Asymmetric signature verification - allows validation of signed data without requiring private keys in the datapath
Use cases include:
- Verifying signed network packets or application data in XDP/TC programs
- Integrity checks within tracing and security monitoring
- Zero-trust security models with BPF-based credential verification
- Content-addressed storage in BPF-based filesystems
The implementation leverages existing BPF patterns: it uses bpf_dynptr for memory safety, reuses kernel crypto libraries (lib/crypto/sha256.c and crypto/ecdsa.c) rather than reimplementing algorithms, and provides context-based APIs supporting multiple program types.
v1: https://lore.kernel.org/bpf/[email protected]/
v2: https://lore.kernel.org/bpf/[email protected]/
- Fixed redundant __bpf_dynptr_is_rdonly() checks (Vadim)
- Added BPF hash algorithm type registration module in crypto/ subsystem
- Added CONFIG_CRYPTO_HASH2 guards around bpf_crypto_hash() kfunc and its BTF registration, matching the pattern used for CONFIG_CRYPTO_ECDSA
- Added mandatory digestsize validation for hash operations
v3: https://lore.kernel.org/bpf/[email protected]/
- Fixed patch ordering - header changes now in separate first commit before crypto module to ensure bisectability (bot+bpf-ci)
- Fixed type mismatch - changed u32 to u64 for dynptr sizes in bpf_crypto_hash() to match __bpf_dynptr_size() return type (Mykyta)
- Added CONFIG_CRYPTO_ECDSA to selftest config (Song)
- Refactored test code duplication with setup_skel() helper (Song)
- Added copyright notices to all new files
v4: https://lore.kernel.org/bpf/[email protected]/
- Reused common bpf_crypto_ctx structure for hash and signature operations instead of separate context types (Song)
- Fixed integer truncation in bpf_crypto_hash when data_len > UINT_MAX
- Corrected KF_RCU flags for ECDSA kfuncs (only bpf_ecdsa_verify needs KF_RCU)
- Updated MAINTAINERS file in test patches
- Refactored selftests to use crypto_common.h for kfunc declarations
v5: https://lore.kernel.org/bpf/[email protected]/
- Fixed bisectability: moved bpf_crypto_type_id enum and type_id field introduction to the hash module commit, before it's used by hash kfunc
- Renamed kfuncs from bpf_ecdsa_* to bpf_sig_* since signature verification is not ECDSA-specific (Vadim)
- Added NULL checks in bpf_crypto_sig wrapper functions for optional digest_size and max_size callbacks to prevent NULL pointer dereference
- Added extra validation in bpf_sig_digestsize/bpf_sig_maxsize kfuncs to return -EOPNOTSUPP when underlying algorithm returns 0
- Renamed test files from ecdsa_verify to sig_verify for consistency
v6:
- Fixed bisectability issue flagged by CI: squash hash module and hash kfunc commits so NULL checks in bpf_crypto_ctx_create() are present before the hash type is registered (bot+bpf-ci)
- Squash signature module and signature kfunc commits for the same reason
- This reduces the series from 7 to 4 commits while preserving all functionality
- Added type_id checks to bpf_crypto_encrypt() and bpf_crypto_decrypt() to prevent NULL pointer dereference when called with non-skcipher contexts
Daniel Hodges (4):
bpf: Add hash kfunc for cryptographic hashing selftests/bpf: Add tests for bpf_crypto_hash kfunc
bpf: Add signature verification kfuncs selftests/bpf: Add tests for signature verification kfuncs
MAINTAINERS | 6 + crypto/Makefile | 6 + crypto/bpf_crypto_shash.c | 96 ++++++ crypto/bpf_crypto_sig.c | 89 ++++++ crypto/bpf_crypto_skcipher.c | 1 + include/linux/bpf_crypto.h | 13 + kernel/bpf/crypto.c | 210 ++++++++++++- tools/testing/selftests/bpf/config | 2 + .../selftests/bpf/prog_tests/crypto_hash.c | 210 +++++++++++++ .../selftests/bpf/prog_tests/sig_verify.c | 163 ++++++++++ .../selftests/bpf/progs/crypto_common.h | 8 + .../testing/selftests/bpf/progs/crypto_hash.c | 231 ++++++++++++++ .../testing/selftests/bpf/progs/sig_verify.c | 286 ++++++++++++++++++ 13 files changed, 1312 insertions(+), 9 deletions(-) create mode 100644 crypto/bpf_crypto_shash.c create mode 100644 crypto/bpf_crypto_sig.c create mode 100644 tools/testing/selftests/bpf/prog_tests/crypto_hash.c create mode 100644 tools/testing/selftests/bpf/prog_tests/sig_verify.c create mode 100644 tools/testing/selftests/bpf/progs/crypto_hash.c create mode 100644 tools/testing/selftests/bpf/progs/sig_verify.c
--
2.52.0
PATCH v6 3/4 bpf: Add signature verification kfuncs
Add a bpf_crypto_sig module that registers signature verification algorithms with the BPF crypto type system. This enables signature operations (like ECDSA) to use the unified bpf_crypto_ctx structure.
The module provides:
- alloc_tfm/free_tfm for crypto_sig transform lifecycle
- has_algo to check algorithm availability
- setkey for public key configuration
- verify for signature verification
- get_flags for crypto API flags
Introduce bpf_sig_verify, bpf_sig_keysize, bpf_sig_digestsize, and bpf_sig_maxsize kfuncs enabling BPF programs to verify digital signatures using the kernel's crypto infrastructure.
Add enum bpf_crypto_type_id for runtime type checking to ensure operations are performed on the correct crypto context type. The enum values are assigned to all crypto type modules (skcipher, hash, sig).
The verify kfunc takes a crypto context (initialized with the sig type and appropriate algorithm like "ecdsa-nist-p256"), a message digest, and a signature. These kfuncs support any signature algorithm registered with the crypto subsystem (e.g., ECDSA, RSA).
--- MAINTAINERS | 1 + crypto/Makefile | 3 + crypto/bpf_crypto_sig.c | 89 ++++++++++++++++++++++++++ crypto/bpf_crypto_skcipher.c | 1 + include/linux/bpf_crypto.h | 4 ++ kernel/bpf/crypto.c | 117 +++++++++++++++++++++++++++++++++++ 6 files changed, 215 insertions(+) create mode 100644 crypto/bpf_crypto_sig.c
MAINTAINERS +1 -0
@@ -4714,6 +4714,7 @@ M: Vadim Fedorenko <[email protected]> L: [email protected] S: Maintained F: crypto/bpf_crypto_shash.c +F: crypto/bpf_crypto_sig.c F: crypto/bpf_crypto_skcipher.c F: include/linux/bpf_crypto.h F: kernel/bpf/crypto.c
crypto/Makefile +3 -0
@@ -36,6 +36,9 @@ endif obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o obj-$(CONFIG_CRYPTO_SIG2) += sig.o +ifeq ($(CONFIG_BPF_SYSCALL),y) +obj-$(CONFIG_CRYPTO_SIG2) += bpf_crypto_sig.o +endif obj-$(CONFIG_CRYPTO_KPP2) += kpp.o obj-$(CONFIG_CRYPTO_HKDF) += hkdf.o
crypto/bpf_crypto_sig.c new file +89 -0
89 lines not on this page · raw message
crypto/bpf_crypto_skcipher.c +1 -0
@@ -63,6 +63,7 @@ static const struct bpf_crypto_type bpf_crypto_lskcipher_type = { .statesize = bpf_crypto_lskcipher_statesize, .get_flags = bpf_crypto_lskcipher_get_flags, .owner = THIS_MODULE, + .type_id = BPF_CRYPTO_TYPE_SKCIPHER, .name = "skcipher", };
include/linux/bpf_crypto.h +4 -0
@@ -18,9 +18,13 @@ struct bpf_crypto_type {int (*encrypt)(void *tfm,const u8 *src,u8 *dst,unsigned int len,u8 *iv);int (*decrypt)(void *tfm,const u8 *src,u8 *dst,unsigned int len,u8 *iv);int (*hash)(void *tfm,const u8 *data,u8 *out,unsigned int len); +int (*verify)(void *tfm,const u8 *sig,unsigned int sig_len, +const u8 *msg,unsigned int msg_len);unsigned int (*ivsize)(void *tfm);unsigned int (*statesize)(void *tfm);unsigned int (*digestsize)(void *tfm); +unsigned int (*keysize)(void *tfm); +unsigned int (*maxsize)(void *tfm);u32 (*get_flags)(void *tfm);struct module *owner;enum bpf_crypto_type_id type_id;
kernel/bpf/crypto.c +117 -0
129 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH v6 4/4 selftests/bpf: Add tests for signature verification kfuncs
In reply to Daniel HodgesAdd tests for the signature verification kfuncs:
1. test_ecdsa_verify_valid_signature: Verifies that a valid ECDSA signature over a known message hash is correctly verified using the P-256 curve with a test vector.
2. test_ecdsa_verify_invalid_signature: Verifies that an invalid signature (with modified r component) is correctly rejected.
3. test_ecdsa_size_queries: Tests the bpf_sig_keysize(), bpf_sig_digestsize(), and bpf_sig_maxsize() kfuncs to ensure they return valid positive values for a P-256 ECDSA context.
4. test_ecdsa_on_hash_ctx: Tests that calling bpf_sig_verify on a hash context fails with -EINVAL due to type mismatch.
5. test_ecdsa_keysize_on_hash_ctx: Tests that calling bpf_sig_keysize on a hash context fails with -EINVAL due to type mismatch.
6. test_ecdsa_zero_len_msg: Tests that zero-length message is rejected.
7. test_ecdsa_zero_len_sig: Tests that zero-length signature is rejected.
The test uses the p1363(ecdsa-nist-p256) algorithm with a known NIST P-256 test vector for reliable and reproducible testing.
--- MAINTAINERS | 2 + .../selftests/bpf/prog_tests/sig_verify.c | 163 ++++++++++ .../selftests/bpf/progs/crypto_common.h | 6 + .../testing/selftests/bpf/progs/sig_verify.c | 286 ++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/sig_verify.c create mode 100644 tools/testing/selftests/bpf/progs/sig_verify.c
MAINTAINERS +2 -0
@@ -4719,7 +4719,9 @@ F: crypto/bpf_crypto_skcipher.c F: include/linux/bpf_crypto.h F: kernel/bpf/crypto.c F: tools/testing/selftests/bpf/prog_tests/crypto_hash.c +F: tools/testing/selftests/bpf/prog_tests/sig_verify.c F: tools/testing/selftests/bpf/progs/crypto_hash.c +F: tools/testing/selftests/bpf/progs/sig_verify.c BPF [DOCUMENTATION] (Related to Standardization) R: David Vernet <[email protected]>
tools/testing/selftests/bpf/prog_tests/sig_verify.c new file +163 -0
163 lines not on this page · raw message
tools/testing/selftests/bpf/progs/crypto_common.h +6 -0
@@ -17,6 +17,12 @@ int bpf_crypto_decrypt(struct bpf_crypto_ctx *ctx, const struct bpf_dynptr *src, const struct bpf_dynptr *dst, const struct bpf_dynptr *iv) __ksym; int bpf_crypto_hash(struct bpf_crypto_ctx *ctx, const struct bpf_dynptr *data, const struct bpf_dynptr *out) __ksym; +int bpf_sig_verify(struct bpf_crypto_ctx *ctx, + const struct bpf_dynptr *message, + const struct bpf_dynptr *signature) __ksym; +int bpf_sig_keysize(struct bpf_crypto_ctx *ctx) __ksym; +int bpf_sig_digestsize(struct bpf_crypto_ctx *ctx) __ksym; +int bpf_sig_maxsize(struct bpf_crypto_ctx *ctx) __ksym;struct __crypto_ctx_value { struct bpf_crypto_ctx __kptr * ctx;
tools/testing/selftests/bpf/progs/sig_verify.c new file +286 -0
286 lines not on this page · raw message
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH bpf-next v6 1/4] bpf: Add hash kfunc for cryptographic hashing
In reply to Daniel HodgesThe type_id check here will break existing skcipher users. Looking at crypto/bpf_crypto_skcipher.c, bpf_crypto_lskcipher_type does not set the type_id field:
Quoted 15 lines
include/linux/bpf_crypto.h +6
-0@@ -3,6 +3,12 @@#ifndef _BPF_CRYPTO_H#define _BPF_CRYPTO_H +enum bpf_crypto_type_id { +BPF_CRYPTO_TYPE_SKCIPHER =1 , +BPF_CRYPTO_TYPE_HASH , +BPF_CRYPTO_TYPE_SIG , +}; + struct bpf_crypto_type {
[ ... ]
Quoted 6 lines
include/linux/bpf_crypto.h +1
-0+enum bpf_crypto_type_id type_id;char name[14]; };kernel/bpf/crypto.c +0
-0
[ ... ]
kernel/bpf/crypto.c __bpf_kfunc int bpf_crypto_decrypt(struct bpf_crypto_ctx *ctx, · line 341
Quoted 6 lines
kernel/bpf/crypto.c +2
-0@@ -325,6 +337,9 @@ __bpf_kfunc int bpf_crypto_decrypt(struct bpf_crypto_ctx *ctx,const struct bpf_dynptr_kern *dst_kern = (struct bpf_dynptr_kern *)dst;const struct bpf_dynptr_kern *siv_kern = (struct bpf_dynptr_kern *)siv__nullable; +if (ctx->type->type_id !=BPF_CRYPTO_TYPE_SKCIPHER ) +return -EINVAL ;
The type_id check here will break existing skcipher users. Looking at crypto/bpf_crypto_skcipher.c, bpf_crypto_lskcipher_type does not set the type_id field:
static const struct bpf_crypto_type bpf_crypto_lskcipher_type = {
.alloc_tfm = bpf_crypto_lskcipher_alloc_tfm,
...
.owner = THIS_MODULE,
.name = "skcipher",
// no .type_id = BPF_CRYPTO_TYPE_SKCIPHER
};Since the struct is const and type_id is not initialized, it defaults to 0. BPF_CRYPTO_TYPE_SKCIPHER is 1, so this check will always fail for skcipher contexts, causing bpf_crypto_decrypt() to return -EINVAL for all skcipher operations.
Should bpf_crypto_skcipher.c be updated in this commit to set .type_id = BPF_CRYPTO_TYPE_SKCIPHER?
I found that commit 2dad6d96489e ("bpf: Add signature verification kfuncs") later in the series adds this initialization, but until then existing skcipher functionality appears broken.
kernel/bpf/crypto.c __bpf_kfunc int bpf_crypto_encrypt(struct bpf_crypto_ctx *ctx, · line 365
Quoted 10 lines
kernel/bpf/crypto.c +3
-0+return bpf_crypto_crypt (ctx, src_kern, dst_kern, siv_kern, true); }@@ -346,9 +361,64 @@ __bpf_kfunc int bpf_crypto_encrypt(struct bpf_crypto_ctx *ctx,const struct bpf_dynptr_kern *dst_kern = (struct bpf_dynptr_kern *)dst;const struct bpf_dynptr_kern *siv_kern = (struct bpf_dynptr_kern *)siv__nullable; +if (ctx->type->type_id !=BPF_CRYPTO_TYPE_SKCIPHER ) +return -EINVAL ;
Same issue here - bpf_crypto_encrypt() will fail for skcipher contexts because type_id is uninitialized in bpf_crypto_lskcipher_type.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21319193058
Re: [PATCH bpf-next v6 4/4] selftests/bpf: Add tests for signature verification kfuncs
In reply to Daniel HodgesQuoted 28 lines · Daniel Hodges
Add tests for the signature verification kfuncs:
1.
test_ecdsa_verify_valid_signature: Verifies that a valid ECDSA signature over a known message hash is correctly verified using the P-256 curve with a test vector.2.
test_ecdsa_verify_invalid_signature: Verifies that an invalid signature (with modified r component) is correctly rejected.3.
test_ecdsa_size_queries: Tests thebpf_sig_keysize(),bpf_sig_digestsize(), andbpf_sig_maxsize()kfuncs to ensure they return valid positive values for a P-256 ECDSA context.4.
test_ecdsa_on_hash_ctx: Tests that callingbpf_sig_verifyon a hash context fails with-EINVALdue to type mismatch.5.
test_ecdsa_keysize_on_hash_ctx: Tests that callingbpf_sig_keysizeon a hash context fails with-EINVALdue to type mismatch.6.
test_ecdsa_zero_len_msg: Tests that zero-length message is rejected.7.
test_ecdsa_zero_len_sig: Tests that zero-length signature is rejected.The test uses the p1363(ecdsa-nist-p256) algorithm with a known NIST P-256 test vector for reliable and reproducible testing.
Signed-off-by Daniel Hodges <[email protected]>
Quoted 8 lines
--- MAINTAINERS | 2 + .../selftests/bpf/prog_tests/sig_verify.c | 163 ++++++++++ .../selftests/bpf/progs/crypto_common.h | 6 + .../testing/selftests/bpf/progs/sig_verify.c | 286 ++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/sig_verify.c create mode 100644 tools/testing/selftests/bpf/progs/sig_verify.c
It's a v6 already, but your new selftests are still failing in CI.
Error: #385 sig_verify
Error: #385/1 sig_verify/verify_valid_signature
Error: #385/3 sig_verify/size_queries
Error: #385/6 sig_verify/zero_len_msg
Error: #385/7 sig_verify/zero_len_sig
Please make sure CI is green before submitting v7.
No one is reviewing the patches when they don't pass their own tests.
pw-bot: cr
Re: [PATCH bpf-next v6 4/4] selftests/bpf: Add tests for signature verification kfuncs
Quoted 12 lines
Quoted 9 lines
Signed-off-by Daniel Hodges <[email protected]>--- MAINTAINERS | 2 + .../selftests/bpf/prog_tests/sig_verify.c | 163 ++++++++++ .../selftests/bpf/progs/crypto_common.h | 6 + .../testing/selftests/bpf/progs/sig_verify.c | 286 ++++++++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/sig_verify.c create mode 100644 tools/testing/selftests/bpf/progs/sig_verify.cIt's a v6 already, but your new selftests are still failing in CI.
Quoted 8 lines
Error: #385
sig_verify
Error: #385/1 sig_verify/verify_valid_signature
Error: #385/3 sig_verify/size_queries
Error: #385/6 sig_verify/zero_len_msg
Error: #385/7 sig_verify/zero_len_sigPlease make sure CI is green before submitting v7.
No one is reviewing the patches when they don't pass their own tests.
Noted, sorry about that. I think my local vm has some different config:
vng -- ./tools/testing/selftests/bpf/test_progs -t sig_verify WARNING! Selftests relying on bpf_testmod.ko will be skipped. Can't find bpf_testmod.ko kernel module: -2
#385/1 sig_verify/verify_valid_signature:OK #385/2 sig_verify/verify_invalid_signature:OK #385/3 sig_verify/size_queries:OK #385/4 sig_verify/ecdsa_on_hash_ctx:OK #385/5 sig_verify/ecdsa_keysize_on_hash_ctx:OK #385/6 sig_verify/zero_len_msg:OK #385/7 sig_verify/zero_len_sig:OK #385 sig_verify:OK
Summary: 1/7 PASSED, 0 SKIPPED, 0 FAILED
I'll figure it out properly, thanks for the direction!