diff --git a/openair3/TEST/test_aes128_ctr_decrypt.c b/openair3/TEST/test_aes128_ctr_decrypt.c
index 209ce8977a2946fde8364270043a7afb49133c0d..15416c5e4bb6f8646c5170cc0c21908ac04eeed7 100644
--- a/openair3/TEST/test_aes128_ctr_decrypt.c
+++ b/openair3/TEST/test_aes128_ctr_decrypt.c
@@ -48,7 +48,12 @@ void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key,
   uint8_t *data = malloc(length);
   uint8_t *ctr = malloc(cipher->block_size);
 
+#if NETTLE_VERSION <= 27
   cipher->set_encrypt_key(ctx, key_length,  key);
+#else
+  cipher->set_encrypt_key(ctx,  key);
+#endif
+
   memcpy(ctr, ictr, cipher->block_size);
 
   ctr_crypt(ctx, cipher->encrypt,
diff --git a/openair3/TEST/test_aes128_ctr_encrypt.c b/openair3/TEST/test_aes128_ctr_encrypt.c
index a089ac549dab386400c6da27341ccf6d4ff47f90..dab80b3602a362ae0a635ff8e077137cc39298db 100644
--- a/openair3/TEST/test_aes128_ctr_encrypt.c
+++ b/openair3/TEST/test_aes128_ctr_encrypt.c
@@ -47,7 +47,12 @@ static void test_cipher_ctr(const struct nettle_cipher *cipher, const uint8_t *k
   uint8_t *data = malloc(length);
   uint8_t *ctr = malloc(cipher->block_size);
 
+#if NETTLE_VERSION <= 27
   cipher->set_encrypt_key(ctx, key_length, key);
+#else
+  cipher->set_encrypt_key(ctx, key);
+#endif
+
   memcpy(ctr, ictr, cipher->block_size);
 
   ctr_crypt(ctx, cipher->encrypt,