diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index f32498b1b..83405245e 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -1281,6 +1281,16 @@ */ //#define MBEDTLS_SHA256_SMALLER +/** + * \def MBEDTLS_SHA256_NO_SHA224 + * + * Disable the SHA-224 option of the SHA-256 module. Use this to save some + * code size on devices that don't use SHA-224. + * + * Uncomment to disable SHA-224 + */ +//#define MBEDTLS_SHA256_NO_SHA224 + /** * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES * diff --git a/library/version_features.c b/library/version_features.c index bb655c0c9..961148bbb 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -435,6 +435,9 @@ static const char *features[] = { #if defined(MBEDTLS_SHA256_SMALLER) "MBEDTLS_SHA256_SMALLER", #endif /* MBEDTLS_SHA256_SMALLER */ +#if defined(MBEDTLS_SHA256_NO_SHA224) + "MBEDTLS_SHA256_NO_SHA224", +#endif /* MBEDTLS_SHA256_NO_SHA224 */ #if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES) "MBEDTLS_SSL_ALL_ALERT_MESSAGES", #endif /* MBEDTLS_SSL_ALL_ALERT_MESSAGES */ diff --git a/programs/ssl/query_config.c b/programs/ssl/query_config.c index dd5051466..627934fc3 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -1202,6 +1202,14 @@ int query_config( const char *config ) } #endif /* MBEDTLS_SHA256_SMALLER */ +#if defined(MBEDTLS_SHA256_NO_SHA224) + if( strcmp( "MBEDTLS_SHA256_NO_SHA224", config ) == 0 ) + { + MACRO_EXPANSION_TO_STR( MBEDTLS_SHA256_NO_SHA224 ); + return( 0 ); + } +#endif /* MBEDTLS_SHA256_NO_SHA224 */ + #if defined(MBEDTLS_SSL_ALL_ALERT_MESSAGES) if( strcmp( "MBEDTLS_SSL_ALL_ALERT_MESSAGES", config ) == 0 ) {