Skip to content

Commit 5029b5a

Browse files
committed
Add components configuration platform to TF-PSA-Crypto
This commit adds multiple configurations to TF-PSA-Crypto similar to those found in Mbed TLS. Signed-off-by: Harry Ramsey <[email protected]>
1 parent d6031a2 commit 5029b5a

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# components-configuration-platform.sh
2+
#
3+
# Copyright The Mbed TLS Contributors
4+
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
5+
6+
# This file contains test components that are executed by all.sh
7+
8+
################################################################
9+
#### Configuration Testing - Platform
10+
################################################################
11+
12+
component_tf_psa_crypto_build_no_std_function () {
13+
# catch compile bugs in _uninit functions
14+
msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
15+
scripts/config.py full
16+
scripts/config.py set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
17+
scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
18+
scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT
19+
20+
cd $OUT_OF_SOURCE_DIR
21+
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
22+
make
23+
}
24+
25+
component_tf_psa_crypto_test_no_date_time () {
26+
msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
27+
scripts/config.py unset MBEDTLS_HAVE_TIME_DATE
28+
cd $OUT_OF_SOURCE_DIR
29+
cmake -DCMAKE_BUILD_TYPE:String=Check $TF_PSA_CRYPTO_ROOT_DIR
30+
make
31+
32+
msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
33+
make test
34+
}
35+
36+
component_tf_psa_crypto_test_platform_calloc_macro () {
37+
msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
38+
scripts/config.py set MBEDTLS_PLATFORM_MEMORY
39+
scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc
40+
scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free
41+
cd $OUT_OF_SOURCE_DIR
42+
cmake -DCMAKE_C_COMPILER=$ASAN_CC -DCMAKE_BUILD_TYPE:String=Asan -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
43+
make
44+
45+
msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
46+
make test
47+
}
48+
49+
component_tf_psa_crypto_test_have_int32 () {
50+
msg "build: gcc, force 32-bit bignum limbs"
51+
scripts/config.py unset MBEDTLS_HAVE_ASM
52+
scripts/config.py unset MBEDTLS_AESNI_C
53+
scripts/config.py unset MBEDTLS_AESCE_C
54+
cd $OUT_OF_SOURCE_DIR
55+
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
56+
make
57+
58+
msg "test: gcc, force 32-bit bignum limbs"
59+
make test
60+
}
61+
62+
component_tf_psa_crypto_test_have_int64 () {
63+
msg "build: gcc, force 64-bit bignum limbs"
64+
scripts/config.py unset MBEDTLS_HAVE_ASM
65+
scripts/config.py unset MBEDTLS_AESNI_C
66+
scripts/config.py unset MBEDTLS_AESCE_C
67+
cd $OUT_OF_SOURCE_DIR
68+
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS="-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64" -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
69+
make
70+
71+
msg "test: gcc, force 64-bit bignum limbs"
72+
make test
73+
}
74+
75+
component_tf_psa_crypto_test_have_int32_cmake_new_bignum () {
76+
msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
77+
scripts/config.py unset MBEDTLS_HAVE_ASM
78+
scripts/config.py unset MBEDTLS_AESNI_C
79+
scripts/config.py unset MBEDTLS_AESCE_C
80+
scripts/config.py set MBEDTLS_TEST_HOOKS
81+
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
82+
cd $OUT_OF_SOURCE_DIR
83+
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" -DCMAKE_EXE_LINKER_FLAGS="$ASAN_CFLAGS" -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
84+
make
85+
86+
msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
87+
make test
88+
}
89+
90+
component_tf_psa_crypto_test_no_udbl_division () {
91+
msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
92+
scripts/config.py full
93+
scripts/config.py set MBEDTLS_NO_UDBL_DIVISION
94+
cd $OUT_OF_SOURCE_DIR
95+
cmake -DCMAKE_C_FLAGS='-Werror -O1' -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
96+
make
97+
98+
msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
99+
make test
100+
}
101+
102+
component_tf_psa_crypto_test_no_64bit_multiplication () {
103+
msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
104+
scripts/config.py full
105+
scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
106+
cd $OUT_OF_SOURCE_DIR
107+
cmake -DCMAKE_C_FLAGS='-Werror -O1' -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON "$TF_PSA_CRYPTO_ROOT_DIR"
108+
make
109+
110+
msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
111+
make test
112+
}

0 commit comments

Comments
 (0)