Commit 02cedc0c authored by Cedric Roux's avatar Cedric Roux

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
...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment