Skip to content

Commit b47c583

Browse files
author
Mika Leppänen
committed
Added check for MBEDTLS_NIST_KW_C flag to nist KW module
This prevents build errors if old version of mbed TLS that does not have NIST KW is used.
1 parent 2be2634 commit b47c583

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

source/Service_Libs/nist_aes_kw/nist_aes_kw.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@
2020
#include "ns_types.h"
2121
#include "ns_list.h"
2222
#include "ns_trace.h"
23-
#if defined(HAVE_WS) && (defined(HAVE_PAE_SUPP) || defined(HAVE_PAE_AUTH))
23+
24+
#if !defined(MBEDTLS_CONFIG_FILE)
25+
#include "mbedtls/config.h"
26+
#else
27+
#include MBEDTLS_CONFIG_FILE
28+
#endif
29+
30+
#if defined(MBEDTLS_NIST_KW_C) && defined(HAVE_WS) && (defined(HAVE_PAE_SUPP) || defined(HAVE_PAE_AUTH))
2431
#include "mbedtls/nist_kw.h"
2532
#endif
33+
2634
#include "Service_Libs/nist_aes_kw/nist_aes_kw.h"
2735

2836
#ifdef HAVE_WS
@@ -31,7 +39,7 @@
3139

3240
int8_t nist_aes_key_wrap(uint8_t is_wrap, const uint8_t *key, int16_t key_bits, const uint8_t *input, size_t input_len, uint8_t *output, size_t *output_len)
3341
{
34-
#if defined(HAVE_PAE_SUPP) || defined(HAVE_PAE_AUTH)
42+
#if defined(MBEDTLS_NIST_KW_C) && (defined(HAVE_PAE_SUPP) || defined(HAVE_PAE_AUTH))
3543

3644
int8_t ret_val = 0;
3745
mbedtls_nist_kw_context ctx;

test/nanostack/unittest/service_libs/nist_aes_kw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ TEST_SRC_FILES = \
1515

1616
include ../../MakefileWorker.mk
1717

18-
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DEXTRA_CONSISTENCY_CHECKS
18+
CPPUTESTFLAGS += -DFEA_TRACE_SUPPORT -DEXTRA_CONSISTENCY_CHECKS -DMBEDTLS_NIST_KW_C
1919

0 commit comments

Comments
 (0)