Minos Galanakis | ada21b0 | 2024-07-26 12:34:19 +0100 | [diff] [blame] | 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 | |
Minos Galanakis | 609f749 | 2024-07-31 16:39:28 +0100 | [diff] [blame] | 6 | # This file contains test components that are executed by all.sh |
Minos Galanakis | ada21b0 | 2024-07-26 12:34:19 +0100 | [diff] [blame] | 7 | |
| 8 | ################################################################ |
| 9 | #### Configuration Testing - Platform |
| 10 | ################################################################ |
Minos Galanakis | f6e1adc | 2024-07-26 15:42:20 +0100 | [diff] [blame] | 11 | |
| 12 | component_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 Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 23 | component_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 Galanakis | f6e1adc | 2024-07-26 15:42:20 +0100 | [diff] [blame] | 37 | component_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 Setti | 73bd210 | 2025-04-15 08:56:51 +0200 | [diff] [blame] | 43 | scripts/config.py set MBEDTLS_PLATFORM_GET_ENTROPY_ALT # prevent syscall() on GNU/Linux |
Minos Galanakis | f6e1adc | 2024-07-26 15:42:20 +0100 | [diff] [blame] | 44 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib |
| 45 | } |
| 46 | |
| 47 | component_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 | |
| 57 | component_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 | |
| 69 | component_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 | |
| 80 | component_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 | |
| 91 | component_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 | |
| 104 | component_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 | |
| 114 | component_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 | } |