Update crypto submodule to test with private headers

Update the crypto submodule to the top of the Mbed Crypto development
branch. This brings in a version of Mbed Crypto that enables building
Mbed Crypto tests that depend on private headers, like
'psa_crypto_invasive.h'.

This also requires updating our config.h to include new configuration
options added to Mbed Crypto. MBEDTLS_PSA_ITS_FILE_C replaces
MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C and MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C.
MBEDTLS_PSA_INJECT_ENTROPY replaces MBEDTLS_PSA_HAS_ITS_IO.
This commit is contained in:
Jaeden Amero 2019-03-15 16:14:19 +00:00
parent 2184ef63ab
commit 57f4d9e4fe
6 changed files with 49 additions and 74 deletions

2
crypto

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

View file

@ -525,26 +525,25 @@
#error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites" #error "MBEDTLS_PSA_CRYPTO_SPM defined, but not all prerequisites"
#endif #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) && \ #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
!( defined(MBEDTLS_PSA_CRYPTO_C) && \ ! defined(MBEDTLS_PSA_CRYPTO_C)
( defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) || \
defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C) ) )
#error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites" #error "MBEDTLS_PSA_CRYPTO_STORAGE_C defined, but not all prerequisites"
#endif #endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) && \ #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
!( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \ !( defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) && \
defined(MBEDTLS_FS_IO) ) defined(MBEDTLS_ENTROPY_NV_SEED) )
#error "MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C defined, but not all prerequisites" #error "MBEDTLS_PSA_INJECT_ENTROPY defined, but not all prerequisites"
#endif #endif
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C) && \ #if defined(MBEDTLS_PSA_INJECT_ENTROPY) && \
! defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES)
#error "MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C defined, but not all prerequisites" #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 #endif
#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \ #if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \

View file

@ -1237,14 +1237,17 @@
//#define MBEDTLS_PSA_CRYPTO_SPM //#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 * \def MBEDTLS_RSA_NO_CRT
@ -2741,40 +2744,26 @@
* *
* Enable the Platform Security Architecture persistent key storage. * Enable the Platform Security Architecture persistent key storage.
* *
* Module: library/psa_crypto_storage.c * Module: crypto/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)
* *
* 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 //#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 * Enable the emulation of the Platform Security Architecture
* Platform Security Architecture cryptography API. * 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 //#define MBEDTLS_PSA_ITS_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
/** /**
* \def MBEDTLS_RIPEMD160_C * \def MBEDTLS_RIPEMD160_C

View file

@ -429,9 +429,9 @@ static const char *features[] = {
#if defined(MBEDTLS_PSA_CRYPTO_SPM) #if defined(MBEDTLS_PSA_CRYPTO_SPM)
"MBEDTLS_PSA_CRYPTO_SPM", "MBEDTLS_PSA_CRYPTO_SPM",
#endif /* MBEDTLS_PSA_CRYPTO_SPM */ #endif /* MBEDTLS_PSA_CRYPTO_SPM */
#if defined(MBEDTLS_PSA_HAS_ITS_IO) #if defined(MBEDTLS_PSA_INJECT_ENTROPY)
"MBEDTLS_PSA_HAS_ITS_IO", "MBEDTLS_PSA_INJECT_ENTROPY",
#endif /* MBEDTLS_PSA_HAS_ITS_IO */ #endif /* MBEDTLS_PSA_INJECT_ENTROPY */
#if defined(MBEDTLS_RSA_NO_CRT) #if defined(MBEDTLS_RSA_NO_CRT)
"MBEDTLS_RSA_NO_CRT", "MBEDTLS_RSA_NO_CRT",
#endif /* MBEDTLS_RSA_NO_CRT */ #endif /* MBEDTLS_RSA_NO_CRT */
@ -708,12 +708,9 @@ static const char *features[] = {
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
"MBEDTLS_PSA_CRYPTO_STORAGE_C", "MBEDTLS_PSA_CRYPTO_STORAGE_C",
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */ #endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) #if defined(MBEDTLS_PSA_ITS_FILE_C)
"MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C", "MBEDTLS_PSA_ITS_FILE_C",
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C */ #endif /* MBEDTLS_PSA_ITS_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_RIPEMD160_C) #if defined(MBEDTLS_RIPEMD160_C)
"MBEDTLS_RIPEMD160_C", "MBEDTLS_RIPEMD160_C",
#endif /* MBEDTLS_RIPEMD160_C */ #endif /* MBEDTLS_RIPEMD160_C */

View file

@ -1186,13 +1186,13 @@ int query_config( const char *config )
} }
#endif /* MBEDTLS_PSA_CRYPTO_SPM */ #endif /* MBEDTLS_PSA_CRYPTO_SPM */
#if defined(MBEDTLS_PSA_HAS_ITS_IO) #if defined(MBEDTLS_PSA_INJECT_ENTROPY)
if( strcmp( "MBEDTLS_PSA_HAS_ITS_IO", config ) == 0 ) 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 ); return( 0 );
} }
#endif /* MBEDTLS_PSA_HAS_ITS_IO */ #endif /* MBEDTLS_PSA_INJECT_ENTROPY */
#if defined(MBEDTLS_RSA_NO_CRT) #if defined(MBEDTLS_RSA_NO_CRT)
if( strcmp( "MBEDTLS_RSA_NO_CRT", config ) == 0 ) if( strcmp( "MBEDTLS_RSA_NO_CRT", config ) == 0 )
@ -1930,21 +1930,13 @@ int query_config( const char *config )
} }
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */ #endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C) #if defined(MBEDTLS_PSA_ITS_FILE_C)
if( strcmp( "MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C", config ) == 0 ) 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 ); return( 0 );
} }
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C */ #endif /* MBEDTLS_PSA_ITS_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 */
#if defined(MBEDTLS_RIPEMD160_C) #if defined(MBEDTLS_RIPEMD160_C)
if( strcmp( "MBEDTLS_RIPEMD160_C", config ) == 0 ) if( strcmp( "MBEDTLS_RIPEMD160_C", config ) == 0 )

View file

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