Support for PC platform (#12)
* improvements for cross-platform compiling * moved tactility-core to libs/ * splitup improvements * remove git/gitmodules from freertos * better platformbetter platform checks * added build scripts * delete mbedtls * re-add mbedtls * fixes and improvements * added pc build * simplify build scripts * revert build scrpit * updated builds * fix for pc * fix for pc * fix for build
This commit is contained in:
committed by
GitHub
parent
c830c66063
commit
a94baf0d00
@@ -0,0 +1,31 @@
|
||||
/* MBEDTLS_USER_CONFIG_FILE for testing.
|
||||
* Only used for a few test configurations.
|
||||
*
|
||||
* Typical usage (note multiple levels of quoting):
|
||||
* make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* Enable TLS 1.3 and core 1.3 features */
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_3
|
||||
#define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
|
||||
/* Disable TLS 1.2 and 1.2-specific features */
|
||||
#undef MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#undef MBEDTLS_SSL_RENEGOTIATION
|
||||
#undef MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#undef MBEDTLS_SSL_PROTO_DTLS
|
||||
#undef MBEDTLS_SSL_DTLS_ANTI_REPLAY
|
||||
#undef MBEDTLS_SSL_DTLS_HELLO_VERIFY
|
||||
#undef MBEDTLS_SSL_DTLS_SRTP
|
||||
#undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
|
||||
#undef MBEDTLS_SSL_DTLS_CONNECTION_ID
|
||||
#undef MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT
|
||||
|
||||
/* Enable some invasive tests */
|
||||
#define MBEDTLS_TEST_HOOKS
|
||||
@@ -0,0 +1,89 @@
|
||||
/* MBEDTLS_USER_CONFIG_FILE for testing.
|
||||
* Only used for a few test configurations.
|
||||
*
|
||||
* Typical usage (note multiple levels of quoting):
|
||||
* make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST_ALL)
|
||||
/* PSA_CRYPTO_DRIVER_TEST_ALL activates test drivers while keeping the
|
||||
* built-in implementations active. Normally setting MBEDTLS_PSA_ACCEL_xxx
|
||||
* would disable MBEDTLS_PSA_BUILTIN_xxx unless fallback is activated, but
|
||||
* here we arrange to have both active so that psa_crypto_*.c includes
|
||||
* the built-in implementations and the driver code can call the built-in
|
||||
* implementations.
|
||||
*
|
||||
* The point of this test mode is to verify that the
|
||||
* driver entry points are called when they should be in a lightweight
|
||||
* way, without requiring an actual driver. This is different from builds
|
||||
* with libtestdriver1, where we make a copy of the library source code
|
||||
* and use that as an external driver.
|
||||
*/
|
||||
|
||||
/* Enable the use of the test driver in the library, and build the generic
|
||||
* part of the test driver. */
|
||||
#define PSA_CRYPTO_DRIVER_TEST
|
||||
|
||||
/* With MBEDTLS_PSA_CRYPTO_CONFIG, if we set up the acceleration, the
|
||||
* built-in implementations won't be enabled. */
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
|
||||
#error \
|
||||
"PSA_CRYPTO_DRIVER_TEST_ALL sets up a nonstandard configuration that is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG"
|
||||
#endif
|
||||
|
||||
/* Use the accelerator driver for all cryptographic mechanisms for which
|
||||
* the test driver implemented. */
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CTR
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CFB
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_MD5
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_OFB
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_224
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_256
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_384
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_512
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_XTS
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CMAC
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HMAC
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST_ALL */
|
||||
|
||||
|
||||
|
||||
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
|
||||
/* The #MBEDTLS_PSA_INJECT_ENTROPY feature requires two extra platform
|
||||
* functions, which must be configured as #MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
|
||||
* and #MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO. The job of these functions
|
||||
* is to read and write from the entropy seed file, which is located
|
||||
* in the PSA ITS file whose uid is #PSA_CRYPTO_ITS_RANDOM_SEED_UID.
|
||||
* (These could have been provided as library functions, but for historical
|
||||
* reasons, they weren't, and so each integrator has to provide a copy
|
||||
* of these functions.)
|
||||
*
|
||||
* Provide implementations of these functions for testing. */
|
||||
#include <stddef.h>
|
||||
int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len);
|
||||
int mbedtls_test_inject_entropy_seed_write(unsigned char *buf, size_t len);
|
||||
#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_test_inject_entropy_seed_read
|
||||
#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_test_inject_entropy_seed_write
|
||||
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
|
||||
@@ -0,0 +1,22 @@
|
||||
/* mbedtls_config.h modifier that forces calloc(0) to return NULL.
|
||||
* Used for testing.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MBEDTLS_PLATFORM_STD_CALLOC
|
||||
static inline void *custom_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
if (nmemb == 0 || size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return calloc(nmemb, size);
|
||||
}
|
||||
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
/* mbedtls_config.h modifier that defines mbedtls_platform_zeroize() to be
|
||||
* memset(), so that the compile can check arguments for us.
|
||||
* Used for testing.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Define _ALT so we don't get the built-in implementation. The test code will
|
||||
* also need to define MBEDTLS_TEST_DEFINES_ZEROIZE so we don't get the
|
||||
* declaration. */
|
||||
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
|
||||
|
||||
#define mbedtls_platform_zeroize(buf, len) memset(buf, 0, len)
|
||||
Reference in New Issue
Block a user