Commit d31634c3 authored by laurent's avatar laurent
Browse files

fix nettle

parent 59d0cf1c
...@@ -1669,18 +1669,6 @@ endif() ...@@ -1669,18 +1669,6 @@ endif()
message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}")
string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION})
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION})
message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}")
message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}")
if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "")
message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" )
endif()
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
pkg_search_module(XPM xpm) pkg_search_module(XPM xpm)
if(NOT ${XPM_FOUND}) if(NOT ${XPM_FOUND})
message("PACKAGE xpm not found: some targets will fail") message("PACKAGE xpm not found: some targets will fail")
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <nettle/nettle-meta.h> #include <nettle/nettle-meta.h>
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
#include <nettle/bignum.h>
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
...@@ -191,7 +192,7 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out) ...@@ -191,7 +192,7 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out)
} }
#endif #endif
#if NETTLE_VERSION_MAJOR < 3 #if !defined(NETTLE_VERSION_MAJOR) || NETTLE_VERSION_MAJOR < 3
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length, nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
stream_cipher->key); stream_cipher->key);
#else #else
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <nettle/nettle-meta.h> #include <nettle/nettle-meta.h>
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
#include <nettle/bignum.h>
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
...@@ -78,7 +79,7 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out) ...@@ -78,7 +79,7 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out)
} }
#endif #endif
#if NETTLE_VERSION_MAJOR < 3 #if !defined(NETTLE_VERSION_MAJOR) || NETTLE_VERSION_MAJOR < 3
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length, nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
stream_cipher->key); stream_cipher->key);
#else #else
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <nettle/nettle-meta.h> #include <nettle/nettle-meta.h>
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
#include <nettle/bignum.h>
static static
void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key, void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key,
...@@ -41,7 +42,7 @@ void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key, ...@@ -41,7 +42,7 @@ void test_uncipher_ctr(const struct nettle_cipher *cipher, const uint8_t *key,
uint8_t *data = malloc(length); uint8_t *data = malloc(length);
uint8_t *ctr = malloc(cipher->block_size); uint8_t *ctr = malloc(cipher->block_size);
#if NETTLE_VERSION_MAJOR < 3 #if !defined(NETTLE_VERSION_MAJOR) || NETTLE_VERSION_MAJOR < 3
cipher->set_encrypt_key(ctx, key_length, key); cipher->set_encrypt_key(ctx, key_length, key);
#else #else
cipher->set_encrypt_key(ctx, key); cipher->set_encrypt_key(ctx, 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