From 59d0cf1c5477bb6cc5d2b2d9094e52e60b3bc8d9 Mon Sep 17 00:00:00 2001 From: LTS Date: Tue, 3 Jan 2017 14:26:17 +0100 Subject: [PATCH 1/2] fix T macro calls --- common/utils/T/T.h | 12 ------------ targets/RT/USER/lte-ue.c | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 819615131e..bd090ac221 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -188,12 +188,6 @@ extern T_cache_t *T_cache; #define T_HEADER(x) \ do { \ - if (!__builtin_types_compatible_p(typeof(x), struct T_header *)) { \ - printf("%s:%d:%s: " \ - "bad use of T, pass a message ID as first parameter\n", \ - __FILE__, __LINE__, __FUNCTION__); \ - abort(); \ - } \ struct timespec T_HEADER_time; \ if (clock_gettime(CLOCK_REALTIME, &T_HEADER_time)) abort(); \ memcpy(T_LOCAL_buf, &T_HEADER_time, sizeof(struct timespec)); \ @@ -205,12 +199,6 @@ extern T_cache_t *T_cache; #define T_HEADER(x) \ do { \ - if (!__builtin_types_compatible_p(typeof(x), struct T_header *)) { \ - printf("%s:%d:%s: " \ - "bad use of T, pass a message ID as first parameter\n", \ - __FILE__, __LINE__, __FUNCTION__); \ - abort(); \ - } \ T_PUT_int(1, (int)(uintptr_t)(x)); \ } while (0) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index b398d5127e..cfd4296755 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -642,7 +642,7 @@ static void *UE_thread_rxn_txnp4(void *arg) { AssertFatal(pthread_mutex_lock(&proc->mutex_rxtx) ==0,""); pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx ); if ( (instance_cnt_rxtx+proc->sub_frame_step)%10 != proc->subframe_rx && instance_cnt_rxtx!=-1 ) - LOG_W(PHY,"REAL TIME NOT MATCHED: missed a sub-frame: expecting %d, got %d\n", + LOG_W(PHY,"REAL TIME NOT MATCHED: missed a sub-frame: expecting %lld, got %d\n", (instance_cnt_rxtx+proc->sub_frame_step)%10, proc->subframe_rx); instance_cnt_rxtx=proc->subframe_rx; AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); From d31634c358f35548f14daf1645268a741d21b371 Mon Sep 17 00:00:00 2001 From: laurent Date: Sat, 7 Jan 2017 08:23:50 +0100 Subject: [PATCH 2/2] fix nettle --- cmake_targets/CMakeLists.txt | 12 ------------ openair2/UTIL/OSA/osa_stream_eea.c | 3 ++- openair3/SECU/nas_stream_eea2.c | 3 ++- openair3/TEST/test_aes128_ctr_decrypt.c | 3 ++- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 81ddf37503..4f40486801 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1669,18 +1669,6 @@ endif() 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) if(NOT ${XPM_FOUND}) message("PACKAGE xpm not found: some targets will fail") diff --git a/openair2/UTIL/OSA/osa_stream_eea.c b/openair2/UTIL/OSA/osa_stream_eea.c index 6aef6d2588..9e8a3a88b3 100644 --- a/openair2/UTIL/OSA/osa_stream_eea.c +++ b/openair2/UTIL/OSA/osa_stream_eea.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "UTIL/LOG/log.h" @@ -191,7 +192,7 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out) } #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, stream_cipher->key); #else diff --git a/openair3/SECU/nas_stream_eea2.c b/openair3/SECU/nas_stream_eea2.c index 37f2e298fb..e9f2e7c41a 100644 --- a/openair3/SECU/nas_stream_eea2.c +++ b/openair3/SECU/nas_stream_eea2.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "assertions.h" #include "conversions.h" @@ -78,7 +79,7 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out) } #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, stream_cipher->key); #else diff --git a/openair3/TEST/test_aes128_ctr_decrypt.c b/openair3/TEST/test_aes128_ctr_decrypt.c index a30dc6c2f2..98987a8d97 100644 --- a/openair3/TEST/test_aes128_ctr_decrypt.c +++ b/openair3/TEST/test_aes128_ctr_decrypt.c @@ -31,6 +31,7 @@ #include #include #include +#include static 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 *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); #else cipher->set_encrypt_key(ctx, key);