-
Notifications
You must be signed in to change notification settings - Fork 152
Add cryptographic hash and signature verification kfuncs to BPF #10446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Upstream branch: 5d9fb42 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 3624446358 via email |
caaaee4 to
0f1145d
Compare
|
Upstream branch: 5d9fb42 |
852a242 to
efbabda
Compare
0f1145d to
fabb672
Compare
|
Upstream branch: c93c124 |
efbabda to
ed6aee5
Compare
fabb672 to
3119ae5
Compare
|
Upstream branch: 759377d |
ed6aee5 to
b847922
Compare
|
Upstream branch: 759377d |
b847922 to
0361533
Compare
3119ae5 to
162c0b3
Compare
|
Upstream branch: 6f0b824 |
0361533 to
995d4f5
Compare
162c0b3 to
305a67f
Compare
|
Upstream branch: e7a0adb |
995d4f5 to
f48deb9
Compare
305a67f to
7f3448b
Compare
|
Upstream branch: ec439c3 |
f48deb9 to
51c21e8
Compare
7f3448b to
0de3956
Compare
Add hash operation callbacks to bpf_crypto_type structure: - hash(): Performs hashing operation on input data - digestsize(): Returns the output size for the hash algorithm These additions enable BPF programs to use cryptographic hash functions through the unified bpf_crypto_type interface, supporting use cases such as content verification, integrity checking, and data authentication. Signed-off-by: Daniel Hodges <[email protected]>
Add 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. Update the bpf_crypto_type interface 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 Update bpf_shash_ctx to contain crypto_shash transform and shash_desc descriptor to accommodate algorithm-specific descriptor requirements. Signed-off-by: Daniel Hodges <[email protected]>
Extend bpf_crypto_type structure with hash operations: - hash(): Performs hashing operation - digestsize(): Returns hash output size 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 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. Signed-off-by: Daniel Hodges <[email protected]> Acked-by: Mykyta Yatsenko <[email protected]>
|
Upstream branch: ec439c3 |
Add 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. Signed-off-by: Daniel Hodges <[email protected]>
Add context-based ECDSA signature verification kfuncs: - bpf_ecdsa_ctx_create(): Creates reusable ECDSA context with public key - bpf_ecdsa_verify(): Verifies signatures using the context - bpf_ecdsa_ctx_acquire(): Increments context reference count - bpf_ecdsa_ctx_release(): Releases context with RCU safety The ECDSA implementation supports NIST curves (P-256, P-384, P-521) and uses the kernel's crypto_sig API. Public keys must be in uncompressed format (0x04 || x || y), and signatures are in r || s format. Signed-off-by: Daniel Hodges <[email protected]>
Add selftests to validate the ECDSA signature verification kfuncs introduced in the BPF crypto subsystem. The tests verify both valid signature acceptance and invalid signature rejection using the context-based ECDSA API. The tests use RFC 6979 test vectors for NIST P-256 (secp256r1) with well-known valid signatures. The algorithm "p1363(ecdsa-nist-p256)" is used to handle standard r||s signature format. Signed-off-by: Daniel Hodges <[email protected]>
51c21e8 to
e0cafd2
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1031239 expired. Closing PR. |
Pull request for series with
subject: Add cryptographic hash and signature verification kfuncs to BPF
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1031239