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 | |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 23 | component_test_psa_driver_get_entropy() |
Valerio Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 24 | { |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 25 | msg "build: default - MBEDTLS_PSA_BUILTIN_GET_ENTROPY + MBEDTLS_PSA_DRIVER_GET_ENTROPY" |
Valerio Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 26 | # Use hardware polling as the only source for entropy |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 27 | scripts/config.py unset MBEDTLS_PSA_BUILTIN_GET_ENTROPY |
Valerio Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 28 | scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 29 | scripts/config.py set MBEDTLS_PSA_DRIVER_GET_ENTROPY |
Valerio Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 30 | |
| 31 | make |
| 32 | |
| 33 | # Run all the tests |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 34 | msg "test: default - MBEDTLS_PSA_BUILTIN_GET_ENTROPY + MBEDTLS_PSA_DRIVER_GET_ENTROPY" |
Valerio Setti | 1afedac | 2025-05-06 06:27:02 +0200 | [diff] [blame] | 35 | make test |
| 36 | } |
| 37 | |
Minos Galanakis | f6e1adc | 2024-07-26 15:42:20 +0100 | [diff] [blame] | 38 | component_build_no_sockets () { |
| 39 | # Note, C99 compliance can also be tested with the sockets support disabled, |
| 40 | # as that requires a POSIX platform (which isn't the same as C99). |
| 41 | msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s |
| 42 | scripts/config.py full |
| 43 | scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc. |
Ronald Cron | eb16a9d | 2025-09-03 09:57:29 +0200 | [diff] [blame] | 44 | scripts/config.py unset MBEDTLS_PSA_BUILTIN_GET_ENTROPY # prevent syscall() on GNU/Linux |
| 45 | scripts/config.py set MBEDTLS_PSA_DRIVER_GET_ENTROPY |
Minos Galanakis | f6e1adc | 2024-07-26 15:42:20 +0100 | [diff] [blame] | 46 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib |
| 47 | } |
| 48 | |
| 49 | component_test_no_date_time () { |
| 50 | msg "build: default config without MBEDTLS_HAVE_TIME_DATE" |
| 51 | scripts/config.py unset MBEDTLS_HAVE_TIME_DATE |
| 52 | cmake -D CMAKE_BUILD_TYPE:String=Check . |
| 53 | make |
| 54 | |
| 55 | msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites" |
| 56 | make test |
| 57 | } |
| 58 | |
| 59 | component_test_platform_calloc_macro () { |
| 60 | msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
| 61 | scripts/config.py set MBEDTLS_PLATFORM_MEMORY |
| 62 | scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc |
| 63 | scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free |
| 64 | CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan . |
| 65 | make |
| 66 | |
| 67 | msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)" |
| 68 | make test |
| 69 | } |
| 70 | |
| 71 | component_test_have_int32 () { |
| 72 | msg "build: gcc, force 32-bit bignum limbs" |
| 73 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 74 | scripts/config.py unset MBEDTLS_AESNI_C |
| 75 | scripts/config.py unset MBEDTLS_AESCE_C |
| 76 | make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
| 77 | |
| 78 | msg "test: gcc, force 32-bit bignum limbs" |
| 79 | make test |
| 80 | } |
| 81 | |
| 82 | component_test_have_int64 () { |
| 83 | msg "build: gcc, force 64-bit bignum limbs" |
| 84 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 85 | scripts/config.py unset MBEDTLS_AESNI_C |
| 86 | scripts/config.py unset MBEDTLS_AESCE_C |
| 87 | make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
| 88 | |
| 89 | msg "test: gcc, force 64-bit bignum limbs" |
| 90 | make test |
| 91 | } |
| 92 | |
| 93 | component_test_have_int32_cmake_new_bignum () { |
| 94 | msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 95 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 96 | scripts/config.py unset MBEDTLS_AESNI_C |
| 97 | scripts/config.py unset MBEDTLS_AESCE_C |
| 98 | scripts/config.py set MBEDTLS_TEST_HOOKS |
| 99 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
| 100 | make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS" |
| 101 | |
| 102 | msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 103 | make test |
| 104 | } |
| 105 | |
| 106 | component_test_no_udbl_division () { |
| 107 | msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 108 | scripts/config.py full |
| 109 | scripts/config.py set MBEDTLS_NO_UDBL_DIVISION |
| 110 | make CFLAGS='-Werror -O1' |
| 111 | |
| 112 | msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 113 | make test |
| 114 | } |
| 115 | |
| 116 | component_test_no_64bit_multiplication () { |
| 117 | msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 118 | scripts/config.py full |
| 119 | scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION |
| 120 | make CFLAGS='-Werror -O1' |
| 121 | |
| 122 | msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 123 | make test |
| 124 | } |