From f60b67a6fcbed7329f7d27511e8c572dc252934e Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 23 Jan 2026 18:45:34 +0100 Subject: lib: Speed up key rotation tests The tests were not correct as the library was compiled with the default 1 << 20 epoch. Added a parametere to the sk configuration that specifies the epoch size. Set to 1 << KEY_ROTATION_BIT in dev.c, but lowered to 7 in unit tests. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/crypt/openssl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/lib/crypt/openssl.c') diff --git a/src/lib/crypt/openssl.c b/src/lib/crypt/openssl.c index 13ed1c64..b8233593 100644 --- a/src/lib/crypt/openssl.c +++ b/src/lib/crypt/openssl.c @@ -1093,6 +1093,7 @@ struct ossl_crypt_ctx * openssl_crypt_create_ctx(struct crypt_sk * sk) assert(sk != NULL); assert(sk->key != NULL); + assert(sk->rot_bit > 0 && sk->rot_bit < 32); ctx = malloc(sizeof(*ctx)); if (ctx == NULL) @@ -1124,11 +1125,7 @@ struct ossl_crypt_ctx * openssl_crypt_create_ctx(struct crypt_sk * sk) ctx->tagsz = 16; /* Standard AEAD tag length (128 bits) */ ctx->rot.cntr = 0; -#ifdef TEST_KEY_ROTATION_BIT - ctx->rot.mask = (1U << TEST_KEY_ROTATION_BIT); -#else - ctx->rot.mask = (1U << KEY_ROTATION_BIT); -#endif + ctx->rot.mask = (1U << sk->rot_bit); ctx->rot.age = 0; ctx->rot.phase = 0; -- cgit v1.2.3