blob: cadd14061c6a4d0f465495ad5b7315bade715ef6 [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
23component_build_no_sockets () {
24 # Note, C99 compliance can also be tested with the sockets support disabled,
25 # as that requires a POSIX platform (which isn't the same as C99).
26 msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s
27 scripts/config.py full
28 scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc.
Valerio Setti73bd2102025-04-15 08:56:51 +020029 scripts/config.py set MBEDTLS_PLATFORM_GET_ENTROPY_ALT # prevent syscall() on GNU/Linux
Minos Galanakisf6e1adc2024-07-26 15:42:20 +010030 make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib
31}
32
33component_test_no_date_time () {
34 msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
35 scripts/config.py unset MBEDTLS_HAVE_TIME_DATE
36 cmake -D CMAKE_BUILD_TYPE:String=Check .
37 make
38
39 msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
40 make test
41}
42
43component_test_platform_calloc_macro () {
44 msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
45 scripts/config.py set MBEDTLS_PLATFORM_MEMORY
46 scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc
47 scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free
48 CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
49 make
50
51 msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
52 make test
53}
54
55component_test_have_int32 () {
56 msg "build: gcc, force 32-bit bignum limbs"
57 scripts/config.py unset MBEDTLS_HAVE_ASM
58 scripts/config.py unset MBEDTLS_AESNI_C
59 scripts/config.py unset MBEDTLS_AESCE_C
60 make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32'
61
62 msg "test: gcc, force 32-bit bignum limbs"
63 make test
64}
65
66component_test_have_int64 () {
67 msg "build: gcc, force 64-bit bignum limbs"
68 scripts/config.py unset MBEDTLS_HAVE_ASM
69 scripts/config.py unset MBEDTLS_AESNI_C
70 scripts/config.py unset MBEDTLS_AESCE_C
71 make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64'
72
73 msg "test: gcc, force 64-bit bignum limbs"
74 make test
75}
76
77component_test_have_int32_cmake_new_bignum () {
78 msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
79 scripts/config.py unset MBEDTLS_HAVE_ASM
80 scripts/config.py unset MBEDTLS_AESNI_C
81 scripts/config.py unset MBEDTLS_AESCE_C
82 scripts/config.py set MBEDTLS_TEST_HOOKS
83 scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
84 make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS"
85
86 msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
87 make test
88}
89
90component_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 make CFLAGS='-Werror -O1'
95
96 msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
97 make test
98}
99
100component_test_no_64bit_multiplication () {
101 msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
102 scripts/config.py full
103 scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
104 make CFLAGS='-Werror -O1'
105
106 msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
107 make test
108}