mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Merge branch 'mbedtls-2.7' into mbedtls-2.7-restricted
* mbedtls-2.7: (28 commits) A different approach of signed-to-unsigned comparison Update the copy of tests/data_files/server2-sha256.crt in certs.c Fix bug in redirection of unit test outputs Backport e2k support to mbedtls-2.7 Don't forget to free G, P, Q, ctr_drbg, and entropy Regenerate server2-sha256.crt with a PrintableString issuer Regenerate test client certificates with a PrintableString issuer cert_write: support all hash algorithms compat.sh: stop using allow_sha1 compat.sh: quit using SHA-1 certificates compat.sh: enable CBC-SHA-2 suites for GnuTLS Fix license header in pre-commit hook Update copyright notices to use Linux Foundation guidance Fix building on NetBSD 9.0 Remove obsolete buildbot reference in compat.sh Fix misuse of printf in shell script Fix added proxy command when IPv6 is used Simplify test syntax Fix logic error in setting client port ssl-opt.sh: include test name in log files ...
This commit is contained in:
commit
d863a67a74
283 changed files with 577 additions and 976 deletions
|
|
@ -103,7 +103,7 @@ typedef UINT32 uint32_t;
|
|||
/* A compile-time constant with the value 0. If `const_expr` is not a
|
||||
* compile-time constant with a nonzero value, cause a compile-time error. */
|
||||
#define STATIC_ASSERT_EXPR( const_expr ) \
|
||||
( 0 && sizeof( struct { int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
|
||||
( 0 && sizeof( struct { unsigned int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
|
||||
/* Return the scalar value `value` (possibly promoted). This is a compile-time
|
||||
* constant if `value` is. `condition` must be a compile-time constant.
|
||||
* If `condition` is false, arrange to cause a compile-time error. */
|
||||
|
|
@ -188,45 +188,52 @@ void test_fail( const char *test, int line_no, const char* filename )
|
|||
}
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
static int redirect_output( FILE** out_stream, const char* path )
|
||||
static int redirect_output( FILE* out_stream, const char* path )
|
||||
{
|
||||
int stdout_fd = dup( fileno( *out_stream ) );
|
||||
int out_fd, dup_fd;
|
||||
FILE* path_stream;
|
||||
|
||||
if( stdout_fd == -1 )
|
||||
out_fd = fileno( out_stream );
|
||||
dup_fd = dup( out_fd );
|
||||
|
||||
if( dup_fd == -1 )
|
||||
{
|
||||
return -1;
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fflush( *out_stream );
|
||||
fclose( *out_stream );
|
||||
*out_stream = fopen( path, "w" );
|
||||
|
||||
if( *out_stream == NULL )
|
||||
path_stream = fopen( path, "w" );
|
||||
if( path_stream == NULL )
|
||||
{
|
||||
close( stdout_fd );
|
||||
return -1;
|
||||
close( dup_fd );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return stdout_fd;
|
||||
fflush( out_stream );
|
||||
if( dup2( fileno( path_stream ), out_fd ) == -1 )
|
||||
{
|
||||
close( dup_fd );
|
||||
fclose( path_stream );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fclose( path_stream );
|
||||
return( dup_fd );
|
||||
}
|
||||
|
||||
static int restore_output( FILE** out_stream, int old_fd )
|
||||
static int restore_output( FILE* out_stream, int dup_fd )
|
||||
{
|
||||
fflush( *out_stream );
|
||||
fclose( *out_stream );
|
||||
int out_fd = fileno( out_stream );
|
||||
|
||||
*out_stream = fdopen( old_fd, "w" );
|
||||
if( *out_stream == NULL )
|
||||
fflush( out_stream );
|
||||
if( dup2( dup_fd, out_fd ) == -1 )
|
||||
{
|
||||
return -1;
|
||||
close( out_fd );
|
||||
close( dup_fd );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_output( FILE* out_stream )
|
||||
{
|
||||
fclose( out_stream );
|
||||
close( dup_fd );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
|
||||
|
|
@ -346,7 +353,7 @@ unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
|
|||
*/
|
||||
static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||
{
|
||||
#if !defined(__OpenBSD__)
|
||||
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
|
||||
size_t i;
|
||||
|
||||
if( rng_state != NULL )
|
||||
|
|
@ -359,7 +366,7 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
|||
rng_state = NULL;
|
||||
|
||||
arc4random_buf( output, len );
|
||||
#endif /* !OpenBSD */
|
||||
#endif /* !OpenBSD && !NetBSD */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue