From 9b781b28801d3549ca5388355446178694a92d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 16 Jul 2019 14:32:27 +0200 Subject: [PATCH] Add MBEDTLS_SHA256_NO_SHA244 option (unimplemented) --- include/mbedtls/config.h | 10 ++++++++++ library/version_features.c | 3 +++ programs/ssl/query_config.c | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index f32498b1b3..83405245ef 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 bb655c0c9d..961148bbb1 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 dd50514663..627934fc34 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 ) {