Minos Galanakis | 7771119 | 2024-07-25 14:24:37 +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 | |
| 6 | # This file contains test components that are executed by all.sh |
| 7 | |
| 8 | ################################################################ |
| 9 | #### Configuration Testing - Platform |
| 10 | ################################################################ |
Minos Galanakis | 5b4386c | 2024-08-01 17:12:24 +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 | |
| 23 | component_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. |
| 29 | scripts/config.py set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux |
| 30 | make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib |
| 31 | } |
| 32 | |
| 33 | component_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 | |
| 43 | component_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 | |
| 55 | component_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_PADLOCK_C |
| 60 | scripts/config.py unset MBEDTLS_AESCE_C |
| 61 | make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32' |
| 62 | |
| 63 | msg "test: gcc, force 32-bit bignum limbs" |
| 64 | make test |
| 65 | } |
| 66 | |
| 67 | component_test_have_int64 () { |
| 68 | msg "build: gcc, force 64-bit bignum limbs" |
| 69 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 70 | scripts/config.py unset MBEDTLS_AESNI_C |
| 71 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 72 | scripts/config.py unset MBEDTLS_AESCE_C |
| 73 | make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64' |
| 74 | |
| 75 | msg "test: gcc, force 64-bit bignum limbs" |
| 76 | make test |
| 77 | } |
| 78 | |
| 79 | component_test_have_int32_cmake_new_bignum () { |
| 80 | msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 81 | scripts/config.py unset MBEDTLS_HAVE_ASM |
| 82 | scripts/config.py unset MBEDTLS_AESNI_C |
| 83 | scripts/config.py unset MBEDTLS_PADLOCK_C |
| 84 | scripts/config.py unset MBEDTLS_AESCE_C |
| 85 | scripts/config.py set MBEDTLS_TEST_HOOKS |
| 86 | scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT |
| 87 | make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS" |
| 88 | |
| 89 | msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" |
| 90 | make test |
| 91 | } |
| 92 | |
| 93 | component_test_no_udbl_division () { |
| 94 | msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 95 | scripts/config.py full |
| 96 | scripts/config.py set MBEDTLS_NO_UDBL_DIVISION |
| 97 | make CFLAGS='-Werror -O1' |
| 98 | |
| 99 | msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s |
| 100 | make test |
| 101 | } |
| 102 | |
| 103 | component_test_no_64bit_multiplication () { |
| 104 | msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 105 | scripts/config.py full |
| 106 | scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION |
| 107 | make CFLAGS='-Werror -O1' |
| 108 | |
| 109 | msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s |
| 110 | make test |
| 111 | } |