blob: ade207a650cf52a0c0edd0486afce877ed915b42 [file] [log] [blame]
Minos Galanakisada21b02024-07-26 12:34:19 +01001# 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
Minos Galanakis609f7492024-07-31 16:39:28 +01006# This file contains test components that are executed by all.sh
Minos Galanakisada21b02024-07-26 12:34:19 +01007
8################################################################
9#### Configuration Testing - Platform
10################################################################
Minos Galanakisf6e1adc2024-07-26 15:42:20 +010011
12component_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 CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check .
20 make
21}
22
Valerio Setti1afedac2025-05-06 06:27:02 +020023component_test_platform_get_entropy_alt()
24{
25 msg "build: default config + MBEDTLS_PLATFORM_GET_ENTROPY_ALT"
26 # Use hardware polling as the only source for entropy
27 scripts/config.py set MBEDTLS_PLATFORM_GET_ENTROPY_ALT
28 scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
29
30 make
31
32 # Run all the tests
33 msg "test: default config + MBEDTLS_PLATFORM_GET_ENTROPY_ALT"
34 make test
35}
36
Minos Galanakisf6e1adc2024-07-26 15:42:20 +010037component_build_no_sockets () {
38 # Note, C99 compliance can also be tested with the sockets support disabled,
39 # as that requires a POSIX platform (which isn't the same as C99).
40 msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s
41 scripts/config.py full
42 scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc.
Valerio Setti73bd2102025-04-15 08:56:51 +020043 scripts/config.py set MBEDTLS_PLATFORM_GET_ENTROPY_ALT # prevent syscall() on GNU/Linux
Minos Galanakisf6e1adc2024-07-26 15:42:20 +010044 make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib
45}
46
47component_test_no_date_time () {
48 msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
49 scripts/config.py unset MBEDTLS_HAVE_TIME_DATE
50 cmake -D CMAKE_BUILD_TYPE:String=Check .
51 make
52
53 msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
54 make test
55}
56
57component_test_platform_calloc_macro () {
58 msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
59 scripts/config.py set MBEDTLS_PLATFORM_MEMORY
60 scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc
61 scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free
62 CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
63 make
64
65 msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
66 make test
67}
68
69component_test_have_int32 () {
70 msg "build: gcc, force 32-bit bignum limbs"
71 scripts/config.py unset MBEDTLS_HAVE_ASM
72 scripts/config.py unset MBEDTLS_AESNI_C
73 scripts/config.py unset MBEDTLS_AESCE_C
74 make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32'
75
76 msg "test: gcc, force 32-bit bignum limbs"
77 make test
78}
79
80component_test_have_int64 () {
81 msg "build: gcc, force 64-bit bignum limbs"
82 scripts/config.py unset MBEDTLS_HAVE_ASM
83 scripts/config.py unset MBEDTLS_AESNI_C
84 scripts/config.py unset MBEDTLS_AESCE_C
85 make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64'
86
87 msg "test: gcc, force 64-bit bignum limbs"
88 make test
89}
90
91component_test_have_int32_cmake_new_bignum () {
92 msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
93 scripts/config.py unset MBEDTLS_HAVE_ASM
94 scripts/config.py unset MBEDTLS_AESNI_C
95 scripts/config.py unset MBEDTLS_AESCE_C
96 scripts/config.py set MBEDTLS_TEST_HOOKS
97 scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
98 make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS"
99
100 msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
101 make test
102}
103
104component_test_no_udbl_division () {
105 msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
106 scripts/config.py full
107 scripts/config.py set MBEDTLS_NO_UDBL_DIVISION
108 make CFLAGS='-Werror -O1'
109
110 msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
111 make test
112}
113
114component_test_no_64bit_multiplication () {
115 msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
116 scripts/config.py full
117 scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
118 make CFLAGS='-Werror -O1'
119
120 msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
121 make test
122}