mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 01:24:16 +01:00
Merge pull request #357 from gilles-peskine-arm/merge-crypto-development-20200203
Update Mbed Crypto with latest Mbed TLS changes as of 2020-02-03
This commit is contained in:
commit
4fde885d1f
@ -55,7 +55,7 @@
|
|||||||
* Low-level module errors (0x0002-0x007E, 0x0001-0x007F)
|
* Low-level module errors (0x0002-0x007E, 0x0001-0x007F)
|
||||||
*
|
*
|
||||||
* Module Nr Codes assigned
|
* Module Nr Codes assigned
|
||||||
* ERROR 2 0x006E 0x0001
|
* ERROR 2 0x006E 0x0001
|
||||||
* MPI 7 0x0002-0x0010
|
* MPI 7 0x0002-0x0010
|
||||||
* GCM 3 0x0012-0x0014 0x0013-0x0013
|
* GCM 3 0x0012-0x0014 0x0013-0x0013
|
||||||
* BLOWFISH 3 0x0016-0x0018 0x0017-0x0017
|
* BLOWFISH 3 0x0016-0x0018 0x0017-0x0017
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
#include MBEDTLS_CONFIG_FILE
|
#include MBEDTLS_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||||
#include "mbedtls/error.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ int main( int argc, char *argv[] )
|
|||||||
unsigned char IV[16];
|
unsigned char IV[16];
|
||||||
unsigned char tmp[16];
|
unsigned char tmp[16];
|
||||||
unsigned char key[512];
|
unsigned char key[512];
|
||||||
unsigned char digest[32];
|
unsigned char digest[64];
|
||||||
unsigned char buffer[1024];
|
unsigned char buffer[1024];
|
||||||
unsigned char diff;
|
unsigned char diff;
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
## This file is part of Mbed TLS (https://tls.mbed.org)
|
## This file is part of Mbed TLS (https://tls.mbed.org)
|
||||||
|
|
||||||
my $py = $0;
|
my $py = $0;
|
||||||
$py =~ s/\.pl$/.py/;
|
$py =~ s/\.pl$/.py/ or die "Unable to determine the name of the Python script";
|
||||||
exec 'python3', $py, @ARGV;
|
exec 'python3', $py, @ARGV;
|
||||||
print STDERR "$0: python3: $!\n";
|
print STDERR "$0: python3: $!. Trying python instead.\n";
|
||||||
exec 'python', $py, @ARGV;
|
exec 'python', $py, @ARGV;
|
||||||
print STDERR "$0: python: $!\n";
|
print STDERR "$0: python: $!\n";
|
||||||
exit 127;
|
exit 127;
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
#include MBEDTLS_CONFIG_FILE
|
#include MBEDTLS_CONFIG_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||||
#include "mbedtls/error.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -311,11 +311,11 @@ typedef enum
|
|||||||
#define TEST_VALID_PARAM( TEST ) \
|
#define TEST_VALID_PARAM( TEST ) \
|
||||||
TEST_ASSERT( ( TEST, 1 ) );
|
TEST_ASSERT( ( TEST, 1 ) );
|
||||||
|
|
||||||
#define TEST_HELPER_ASSERT(a) if( !( a ) ) \
|
#define TEST_HELPER_ASSERT(a) if( !( a ) ) \
|
||||||
{ \
|
{ \
|
||||||
mbedtls_fprintf( stderr, "Assertion Failed at %s:%d - %s\n", \
|
mbedtls_fprintf( stderr, "Assertion Failed at %s:%d - %s\n", \
|
||||||
__FILE__, __LINE__, #a ); \
|
__FILE__, __LINE__, #a ); \
|
||||||
mbedtls_exit( 1 ); \
|
mbedtls_exit( 1 ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
@ -370,6 +370,38 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
|
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
|
||||||
|
|
||||||
|
/** Allocate memory dynamically and fail the test case if this fails.
|
||||||
|
*
|
||||||
|
* You must set \p pointer to \c NULL before calling this macro and
|
||||||
|
* put `mbedtls_free( pointer )` in the test's cleanup code.
|
||||||
|
*
|
||||||
|
* If \p length is zero, the resulting \p pointer will be \c NULL.
|
||||||
|
* This is usually what we want in tests since API functions are
|
||||||
|
* supposed to accept null pointers when a buffer size is zero.
|
||||||
|
*
|
||||||
|
* This macro expands to an instruction, not an expression.
|
||||||
|
* It may jump to the \c exit label.
|
||||||
|
*
|
||||||
|
* \param pointer An lvalue where the address of the allocated buffer
|
||||||
|
* will be stored.
|
||||||
|
* This expression may be evaluated multiple times.
|
||||||
|
* \param length Number of elements to allocate.
|
||||||
|
* This expression may be evaluated multiple times.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ASSERT_ALLOC( pointer, length ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
TEST_ASSERT( ( pointer ) == NULL ); \
|
||||||
|
if( ( length ) != 0 ) \
|
||||||
|
{ \
|
||||||
|
( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
|
||||||
|
( length ) ); \
|
||||||
|
TEST_ASSERT( ( pointer ) != NULL ); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while( 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (big endian)
|
* 32-bit integer manipulation macros (big endian)
|
||||||
*/
|
*/
|
||||||
|
@ -525,15 +525,6 @@ int execute_tests( int argc , const char ** argv )
|
|||||||
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
|
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( outcome_file_name != NULL )
|
|
||||||
{
|
|
||||||
outcome_file = fopen( outcome_file_name, "a" );
|
|
||||||
if( outcome_file == NULL )
|
|
||||||
{
|
|
||||||
mbedtls_fprintf( stderr, "Unable to open outcome file. Continuing anyway.\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The C standard doesn't guarantee that all-bits-0 is the representation
|
* The C standard doesn't guarantee that all-bits-0 is the representation
|
||||||
* of a NULL pointer. We do however use that in our code for initializing
|
* of a NULL pointer. We do however use that in our code for initializing
|
||||||
@ -555,6 +546,15 @@ int execute_tests( int argc , const char ** argv )
|
|||||||
return( 1 );
|
return( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( outcome_file_name != NULL )
|
||||||
|
{
|
||||||
|
outcome_file = fopen( outcome_file_name, "a" );
|
||||||
|
if( outcome_file == NULL )
|
||||||
|
{
|
||||||
|
mbedtls_fprintf( stderr, "Unable to open outcome file. Continuing anyway.\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while( arg_index < argc )
|
while( arg_index < argc )
|
||||||
{
|
{
|
||||||
next_arg = argv[arg_index];
|
next_arg = argv[arg_index];
|
||||||
@ -607,6 +607,8 @@ int execute_tests( int argc , const char ** argv )
|
|||||||
{
|
{
|
||||||
mbedtls_fprintf( stderr, "Failed to open test file: %s\n",
|
mbedtls_fprintf( stderr, "Failed to open test file: %s\n",
|
||||||
test_filename );
|
test_filename );
|
||||||
|
if( outcome_file != NULL )
|
||||||
|
fclose( outcome_file );
|
||||||
return( 1 );
|
return( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user