From c63b6d3aed21f474080dd491f5583123448dd1ba Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 16 Aug 2026 18:19:56 +0000 Subject: lib: Make crypt contexts thread-safe Moves the per-packet EVP context to a thread-local state. Now refuses a security config with -ENOTSUP without supported crypto backend (OpenSSL). Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/tests/crypt_test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/lib/tests/crypt_test.c') diff --git a/src/lib/tests/crypt_test.c b/src/lib/tests/crypt_test.c index 50b7268a..88c9634a 100644 --- a/src/lib/tests/crypt_test.c +++ b/src/lib/tests/crypt_test.c @@ -364,6 +364,22 @@ static int test_crypt_aad_tamper(int nid) goto fail_rx; } + enc.data[5] ^= 0x01; + + if (crypt_decrypt(rx, enc, &dec) < 0) { + printf("Decryption failed after a rejected packet.\n"); + freebuf(enc); + goto fail_rx; + } + + if (dec.len != in.len || memcmp(dec.data, in.data, in.len) != 0) { + printf("Decrypted data mismatch after rejection.\n"); + freebuf(dec); + freebuf(enc); + goto fail_rx; + } + + freebuf(dec); freebuf(enc); crypt_destroy_ctx(rx); -- cgit v1.2.3