mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-06-05 21:15:09 +00:00
Merge pull request #289 from gilles-peskine-arm/iar-1.1.0-framework
IAR build fixes before 1.1.0/4.1.0/3.6.6: framework support
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
#ifndef TEST_ARGUMENTS_H
|
#ifndef TEST_ARGUMENTS_H
|
||||||
#define TEST_ARGUMENTS_H
|
#define TEST_ARGUMENTS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifndef ASN1_HELPERS_H
|
#ifndef ASN1_HELPERS_H
|
||||||
#define ASN1_HELPERS_H
|
#define ASN1_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
#include "test/helpers.h"
|
#include "test/helpers.h"
|
||||||
|
|
||||||
/** Skip past an INTEGER in an ASN.1 buffer.
|
/** Skip past an INTEGER in an ASN.1 buffer.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#ifndef BIGNUM_CODEPATH_CHECK_H
|
#ifndef BIGNUM_CODEPATH_CHECK_H
|
||||||
#define BIGNUM_CODEPATH_CHECK_H
|
#define BIGNUM_CODEPATH_CHECK_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#include "bignum_core.h"
|
#include "bignum_core.h"
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#ifndef TEST_BIGNUM_HELPERS_H
|
#ifndef TEST_BIGNUM_HELPERS_H
|
||||||
#define TEST_BIGNUM_HELPERS_H
|
#define TEST_BIGNUM_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_BIGNUM_C)
|
#if defined(MBEDTLS_BIGNUM_C)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* \file test/build_info.h
|
||||||
|
*
|
||||||
|
* \brief Common things for all Mbed TLS and TF-PSA-Crypto test headers.
|
||||||
|
*
|
||||||
|
* Include this header first in all headers in `include/test/`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright The Mbed TLS Contributors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEST_BUILD_INFO_H
|
||||||
|
#define TEST_BUILD_INFO_H
|
||||||
|
|
||||||
|
#include <mbedtls/build_info.h>
|
||||||
|
|
||||||
|
/* Most fields of publicly available structs are private and are wrapped with
|
||||||
|
* MBEDTLS_PRIVATE macro. This define allows tests to access the private fields
|
||||||
|
* directly (without using the MBEDTLS_PRIVATE wrapper). */
|
||||||
|
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
||||||
|
|
||||||
|
#endif /* TEST_BUILD_INFO_H */
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef TEST_CONSTANT_FLOW_H
|
#ifndef TEST_CONSTANT_FLOW_H
|
||||||
#define TEST_CONSTANT_FLOW_H
|
#define TEST_CONSTANT_FLOW_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file defines the two macros
|
* This file defines the two macros
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#ifndef FAKE_EXTERNAL_RNG_FOR_TEST_H
|
#ifndef FAKE_EXTERNAL_RNG_FOR_TEST_H
|
||||||
#define FAKE_EXTERNAL_RNG_FOR_TEST_H
|
#define FAKE_EXTERNAL_RNG_FOR_TEST_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||||
/** Enable the insecure implementation of mbedtls_psa_external_get_random().
|
/** Enable the insecure implementation of mbedtls_psa_external_get_random().
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#ifndef TEST_HELPERS_H
|
#ifndef TEST_HELPERS_H
|
||||||
#define TEST_HELPERS_H
|
#define TEST_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined(__SANITIZE_ADDRESS__) /* gcc -fsanitize=address */
|
#if defined(__SANITIZE_ADDRESS__) /* gcc -fsanitize=address */
|
||||||
# define MBEDTLS_TEST_HAVE_ASAN
|
# define MBEDTLS_TEST_HAVE_ASAN
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef TEST_MACROS_H
|
#ifndef TEST_MACROS_H
|
||||||
#define TEST_MACROS_H
|
#define TEST_MACROS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef TEST_MEMORY_H
|
#ifndef TEST_MEMORY_H
|
||||||
#define TEST_MEMORY_H
|
#define TEST_MEMORY_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#include "test/helpers.h"
|
#include "test/helpers.h"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#ifndef PK_HELPERS_H
|
#ifndef PK_HELPERS_H
|
||||||
#define PK_HELPERS_H
|
#define PK_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PK_C)
|
#if defined(MBEDTLS_PK_C)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#ifndef PSA_CRYPTO_HELPERS_H
|
#ifndef PSA_CRYPTO_HELPERS_H
|
||||||
#define PSA_CRYPTO_HELPERS_H
|
#define PSA_CRYPTO_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
#include "test/helpers.h"
|
#include "test/helpers.h"
|
||||||
|
|
||||||
#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
|
#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#ifndef PSA_EXERCISE_KEY_H
|
#ifndef PSA_EXERCISE_KEY_H
|
||||||
#define PSA_EXERCISE_KEY_H
|
#define PSA_EXERCISE_KEY_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
#include "test/helpers.h"
|
#include "test/helpers.h"
|
||||||
#include "test/psa_crypto_helpers.h"
|
#include "test/psa_crypto_helpers.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#ifndef PSA_HELPERS_H
|
#ifndef PSA_HELPERS_H
|
||||||
#define PSA_HELPERS_H
|
#define PSA_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
|
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
|
||||||
#include "spm/psa_defs.h"
|
#include "spm/psa_defs.h"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#ifndef PSA_MEMORY_POISONING_WRAPPERS_H
|
#ifndef PSA_MEMORY_POISONING_WRAPPERS_H
|
||||||
#define PSA_MEMORY_POISONING_WRAPPERS_H
|
#define PSA_MEMORY_POISONING_WRAPPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#ifndef TEST_RANDOM_H
|
#ifndef TEST_RANDOM_H
|
||||||
#define TEST_RANDOM_H
|
#define TEST_RANDOM_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#ifndef THREADING_HELPERS_H
|
#ifndef THREADING_HELPERS_H
|
||||||
#define THREADING_HELPERS_H
|
#define THREADING_HELPERS_H
|
||||||
|
|
||||||
#include "test_common.h"
|
#include "build_info.h"
|
||||||
|
|
||||||
#if defined MBEDTLS_THREADING_C
|
#if defined MBEDTLS_THREADING_C
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include "test/bignum_codepath_check.h"
|
#include "test/bignum_codepath_check.h"
|
||||||
#include "bignum_core_invasive.h"
|
#include "bignum_core_invasive.h"
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <test/bignum_helpers.h>
|
#include <test/bignum_helpers.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_BIGNUM_C)
|
#if defined(MBEDTLS_BIGNUM_C)
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <test/fake_external_rng_for_test.h>
|
#include <test/fake_external_rng_for_test.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
|
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <test/constant_flow.h>
|
#include <test/constant_flow.h>
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/pk_helpers.h>
|
#include <test/pk_helpers.h>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <psa_crypto_slot_management.h>
|
#include <psa_crypto_slot_management.h>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <test/psa_exercise_key.h>
|
#include <test/psa_exercise_key.h>
|
||||||
@@ -37,6 +38,15 @@
|
|||||||
#include <rsa_internal.h>
|
#include <rsa_internal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
/* Suppress a very overeager warning from IAR: it dislikes a forward goto
|
||||||
|
* that bypasses the initialization of a variable, even if that variable
|
||||||
|
* is not used after the jump. (This is perfectly valid C; it would only
|
||||||
|
* be invalid C if jumping into a block from outside that block.)
|
||||||
|
*/
|
||||||
|
#pragma diag_suppress=Pe546 // transfer of control bypasses initialization
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||||
static int lifetime_is_dynamic_secure_element(psa_key_lifetime_t lifetime)
|
static int lifetime_is_dynamic_secure_element(psa_key_lifetime_t lifetime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
* Copyright The Mbed TLS Contributors
|
* Copyright The Mbed TLS Contributors
|
||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
#include "test_common.h"
|
||||||
|
|
||||||
#include <test/memory.h>
|
#include <test/memory.h>
|
||||||
#include <test/psa_memory_poisoning_wrappers.h>
|
#include <test/psa_memory_poisoning_wrappers.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <test/random.h>
|
#include <test/random.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
*
|
*
|
||||||
* \brief Common things for all Mbed TLS and TF-PSA-Crypto test code.
|
* \brief Common things for all Mbed TLS and TF-PSA-Crypto test code.
|
||||||
*
|
*
|
||||||
* Include this header first in all headers in `include/test/`.
|
* Include this header first in all test C files.
|
||||||
* Include this or another header from `include/test/` in all test C files.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -24,11 +23,14 @@
|
|||||||
#define __USE_MINGW_ANSI_STDIO 1
|
#define __USE_MINGW_ANSI_STDIO 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mbedtls/build_info.h>
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
/* With IAR, enable support for ::FILE functions in stdio.h.
|
||||||
|
*/
|
||||||
|
#define _DLIB_FILE_DESCRIPTOR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Most fields of publicly available structs are private and are wrapped with
|
/* Make sure we have the library configuration, and anything else that
|
||||||
* MBEDTLS_PRIVATE macro. This define allows tests to access the private fields
|
* is deemed necessary in test headers. */
|
||||||
* directly (without using the MBEDTLS_PRIVATE wrapper). */
|
#include <test/build_info.h>
|
||||||
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
|
|
||||||
|
|
||||||
#endif /* TEST_TEST_COMMON_H */
|
#endif /* TEST_TEST_COMMON_H */
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <test/memory.h>
|
#include <test/memory.h>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "test_common.h"
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/threading_helpers.h>
|
#include <test/threading_helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user