summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-07-10 17:09:58 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-07-19 11:44:35 +0200
commit669383b4afac1f0a72c3c1106f1b6d61abc16e78 (patch)
tree4e3fd893664f544149960e061ed484cd08b46d02
parentaa28f5bf5bd92e69c0e89a1a36c7c95f28b7057c (diff)
downloadouroboros-669383b4afac1f0a72c3c1106f1b6d61abc16e78.tar.gz
ouroboros-669383b4afac1f0a72c3c1106f1b6d61abc16e78.zip
lib: Fix crypt_test without crypto backend
Creating a context without OpenSSL fails (returns NULL) after adding the key rotation logic (requires HKDF). Assert instead that context creation returns NULL without OpenSSL. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/lib/tests/crypt_test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/tests/crypt_test.c b/src/lib/tests/crypt_test.c
index f00618d8..50b7268a 100644
--- a/src/lib/tests/crypt_test.c
+++ b/src/lib/tests/crypt_test.c
@@ -51,12 +51,20 @@ static int test_crypt_create_destroy(void)
memset(key, 0, sizeof(key));
ctx = crypt_create_ctx(&sk);
+#ifdef HAVE_OPENSSL
if (ctx == NULL) {
printf("Failed to initialize cryptography.\n");
goto fail;
}
crypt_destroy_ctx(ctx);
+#else
+ if (ctx != NULL) {
+ printf("Created cipher context without a backend.\n");
+ crypt_destroy_ctx(ctx);
+ goto fail;
+ }
+#endif
TEST_SUCCESS();