diff --git a/openair2/UTIL/OSA/osa_stream_eea.c b/openair2/UTIL/OSA/osa_stream_eea.c
index 08e0d44441379849fbcf2c6f72a45d429ce9be64..17020bf7de1c08f5545d11a31dc8f3d29a316f8f 100644
--- a/openair2/UTIL/OSA/osa_stream_eea.c
+++ b/openair2/UTIL/OSA/osa_stream_eea.c
@@ -199,7 +199,7 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out)
   }
 #endif
 
-#if NETTLE_VERSION <= 27
+#if NETTLE_VERSION_MAJOR < 3
   nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
                                 stream_cipher->key);
 #else
diff --git a/openair3/SECU/nas_stream_eea2.c b/openair3/SECU/nas_stream_eea2.c
index df3a1ed82c1ea424a1487cc7e2c08e63e6eb86aa..14ab5c3b73218bae72a3fa079009692dd31388c5 100644
--- a/openair3/SECU/nas_stream_eea2.c
+++ b/openair3/SECU/nas_stream_eea2.c
@@ -85,7 +85,7 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out)
   }
 #endif
 
-#if NETTLE_VERSION <= 27
+#if NETTLE_VERSION_MAJOR < 3
   nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
                                 stream_cipher->key);
 #else