mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 12:38:24 +00:00
Merge branch 'mbedtls-1.3' into development
* mbedtls-1.3: Fix compile errors with NO_STD_FUNCTIONS Expand config.pl's notion of "full" Ack external bugfix in Changelog FIx misplaced Changelog entry (oops) Fix compile bug: incompatible declaration of polarssl_exit in platform.c Fix contributor's name in Changelog
This commit is contained in:
commit
7ee5ddd798
5 changed files with 28 additions and 7 deletions
|
@ -193,6 +193,10 @@ Features
|
|||
errors on use of deprecated functions.
|
||||
|
||||
Bugfix
|
||||
* Fix compile errors with PLATFORM_NO_STD_FUNCTIONS.
|
||||
* Fix compile error with PLATFORM_EXIT_ALT (thanks to Rafał Przywara).
|
||||
* Fix bug in entropy.c when THREADING_C is also enabled that caused
|
||||
entropy_free() to crash (thanks to Rafał Przywara).
|
||||
* Fix memory leak when gcm_setkey() and ccm_setkey() are used more than
|
||||
once on the same context.
|
||||
* Fix bug in ssl_mail_client when password is longer that username (found
|
||||
|
@ -285,8 +289,6 @@ Features
|
|||
ciphersuite/certificate.
|
||||
|
||||
Bugfix
|
||||
* Fix bug in entropy.c when THREADING_C is also enabled that caused
|
||||
entropy_free() to crash (found and fixed by ptahpeteh).
|
||||
* Stack buffer overflow if ctr_drbg_update() is called with too large
|
||||
add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).
|
||||
* Possible buffer overflow of length at most POLARSSL_MEMORY_ALIGN_MULTIPLE
|
||||
|
|
|
@ -80,6 +80,8 @@ extern "C" {
|
|||
#define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
|
||||
#define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
|
||||
#else
|
||||
/* For size_t */
|
||||
#include <stddef.h>
|
||||
extern void * (*mbedtls_calloc)( size_t n, size_t size );
|
||||
extern void (*mbedtls_free)( void *ptr );
|
||||
|
||||
|
@ -103,6 +105,8 @@ int mbedtls_platform_set_calloc_free( void * (*calloc_func)( size_t, size_t ),
|
|||
* The function pointers for fprintf
|
||||
*/
|
||||
#if defined(MBEDTLS_PLATFORM_FPRINTF_ALT)
|
||||
/* We need FILE * */
|
||||
#include <stdio.h>
|
||||
extern int (*mbedtls_fprintf)( FILE *stream, const char *format, ... );
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,7 +73,7 @@ static int platform_snprintf_uninit( char * s, size_t n,
|
|||
{
|
||||
((void) s);
|
||||
((void) n);
|
||||
((void) format)
|
||||
((void) format);
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
@ -149,13 +149,12 @@ int mbedtls_platform_set_fprintf( int (*fprintf_func)( FILE *, const char *, ...
|
|||
static void platform_exit_uninit( int status )
|
||||
{
|
||||
((void) status);
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#define MBEDTLS_PLATFORM_STD_EXIT platform_exit_uninit
|
||||
#endif /* !MBEDTLS_PLATFORM_STD_EXIT */
|
||||
|
||||
int (*mbedtls_exit)( int status ) = MBEDTLS_PLATFORM_STD_EXIT;
|
||||
void (*mbedtls_exit)( int status ) = MBEDTLS_PLATFORM_STD_EXIT;
|
||||
|
||||
int mbedtls_platform_set_exit( void (*exit_func)( int status ) )
|
||||
{
|
||||
|
|
|
@ -35,6 +35,11 @@ MBEDTLS_PKCS11_C
|
|||
_ALT\s*$
|
||||
);
|
||||
|
||||
# Things that should be enabled in "full" even if they match @excluded
|
||||
my @non_excluded = qw(
|
||||
PLATFORM_[A-Z0-9]+_ALT
|
||||
);
|
||||
|
||||
my $config_file = "include/mbedtls/config.h";
|
||||
|
||||
# get -f option
|
||||
|
@ -75,6 +80,7 @@ my @config_lines = <$config_read>;
|
|||
close $config_read;
|
||||
|
||||
my $exclude_re = join '|', @excluded;
|
||||
my $no_exclude_re = join '|', @non_excluded;
|
||||
|
||||
open my $config_write, '>', $config_file or die "write $config_file: $!\n";
|
||||
|
||||
|
@ -85,10 +91,12 @@ for my $line (@config_lines) {
|
|||
$done = 1;
|
||||
}
|
||||
|
||||
if (!$done && $line =~ m!^//\s?#define! && $line !~ /$exclude_re/) {
|
||||
if (!$done && $line =~ m!^//\s?#define! &&
|
||||
( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) ) {
|
||||
$line =~ s!^//\s?!!;
|
||||
}
|
||||
if (!$done && $line =~ m!^\s?#define! && $line =~ /$exclude_re/) {
|
||||
if (!$done && $line =~ m!^\s?#define! &&
|
||||
! ( $line !~ /$exclude_re/ || $line =~ /$no_exclude_re/ ) ) {
|
||||
$line =~ s!^!//!;
|
||||
}
|
||||
} elsif ($action eq "unset") {
|
||||
|
|
|
@ -152,6 +152,14 @@ scripts/config.pl unset MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
|||
scripts/config.pl unset MBEDTLS_FS_IO
|
||||
CC=gcc CFLAGS='-Werror -O0' make
|
||||
|
||||
# catch compile bugs in _uninit functions
|
||||
msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
|
||||
cleanup
|
||||
cp "$CONFIG_H" "$CONFIG_BAK"
|
||||
scripts/config.pl full
|
||||
scripts/config.pl set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
|
||||
CC=gcc CFLAGS='-Werror -O0' make
|
||||
|
||||
msg "build: full config except ssl_srv.c, make, gcc" # ~ 30s
|
||||
cleanup
|
||||
cp "$CONFIG_H" "$CONFIG_BAK"
|
||||
|
|
Loading…
Reference in a new issue