1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00

Merge pull request #7997 from yanesca/fix_new_bignum_tests

Fix new bignum tests
This commit is contained in:
Gilles Peskine
2023-08-01 12:09:39 +00:00
committed by GitHub
4 changed files with 20 additions and 11 deletions

View File

@@ -3997,4 +3997,13 @@
*/ */
//#define MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED //#define MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED
/**
* Uncomment to enable using new bignum code in the ECC modules.
*
* \warning This is currently experimental, incomplete and therefore should not
* be used in production.
*/
//#define MBEDTLS_ECP_WITH_MPI_UINT
/** \} name SECTION: Module configuration options */ /** \} name SECTION: Module configuration options */

View File

@@ -40,11 +40,6 @@ typedef enum {
MBEDTLS_ECP_MOD_SCALAR MBEDTLS_ECP_MOD_SCALAR
} mbedtls_ecp_modulus_type; } mbedtls_ecp_modulus_type;
/* Provide a commented-out definition so that `check_names.py` knows that
* it's not a typo.
*/
//#define MBEDTLS_ECP_WITH_MPI_UINT
typedef enum { typedef enum {
MBEDTLS_ECP_VARIANT_NONE = 0, MBEDTLS_ECP_VARIANT_NONE = 0,
MBEDTLS_ECP_VARIANT_WITH_MPI_STRUCT, MBEDTLS_ECP_VARIANT_WITH_MPI_STRUCT,

View File

@@ -195,6 +195,7 @@ EXCLUDE_FROM_FULL = frozenset([
'MBEDTLS_DEPRECATED_WARNING', # conflicts with deprecated options 'MBEDTLS_DEPRECATED_WARNING', # conflicts with deprecated options
'MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED', # influences the use of ECDH in TLS 'MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED', # influences the use of ECDH in TLS
'MBEDTLS_ECP_NO_FALLBACK', # removes internal ECP implementation 'MBEDTLS_ECP_NO_FALLBACK', # removes internal ECP implementation
'MBEDTLS_ECP_WITH_MPI_UINT', # disables the default ECP and is experimental
'MBEDTLS_ENTROPY_FORCE_SHA256', # interacts with CTR_DRBG_128_BIT_KEY 'MBEDTLS_ENTROPY_FORCE_SHA256', # interacts with CTR_DRBG_128_BIT_KEY
'MBEDTLS_HAVE_SSE2', # hardware dependency 'MBEDTLS_HAVE_SSE2', # hardware dependency
'MBEDTLS_MEMORY_BACKTRACE', # depends on MEMORY_BUFFER_ALLOC_C 'MBEDTLS_MEMORY_BACKTRACE', # depends on MEMORY_BUFFER_ALLOC_C
@@ -204,6 +205,7 @@ EXCLUDE_FROM_FULL = frozenset([
'MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES', # removes a feature 'MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES', # removes a feature
'MBEDTLS_NO_PLATFORM_ENTROPY', # removes a feature 'MBEDTLS_NO_PLATFORM_ENTROPY', # removes a feature
'MBEDTLS_NO_UDBL_DIVISION', # influences anything that uses bignum 'MBEDTLS_NO_UDBL_DIVISION', # influences anything that uses bignum
'MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED', # influences SECP256R1 KeyGen/ECDH/ECDSA
'MBEDTLS_PLATFORM_NO_STD_FUNCTIONS', # removes a feature 'MBEDTLS_PLATFORM_NO_STD_FUNCTIONS', # removes a feature
'MBEDTLS_PSA_CRYPTO_CONFIG', # toggles old/new style PSA config 'MBEDTLS_PSA_CRYPTO_CONFIG', # toggles old/new style PSA config
'MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG', # behavior change + build dependency 'MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG', # behavior change + build dependency
@@ -213,11 +215,10 @@ EXCLUDE_FROM_FULL = frozenset([
'MBEDTLS_RSA_NO_CRT', # influences the use of RSA in X.509 and TLS 'MBEDTLS_RSA_NO_CRT', # influences the use of RSA in X.509 and TLS
'MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT 'MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT
'MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT 'MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT
'MBEDTLS_SSL_RECORD_SIZE_LIMIT', # in development, currently breaks other tests
'MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN', # build dependency (clang+memsan) 'MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN', # build dependency (clang+memsan)
'MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND', # build dependency (valgrind headers) 'MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND', # build dependency (valgrind headers)
'MBEDTLS_X509_REMOVE_INFO', # removes a feature 'MBEDTLS_X509_REMOVE_INFO', # removes a feature
'MBEDTLS_SSL_RECORD_SIZE_LIMIT', # in development, currently breaks other tests
'MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED' # influences SECP256R1 KeyGen/ECDH/ECDSA
]) ])
def is_seamless_alt(name): def is_seamless_alt(name):

View File

@@ -1028,8 +1028,9 @@ component_test_default_cmake_gcc_asan () {
component_test_default_cmake_gcc_asan_new_bignum () { component_test_default_cmake_gcc_asan_new_bignum () {
msg "build: cmake, gcc, ASan" # ~ 1 min 50s msg "build: cmake, gcc, ASan" # ~ 1 min 50s
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
make CFLAGS="-D MBEDTLS_ECP_WITH_MPI_UINT" make
msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
make test make test
@@ -1086,8 +1087,9 @@ component_test_full_cmake_gcc_asan () {
component_test_full_cmake_gcc_asan_new_bignum () { component_test_full_cmake_gcc_asan_new_bignum () {
msg "build: full config, cmake, gcc, ASan" msg "build: full config, cmake, gcc, ASan"
scripts/config.py full scripts/config.py full
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
make CFLAGS="-D MBEDTLS_ECP_WITH_MPI_UINT" make
msg "test: main suites (inc. selftests) (full config, ASan build)" msg "test: main suites (inc. selftests) (full config, ASan build)"
make test make test
@@ -1122,8 +1124,9 @@ component_test_full_cmake_gcc_asan_new_bignum_test_hooks () {
msg "build: full config, cmake, gcc, ASan" msg "build: full config, cmake, gcc, ASan"
scripts/config.py full scripts/config.py full
scripts/config.py set MBEDTLS_TEST_HOOKS scripts/config.py set MBEDTLS_TEST_HOOKS
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan . CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
make CFLAGS="-DMBEDTLS_ECP_WITH_MPI_UINT" make
msg "test: main suites (inc. selftests) (full config, ASan build)" msg "test: main suites (inc. selftests) (full config, ASan build)"
make test make test
@@ -4212,7 +4215,8 @@ component_test_have_int32_cmake_new_bignum () {
scripts/config.py unset MBEDTLS_PADLOCK_C scripts/config.py unset MBEDTLS_PADLOCK_C
scripts/config.py unset MBEDTLS_AESCE_C scripts/config.py unset MBEDTLS_AESCE_C
scripts/config.py set MBEDTLS_TEST_HOOKS scripts/config.py set MBEDTLS_TEST_HOOKS
make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32 -DMBEDTLS_ECP_WITH_MPI_UINT" LDFLAGS="$ASAN_CFLAGS" scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS"
msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)" msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
make test make test