From 02cedc0ca16c9baceae368aacbb16cb2a5b70f7d Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Sat, 22 May 2021 12:49:05 +0200 Subject: [PATCH] nr pdcp: bugfix: better nettle version detection This fix may fail to work. we should stop supporting old versions of nettle at some point. --- openair2/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c index fc07f661dd..52afe95673 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c @@ -27,12 +27,21 @@ #include #include +#ifndef NETTLE_VERSION_MAJOR +/* hack: include bignum.h, not version.h because version.h does not exist + * in old versions and bignum.h includes version.h (as of today). + * May completely fail to work... maybe we should skip support of old + * versions of nettle. + */ +#include +#endif + void *nr_pdcp_security_nea2_init(unsigned char *ciphering_key) { void *ctx = calloc(1, nettle_aes128.context_size); if (ctx == NULL) exit(1); -#if NETTLE_VERSION_MAJOR < 3 +#if !defined(NETTLE_VERSION_MAJOR) || NETTLE_VERSION_MAJOR < 3 nettle_aes128.set_encrypt_key(ctx, 16, ciphering_key); #else nettle_aes128.set_encrypt_key(ctx, ciphering_key);