Merge pull request #3886 from gilles-peskine-arm/error-include-string-2.16

Backport 2.16: Fix several configuration-related issues
This commit is contained in:
Gilles Peskine 2020-11-17 20:33:01 +01:00 committed by GitHub
commit 481ff8e621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 21 deletions

View file

@ -51,20 +51,19 @@
#endif #endif
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) #if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
#include "mbedtls/error.h" #include "mbedtls/error.h"
#include <string.h>
#endif #if defined(MBEDTLS_ERROR_C)
#if defined(MBEDTLS_PLATFORM_C) #if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#else #else
#define mbedtls_snprintf snprintf #define mbedtls_snprintf snprintf
#define mbedtls_time_t time_t
#endif #endif
#if defined(MBEDTLS_ERROR_C)
#include <stdio.h> #include <stdio.h>
#include <string.h>
#if defined(MBEDTLS_AES_C) #if defined(MBEDTLS_AES_C)
#include "mbedtls/aes.h" #include "mbedtls/aes.h"
@ -929,8 +928,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
#else /* MBEDTLS_ERROR_C */ #else /* MBEDTLS_ERROR_C */
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
/* /*
* Provide an non-function in case MBEDTLS_ERROR_C is not defined * Provide an non-function in case MBEDTLS_ERROR_C is not defined
*/ */
@ -942,6 +939,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
buf[0] = '\0'; buf[0] = '\0';
} }
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
#endif /* MBEDTLS_ERROR_C */ #endif /* MBEDTLS_ERROR_C */
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */

View file

@ -51,20 +51,19 @@
#endif #endif
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) #if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
#include "mbedtls/error.h" #include "mbedtls/error.h"
#include <string.h>
#endif #if defined(MBEDTLS_ERROR_C)
#if defined(MBEDTLS_PLATFORM_C) #if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#else #else
#define mbedtls_snprintf snprintf #define mbedtls_snprintf snprintf
#define mbedtls_time_t time_t
#endif #endif
#if defined(MBEDTLS_ERROR_C)
#include <stdio.h> #include <stdio.h>
#include <string.h>
HEADER_INCLUDED HEADER_INCLUDED
@ -130,8 +129,6 @@ LOW_LEVEL_CODE_CHECKS
#else /* MBEDTLS_ERROR_C */ #else /* MBEDTLS_ERROR_C */
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
/* /*
* Provide an non-function in case MBEDTLS_ERROR_C is not defined * Provide an non-function in case MBEDTLS_ERROR_C is not defined
*/ */
@ -143,6 +140,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
buf[0] = '\0'; buf[0] = '\0';
} }
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
#endif /* MBEDTLS_ERROR_C */ #endif /* MBEDTLS_ERROR_C */
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */

View file

@ -1501,6 +1501,20 @@ component_test_no_64bit_multiplication () {
make test make test
} }
component_test_no_strings () {
msg "build: no strings" # ~10s
scripts/config.pl full
# Disable options that activate a large amount of string constants.
scripts/config.pl unset MBEDTLS_DEBUG_C
scripts/config.pl unset MBEDTLS_ERROR_C
scripts/config.pl set MBEDTLS_ERROR_STRERROR_DUMMY
scripts/config.pl unset MBEDTLS_VERSION_FEATURES
make CFLAGS='-Werror -Os'
msg "test: no strings" # ~ 10s
make test
}
component_build_arm_none_eabi_gcc () { component_build_arm_none_eabi_gcc () {
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1" # ~ 10s msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1" # ~ 10s
scripts/config.pl baremetal scripts/config.pl baremetal

View file

@ -55,15 +55,17 @@ use warnings;
use strict; use strict;
my %configs = ( my %configs = (
'config-ccm-psk-tls1_2.h' => {
'compat' => '-m tls1_2 -f \'^TLS-PSK-WITH-AES-...-CCM-8\'',
},
'config-mini-tls1_1.h' => { 'config-mini-tls1_1.h' => {
'compat' => '-m tls1_1 -f \'^DES-CBC3-SHA$\|^TLS-RSA-WITH-3DES-EDE-CBC-SHA$\'', 'compat' => '-m tls1_1 -f \'^DES-CBC3-SHA$\|^TLS-RSA-WITH-3DES-EDE-CBC-SHA$\'',
}, },
'config-no-entropy.h' => {
},
'config-suite-b.h' => { 'config-suite-b.h' => {
'compat' => "-m tls1_2 -f 'ECDHE-ECDSA.*AES.*GCM' -p mbedTLS", 'compat' => "-m tls1_2 -f 'ECDHE-ECDSA.*AES.*GCM' -p mbedTLS",
}, },
'config-ccm-psk-tls1_2.h' => {
'compat' => '-m tls1_2 -f \'^TLS-PSK-WITH-AES-...-CCM-8\'',
},
'config-thread.h' => { 'config-thread.h' => {
'opt' => '-f ECJPAKE.*nolog', 'opt' => '-f ECJPAKE.*nolog',
}, },