mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -46,21 +46,18 @@
|
||||
#endif
|
||||
|
||||
/** The type of test case arguments that contain binary data. */
|
||||
typedef struct data_tag
|
||||
{
|
||||
uint8_t * x;
|
||||
typedef struct data_tag {
|
||||
uint8_t *x;
|
||||
uint32_t len;
|
||||
} data_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
MBEDTLS_TEST_RESULT_SUCCESS = 0,
|
||||
MBEDTLS_TEST_RESULT_FAILED,
|
||||
MBEDTLS_TEST_RESULT_SKIPPED
|
||||
} mbedtls_test_result_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
mbedtls_test_result_t result;
|
||||
const char *test;
|
||||
const char *filename;
|
||||
@@ -75,8 +72,8 @@ typedef struct
|
||||
mbedtls_test_info_t;
|
||||
extern mbedtls_test_info_t mbedtls_test_info;
|
||||
|
||||
int mbedtls_test_platform_setup( void );
|
||||
void mbedtls_test_platform_teardown( void );
|
||||
int mbedtls_test_platform_setup(void);
|
||||
void mbedtls_test_platform_teardown(void);
|
||||
|
||||
/**
|
||||
* \brief Record the current test case as a failure.
|
||||
@@ -94,7 +91,7 @@ void mbedtls_test_platform_teardown( void );
|
||||
* \param line_no Line number where the failure originated.
|
||||
* \param filename Filename where the failure originated.
|
||||
*/
|
||||
void mbedtls_test_fail( const char *test, int line_no, const char* filename );
|
||||
void mbedtls_test_fail(const char *test, int line_no, const char *filename);
|
||||
|
||||
/**
|
||||
* \brief Record the current test case as skipped.
|
||||
@@ -107,7 +104,7 @@ void mbedtls_test_fail( const char *test, int line_no, const char* filename );
|
||||
* \param line_no Line number where the test case was skipped.
|
||||
* \param filename Filename where the test case was skipped.
|
||||
*/
|
||||
void mbedtls_test_skip( const char *test, int line_no, const char* filename );
|
||||
void mbedtls_test_skip(const char *test, int line_no, const char *filename);
|
||||
|
||||
/**
|
||||
* \brief Set the test step number for failure reports.
|
||||
@@ -119,12 +116,12 @@ void mbedtls_test_skip( const char *test, int line_no, const char* filename );
|
||||
*
|
||||
* \param step The step number to report.
|
||||
*/
|
||||
void mbedtls_test_set_step( unsigned long step );
|
||||
void mbedtls_test_set_step(unsigned long step);
|
||||
|
||||
/**
|
||||
* \brief Reset mbedtls_test_info to a ready/starting state.
|
||||
*/
|
||||
void mbedtls_test_info_reset( void );
|
||||
void mbedtls_test_info_reset(void);
|
||||
|
||||
/**
|
||||
* \brief Record the current test case as a failure if two integers
|
||||
@@ -144,8 +141,8 @@ void mbedtls_test_info_reset( void );
|
||||
*
|
||||
* \return \c 1 if the values are equal, otherwise \c 0.
|
||||
*/
|
||||
int mbedtls_test_equal( const char *test, int line_no, const char* filename,
|
||||
unsigned long long value1, unsigned long long value2 );
|
||||
int mbedtls_test_equal(const char *test, int line_no, const char *filename,
|
||||
unsigned long long value1, unsigned long long value2);
|
||||
|
||||
/**
|
||||
* \brief Record the current test case as a failure based
|
||||
@@ -165,8 +162,8 @@ int mbedtls_test_equal( const char *test, int line_no, const char* filename,
|
||||
*
|
||||
* \return \c 1 if \p value1 <= \p value2, otherwise \c 0.
|
||||
*/
|
||||
int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
|
||||
unsigned long long value1, unsigned long long value2 );
|
||||
int mbedtls_test_le_u(const char *test, int line_no, const char *filename,
|
||||
unsigned long long value1, unsigned long long value2);
|
||||
|
||||
/**
|
||||
* \brief Record the current test case as a failure based
|
||||
@@ -186,8 +183,8 @@ int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
|
||||
*
|
||||
* \return \c 1 if \p value1 <= \p value2, otherwise \c 0.
|
||||
*/
|
||||
int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
|
||||
long long value1, long long value2 );
|
||||
int mbedtls_test_le_s(const char *test, int line_no, const char *filename,
|
||||
long long value1, long long value2);
|
||||
|
||||
/**
|
||||
* \brief This function decodes the hexadecimal representation of
|
||||
@@ -207,12 +204,12 @@ int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
|
||||
* \return \c -1 if the output buffer is too small or the input string
|
||||
* is not a valid hexadecimal representation.
|
||||
*/
|
||||
int mbedtls_test_unhexify( unsigned char *obuf, size_t obufmax,
|
||||
const char *ibuf, size_t *len );
|
||||
int mbedtls_test_unhexify(unsigned char *obuf, size_t obufmax,
|
||||
const char *ibuf, size_t *len);
|
||||
|
||||
void mbedtls_test_hexify( unsigned char *obuf,
|
||||
const unsigned char *ibuf,
|
||||
int len );
|
||||
void mbedtls_test_hexify(unsigned char *obuf,
|
||||
const unsigned char *ibuf,
|
||||
int len);
|
||||
|
||||
/**
|
||||
* Allocate and zeroize a buffer.
|
||||
@@ -221,7 +218,7 @@ void mbedtls_test_hexify( unsigned char *obuf,
|
||||
*
|
||||
* For convenience, dies if allocation fails.
|
||||
*/
|
||||
unsigned char *mbedtls_test_zero_alloc( size_t len );
|
||||
unsigned char *mbedtls_test_zero_alloc(size_t len);
|
||||
|
||||
/**
|
||||
* Allocate and fill a buffer from hex data.
|
||||
@@ -233,15 +230,14 @@ unsigned char *mbedtls_test_zero_alloc( size_t len );
|
||||
*
|
||||
* For convenience, dies if allocation fails.
|
||||
*/
|
||||
unsigned char *mbedtls_test_unhexify_alloc( const char *ibuf, size_t *olen );
|
||||
unsigned char *mbedtls_test_unhexify_alloc(const char *ibuf, size_t *olen);
|
||||
|
||||
int mbedtls_test_hexcmp( uint8_t * a, uint8_t * b,
|
||||
uint32_t a_len, uint32_t b_len );
|
||||
int mbedtls_test_hexcmp(uint8_t *a, uint8_t *b,
|
||||
uint32_t a_len, uint32_t b_len);
|
||||
|
||||
#if defined(MBEDTLS_CHECK_PARAMS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
const char *failure_condition;
|
||||
const char *file;
|
||||
int line;
|
||||
@@ -257,7 +253,7 @@ mbedtls_test_param_failed_location_record_t;
|
||||
* mbedtls_param_failed() that cancels it.
|
||||
*/
|
||||
void mbedtls_test_param_failed_get_location_record(
|
||||
mbedtls_test_param_failed_location_record_t *location_record );
|
||||
mbedtls_test_param_failed_location_record_t *location_record);
|
||||
|
||||
/**
|
||||
* \brief State that a call to mbedtls_param_failed() is expected.
|
||||
@@ -266,7 +262,7 @@ void mbedtls_test_param_failed_get_location_record(
|
||||
* mbedtls_test_param_failed_check_expected_call() or
|
||||
* mbedtls_param_failed that cancel it.
|
||||
*/
|
||||
void mbedtls_test_param_failed_expect_call( void );
|
||||
void mbedtls_test_param_failed_expect_call(void);
|
||||
|
||||
/**
|
||||
* \brief Check whether mbedtls_param_failed() has been called as expected.
|
||||
@@ -279,7 +275,7 @@ void mbedtls_test_param_failed_expect_call( void );
|
||||
* mbedtls_param_failed() has been called.
|
||||
* \c -1 Otherwise.
|
||||
*/
|
||||
int mbedtls_test_param_failed_check_expected_call( void );
|
||||
int mbedtls_test_param_failed_check_expected_call(void);
|
||||
|
||||
/**
|
||||
* \brief Get the address of the object of type jmp_buf holding the execution
|
||||
@@ -308,7 +304,7 @@ int mbedtls_test_param_failed_check_expected_call( void );
|
||||
* \return Address of the object of type jmp_buf holding the execution state
|
||||
* information used by mbedtls_param_failed() to do a long jump.
|
||||
*/
|
||||
void* mbedtls_test_param_failed_get_state_buf( void );
|
||||
void *mbedtls_test_param_failed_get_state_buf(void);
|
||||
|
||||
/**
|
||||
* \brief Reset the execution state used by mbedtls_param_failed() to do a
|
||||
@@ -324,7 +320,7 @@ void* mbedtls_test_param_failed_get_state_buf( void );
|
||||
* mbedtls_param_failed() will not trigger a long jump with
|
||||
* undefined behavior but rather a long jump that will rather fault.
|
||||
*/
|
||||
void mbedtls_test_param_failed_reset_state( void );
|
||||
void mbedtls_test_param_failed_reset_state(void);
|
||||
#endif /* MBEDTLS_CHECK_PARAMS */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||
@@ -334,11 +330,11 @@ void mbedtls_test_param_failed_reset_state( void );
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
/** Permanently activate the mutex usage verification framework. See
|
||||
* threading_helpers.c for information. */
|
||||
void mbedtls_test_mutex_usage_init( void );
|
||||
void mbedtls_test_mutex_usage_init(void);
|
||||
|
||||
/** Call this function after executing a test case to check for mutex usage
|
||||
* errors. */
|
||||
void mbedtls_test_mutex_usage_check( void );
|
||||
void mbedtls_test_mutex_usage_check(void);
|
||||
#endif /* MBEDTLS_TEST_MUTEX_USAGE */
|
||||
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
@@ -353,8 +349,8 @@ void mbedtls_test_mutex_usage_check( void );
|
||||
*
|
||||
* \note If the check fails, fail the test currently being run.
|
||||
*/
|
||||
void mbedtls_test_err_add_check( int high, int low,
|
||||
const char *file, int line);
|
||||
void mbedtls_test_err_add_check(int high, int low,
|
||||
const char *file, int line);
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
@@ -379,7 +375,7 @@ void mbedtls_test_err_add_check( int high, int low,
|
||||
*
|
||||
* \return \c 0 on success, an \c MBEDTLS_ERR_MPI_xxx error code otherwise.
|
||||
*/
|
||||
int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s );
|
||||
int mbedtls_test_read_mpi(mbedtls_mpi *X, const char *s);
|
||||
|
||||
/** Nonzero if the current test case had an input parsed with
|
||||
* mbedtls_test_read_mpi() that is a negative 0 (`"-"`, `"-0"`, `"-00"`, etc.,
|
||||
|
Reference in New Issue
Block a user