Skip to content

Commit c08fc1d

Browse files
Move MIN and MAX macros from PSA tests to helpers.function
1 parent d76f181 commit c08fc1d

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

tests/suites/helpers.function

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,23 @@ typedef struct data_tag
202202
( STATIC_ASSERT_THEN_RETURN( IS_ARRAY_NOT_POINTER( array ), \
203203
ARRAY_LENGTH_UNSAFE( array ) ) )
204204

205+
/** Return the smaller of two values.
206+
*
207+
* \param x An integer-valued expression without side effects.
208+
* \param y An integer-valued expression without side effects.
209+
*
210+
* \return The smaller of \p x and \p y.
211+
*/
212+
#define MIN( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
213+
214+
/** Return the larger of two values.
215+
*
216+
* \param x An integer-valued expression without side effects.
217+
* \param y An integer-valued expression without side effects.
218+
*
219+
* \return The larger of \p x and \p y.
220+
*/
221+
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
205222

206223
/*
207224
* 32-bit integer manipulation macros (big endian)

tests/suites/test_suite_psa_crypto.function

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
#include "psa/crypto.h"
1313

14-
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
15-
1614
/** An invalid export length that will never be set by psa_export_key(). */
1715
static const size_t INVALID_EXPORT_LENGTH = ~0U;
1816

tests/suites/test_suite_psa_crypto_entropy.function

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
#include "mbedtls/entropy.h"
77
#include "mbedtls/entropy_poll.h"
88

9-
/* MAX value support macro */
10-
#if !defined(MAX)
11-
#define MAX(a,b) (((a)>(b))?(a):(b))
12-
#endif
13-
149
/* Calculating the minimum allowed entropy size in bytes */
1510
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
1611

tests/suites/test_suite_psa_crypto_init.function

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
#include "mbedtls/entropy.h"
1313
#include "mbedtls/entropy_poll.h"
1414

15-
#define MIN( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
16-
#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
17-
1815
#define ENTROPY_MIN_NV_SEED_SIZE \
1916
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
2017

0 commit comments

Comments
 (0)