Merge remote-tracking branch 'origin/pr/2509' into development

* origin/pr/2509:
  all.sh: Generate seedfile for crypto submodule tests
  Update crypto submodule to test with private headers
  tests: Use globbing in test suite exclusion list
  Update crypto submodule to Mbed Crypto development
  tests: Test crypto via the crypto submodule
This commit is contained in:
Jaeden Amero 2019-03-27 14:45:26 +00:00
commit 3930e18c3c
11 changed files with 176 additions and 141 deletions

View File

@ -195,6 +195,9 @@ if(ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
if(USE_CRYPTO_SUBMODULE)
add_subdirectory(crypto/tests)
endif()
# additional convenience targets for Unix only
if(UNIX)

View File

@ -19,6 +19,9 @@ lib:
tests: lib
$(MAKE) -C tests
ifdef USE_CRYPTO_SUBMODULE
$(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C crypto/tests
endif
ifndef WINDOWS
install: no_test
@ -103,6 +106,9 @@ endif
check: lib tests
$(MAKE) -C tests check
ifdef USE_CRYPTO_SUBMODULE
$(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C crypto/tests check
endif
test: check

2
crypto

@ -1 +1 @@
Subproject commit a78c958b17d75ddf63d8dd17255b6379dcbf259f
Subproject commit 82b3b83d540ec9611277ca3e9b645b335f80846a

View File

@ -525,26 +525,25 @@
#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) && defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C)
#error "Only one of MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C or MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C can be defined"
#endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
!( defined(MBEDTLS_PSA_CRYPTO_C) && \
( defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) || \
defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C) ) )
! defined(MBEDTLS_PSA_CRYPTO_C)
#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) && \
#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
!( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
defined(MBEDTLS_FS_IO) )
#error "MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C defined, but not all prerequisites"
defined(MBEDTLS_ENTROPY_NV_SEED) )
#error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C) && \
! defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
#error "MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C defined, but not all prerequisites"
#if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
!defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with actual entropy sources"
#endif
#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
!defined(MBEDTLS_FS_IO)
#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \

View File

@ -1237,14 +1237,17 @@
//#define MBEDTLS_PSA_CRYPTO_SPM
/**
* \def MBEDTLS_PSA_HAS_ITS_IO
* \def MBEDTLS_PSA_INJECT_ENTROPY
*
* Enable the non-volatile secure storage usage.
* Enable support for entropy injection at first boot. This feature is
* required on systems that do not have a built-in entropy source (TRNG).
* This feature is currently not supported on systems that have a built-in
* entropy source.
*
* This is crucial on systems that do not have a HW TRNG support.
* Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED
*
*/
//#define MBEDTLS_PSA_HAS_ITS_IO
//#define MBEDTLS_PSA_INJECT_ENTROPY
/**
* \def MBEDTLS_RSA_NO_CRT
@ -2741,40 +2744,26 @@
*
* Enable the Platform Security Architecture persistent key storage.
*
* Module: library/psa_crypto_storage.c
*
* Requires: MBEDTLS_PSA_CRYPTO_C and one of either
* MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C or MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
* (but not both)
* Module: crypto/library/psa_crypto_storage.c
*
* Requires: MBEDTLS_PSA_CRYPTO_C,
* either MBEDTLS_PSA_ITS_FILE_C or a native implementation of
* the PSA ITS interface
*/
//#define MBEDTLS_PSA_CRYPTO_STORAGE_C
/**
* \def MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
* \def MBEDTLS_PSA_ITS_FILE_C
*
* Enable persistent key storage over files for the
* Platform Security Architecture cryptography API.
* Enable the emulation of the Platform Security Architecture
* Internal Trusted Storage (PSA ITS) over files.
*
* Module: library/psa_crypto_storage_file.c
* Module: crypto/library/psa_its_file.c
*
* Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_FS_IO
* Requires: MBEDTLS_FS_IO
*
*/
//#define MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
/**
* \def MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
*
* Enable persistent key storage over PSA ITS for the
* Platform Security Architecture cryptography API.
*
* Module: library/psa_crypto_storage_its.c
*
* Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_HAS_ITS_IO
*
*/
//#define MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
//#define MBEDTLS_PSA_ITS_FILE_C
/**
* \def MBEDTLS_RIPEMD160_C

View File

@ -429,9 +429,9 @@ static const char *features[] = {
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
"MBEDTLS_PSA_CRYPTO_SPM",
#endif /* MBEDTLS_PSA_CRYPTO_SPM */
#if defined(MBEDTLS_PSA_HAS_ITS_IO)
"MBEDTLS_PSA_HAS_ITS_IO",
#endif /* MBEDTLS_PSA_HAS_ITS_IO */
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
"MBEDTLS_PSA_INJECT_ENTROPY",
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
#if defined(MBEDTLS_RSA_NO_CRT)
"MBEDTLS_RSA_NO_CRT",
#endif /* MBEDTLS_RSA_NO_CRT */
@ -708,12 +708,9 @@ static const char *features[] = {
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
"MBEDTLS_PSA_CRYPTO_STORAGE_C",
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C)
"MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C",
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C)
"MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C",
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C */
#if defined(MBEDTLS_PSA_ITS_FILE_C)
"MBEDTLS_PSA_ITS_FILE_C",
#endif /* MBEDTLS_PSA_ITS_FILE_C */
#if defined(MBEDTLS_RIPEMD160_C)
"MBEDTLS_RIPEMD160_C",
#endif /* MBEDTLS_RIPEMD160_C */

View File

@ -1186,13 +1186,13 @@ int query_config( const char *config )
}
#endif /* MBEDTLS_PSA_CRYPTO_SPM */
#if defined(MBEDTLS_PSA_HAS_ITS_IO)
if( strcmp( "MBEDTLS_PSA_HAS_ITS_IO", config ) == 0 )
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
if( strcmp( "MBEDTLS_PSA_INJECT_ENTROPY", config ) == 0 )
{
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_HAS_ITS_IO );
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_INJECT_ENTROPY );
return( 0 );
}
#endif /* MBEDTLS_PSA_HAS_ITS_IO */
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
#if defined(MBEDTLS_RSA_NO_CRT)
if( strcmp( "MBEDTLS_RSA_NO_CRT", config ) == 0 )
@ -1930,21 +1930,13 @@ int query_config( const char *config )
}
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C)
if( strcmp( "MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C", config ) == 0 )
#if defined(MBEDTLS_PSA_ITS_FILE_C)
if( strcmp( "MBEDTLS_PSA_ITS_FILE_C", config ) == 0 )
{
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C );
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_ITS_FILE_C );
return( 0 );
}
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C)
if( strcmp( "MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C", config ) == 0 )
{
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C );
return( 0 );
}
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C */
#endif /* MBEDTLS_PSA_ITS_FILE_C */
#if defined(MBEDTLS_RIPEMD160_C)
if( strcmp( "MBEDTLS_RIPEMD160_C", config ) == 0 )

View File

@ -41,10 +41,9 @@
# MBEDTLS_USE_PSA_CRYPTO
# - experimental, and more an alternative implementation than a feature
# MBEDTLS_PSA_CRYPTO_STORAGE_C
# MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
# MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
# MBEDTLS_PSA_ITS_FILE_C
# MBEDTLS_PSA_CRYPTO_SPM
# MBEDTLS_PSA_HAS_ITS_IO
# MBEDTLS_PSA_INJECT_ENTROPY
# and any symbol beginning _ALT
#
@ -109,10 +108,9 @@ MBEDTLS_NO_UDBL_DIVISION
MBEDTLS_NO_64BIT_MULTIPLICATION
MBEDTLS_USE_PSA_CRYPTO
MBEDTLS_PSA_CRYPTO_STORAGE_C
MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
MBEDTLS_PSA_ITS_FILE_C
MBEDTLS_PSA_CRYPTO_SPM
MBEDTLS_PSA_HAS_ITS_IO
MBEDTLS_PSA_INJECT_ENTROPY
_ALT\s*$
);

View File

@ -60,6 +60,7 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
endif(MSVC)
if(NOT USE_CRYPTO_SUBMODULE)
add_test_suite(aes aes.ecb)
add_test_suite(aes aes.cbc)
add_test_suite(aes aes.cfb)
@ -89,7 +90,6 @@ add_test_suite(cipher cipher.null)
add_test_suite(cipher cipher.padding)
add_test_suite(cmac)
add_test_suite(ctr_drbg)
add_test_suite(debug)
add_test_suite(des)
add_test_suite(dhm)
add_test_suite(ecdh)
@ -125,11 +125,13 @@ add_test_suite(pkparse)
add_test_suite(pkwrite)
add_test_suite(poly1305)
add_test_suite(shax)
add_test_suite(ssl)
add_test_suite(timing)
add_test_suite(rsa)
add_test_suite(version)
add_test_suite(xtea)
endif()
add_test_suite(debug)
add_test_suite(ssl)
add_test_suite(version)
add_test_suite(x509parse)
add_test_suite(x509write)

View File

@ -66,6 +66,52 @@ endif
# constructed by stripping path 'suites/' and extension .data.
APPS = $(basename $(subst suites/,,$(wildcard suites/test_suite_*.data)))
ifdef USE_CRYPTO_SUBMODULE
APPS := $(filter-out \
test_suite_aes.% \
test_suite_arc4 \
test_suite_aria \
test_suite_asn1write \
test_suite_base64 \
test_suite_blowfish \
test_suite_camellia \
test_suite_ccm \
test_suite_chacha20 \
test_suite_chachapoly \
test_suite_cipher.% \
test_suite_cmac \
test_suite_ctr_drbg \
test_suite_des \
test_suite_dhm \
test_suite_ecdh \
test_suite_ecdsa \
test_suite_ecjpake \
test_suite_ecp \
test_suite_entropy \
test_suite_error \
test_suite_gcm.% \
test_suite_hkdf \
test_suite_hmac_drbg.% \
test_suite_md \
test_suite_mdx \
test_suite_memory_buffer_alloc \
test_suite_mpi \
test_suite_nist_kw \
test_suite_pem \
test_suite_pk \
test_suite_pkcs1_v15 \
test_suite_pkcs1_v21 \
test_suite_pkcs5 \
test_suite_pkparse \
test_suite_pkwrite \
test_suite_poly1305 \
test_suite_rsa \
test_suite_shax \
test_suite_timing \
test_suite_xtea \
,$(APPS))
endif
# Construct executable name by adding OS specific suffix $(EXEXT).
BINARIES := $(addsuffix $(EXEXT),$(APPS))

View File

@ -406,6 +406,9 @@ pre_check_seedfile () {
if [ ! -f "./tests/seedfile" ]; then
dd if=/dev/urandom of=./tests/seedfile bs=32 count=1
fi
if [ ! -f "./crypto/tests/seedfile" ]; then
dd if=/dev/urandom of=./crypto/tests/seedfile bs=32 count=1
fi
}
pre_setup_keep_going () {