Skip to content
Snippets Groups Projects
Commit 02cedc0c authored by Cédric Roux's avatar Cédric Roux
Browse files

nr pdcp: bugfix: better nettle version detection

This fix may fail to work.

we should stop supporting old versions of nettle at some point.
parent e26c1f6f
No related branches found
No related tags found
4 merge requests!1757Draft: Use pMAX value in configuration file, instead of hardcoded '23' in asn1_msg.c,!1493fix DL arq errors in UE,!1181Integration 2021 wk23,!1168Nr pdcp small bugfixes
...@@ -27,12 +27,21 @@ ...@@ -27,12 +27,21 @@
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
#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 <nettle/bignum.h>
#endif
void *nr_pdcp_security_nea2_init(unsigned char *ciphering_key) void *nr_pdcp_security_nea2_init(unsigned char *ciphering_key)
{ {
void *ctx = calloc(1, nettle_aes128.context_size); void *ctx = calloc(1, nettle_aes128.context_size);
if (ctx == NULL) exit(1); 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); nettle_aes128.set_encrypt_key(ctx, 16, ciphering_key);
#else #else
nettle_aes128.set_encrypt_key(ctx, ciphering_key); nettle_aes128.set_encrypt_key(ctx, ciphering_key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment