1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Switch to the new code style

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2023-01-11 14:52:35 +01:00
parent 480f683d15
commit 1b6c09a62e
391 changed files with 73134 additions and 75084 deletions

View File

@ -68,11 +68,11 @@ jmp_buf jmp_tmp;
/* Indicates whether we expect mbedtls_entropy_init
* to initialize some strong entropy source. */
#if defined(MBEDTLS_TEST_NULL_ENTROPY) || \
( !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
( !defined(MBEDTLS_NO_PLATFORM_ENTROPY) || \
defined(MBEDTLS_HAVEGE_C) || \
defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
defined(ENTROPY_NV_SEED) ) )
(!defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
(!defined(MBEDTLS_NO_PLATFORM_ENTROPY) || \
defined(MBEDTLS_HAVEGE_C) || \
defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
defined(ENTROPY_NV_SEED)))
#define ENTROPY_HAVE_STRONG
#endif
@ -87,65 +87,60 @@ jmp_buf jmp_tmp;
*
* \return 0 if the key store is empty, 1 otherwise.
*/
int test_fail_if_psa_leaking( int line_no, const char *filename )
int test_fail_if_psa_leaking(int line_no, const char *filename)
{
const char *msg = mbedtls_test_helper_is_psa_leaking( );
if( msg == NULL )
const char *msg = mbedtls_test_helper_is_psa_leaking();
if (msg == NULL) {
return 0;
else
{
mbedtls_test_fail( msg, line_no, filename );
} else {
mbedtls_test_fail(msg, line_no, filename);
return 1;
}
}
#endif /* defined(MBEDTLS_PSA_CRYPTO_C) */
#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 out_fd, dup_fd;
FILE* path_stream;
FILE *path_stream;
out_fd = fileno( out_stream );
dup_fd = dup( out_fd );
out_fd = fileno(out_stream);
dup_fd = dup(out_fd);
if( dup_fd == -1 )
{
return( -1 );
if (dup_fd == -1) {
return -1;
}
path_stream = fopen( path, "w" );
if( path_stream == NULL )
{
close( dup_fd );
return( -1 );
path_stream = fopen(path, "w");
if (path_stream == NULL) {
close(dup_fd);
return -1;
}
fflush( out_stream );
if( dup2( fileno( path_stream ), out_fd ) == -1 )
{
close( dup_fd );
fclose( path_stream );
return( -1 );
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 );
fclose(path_stream);
return dup_fd;
}
static int restore_output( FILE* out_stream, int dup_fd )
static int restore_output(FILE *out_stream, int dup_fd)
{
int out_fd = fileno( out_stream );
int out_fd = fileno(out_stream);
fflush( out_stream );
if( dup2( dup_fd, out_fd ) == -1 )
{
close( out_fd );
close( dup_fd );
return( -1 );
fflush(out_stream);
if (dup2(dup_fd, out_fd) == -1) {
close(out_fd);
close(dup_fd);
return -1;
}
close( dup_fd );
return( 0 );
close(dup_fd);
return 0;
}
#endif /* __unix__ || __APPLE__ __MACH__ */