Skip to content

Commit 15448cc

Browse files
Uncrustified with uncrustify 0.75.1.
Signed-off-by: Matthias Schulz <mschulz@hilscher.com>
1 parent c8ce6f8 commit 15448cc

File tree

1 file changed

+110
-110
lines changed

1 file changed

+110
-110
lines changed

programs/test/benchmark.c

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -103,56 +103,56 @@ static void mbedtls_set_alarm(int seconds);
103103
#define HEADER_FORMAT " %-24s : "
104104
#define TITLE_LEN 25
105105

106-
#define OPTIONS \
107-
"md5, ripemd160, sha1, sha256, sha512,\n" \
108-
"sha3_224, sha3_256, sha3_384, sha3_512,\n" \
109-
"des3, des, camellia, chacha20,\n" \
110-
"aes_cbc, aes_cfb128, aes_cfb8, aes_gcm, aes_ccm, aes_xts, chachapoly\n" \
111-
"aes_cmac, des3_cmac, poly1305\n" \
112-
"ctr_drbg, hmac_drbg\n" \
113-
"rsa, dhm, ecdsa, ecdh.\n"
106+
#define OPTIONS \
107+
"md5, ripemd160, sha1, sha256, sha512,\n" \
108+
"sha3_224, sha3_256, sha3_384, sha3_512,\n" \
109+
"des3, des, camellia, chacha20,\n" \
110+
"aes_cbc, aes_cfb128, aes_cfb8, aes_gcm, aes_ccm, aes_xts, chachapoly\n" \
111+
"aes_cmac, des3_cmac, poly1305\n" \
112+
"ctr_drbg, hmac_drbg\n" \
113+
"rsa, dhm, ecdsa, ecdh.\n"
114114

115115
#if defined(MBEDTLS_ERROR_C)
116-
#define PRINT_ERROR \
117-
mbedtls_strerror(ret, (char *) tmp, sizeof(tmp)); \
118-
mbedtls_printf("FAILED: %s\n", tmp);
116+
#define PRINT_ERROR \
117+
mbedtls_strerror(ret, (char *) tmp, sizeof(tmp)); \
118+
mbedtls_printf("FAILED: %s\n", tmp);
119119
#else
120-
#define PRINT_ERROR \
121-
mbedtls_printf("FAILED: -0x%04x\n", (unsigned int) -ret);
120+
#define PRINT_ERROR \
121+
mbedtls_printf("FAILED: -0x%04x\n", (unsigned int) -ret);
122122
#endif
123123

124-
#define TIME_AND_TSC(TITLE, CODE) \
125-
do { \
126-
unsigned long ii, jj, tsc; \
127-
int ret = 0; \
128-
\
129-
mbedtls_printf(HEADER_FORMAT, TITLE); \
130-
fflush(stdout); \
131-
\
132-
mbedtls_set_alarm(1); \
133-
for (ii = 1; ret == 0 && !mbedtls_timing_alarmed; ii++) \
134-
{ \
135-
ret = CODE; \
136-
} \
137-
\
138-
tsc = mbedtls_timing_hardclock(); \
139-
for (jj = 0; ret == 0 && jj < 1024; jj++) \
140-
{ \
141-
ret = CODE; \
142-
} \
143-
\
144-
if (ret != 0) \
145-
{ \
146-
PRINT_ERROR; \
147-
} \
148-
else \
149-
{ \
150-
mbedtls_printf("%9lu KiB/s, %9lu cycles/byte\n", \
151-
ii * BUFSIZE / 1024, \
152-
(mbedtls_timing_hardclock() - tsc) \
153-
/ (jj * BUFSIZE)); \
154-
} \
155-
} while (0)
124+
#define TIME_AND_TSC(TITLE, CODE) \
125+
do { \
126+
unsigned long ii, jj, tsc; \
127+
int ret = 0; \
128+
\
129+
mbedtls_printf(HEADER_FORMAT, TITLE); \
130+
fflush(stdout); \
131+
\
132+
mbedtls_set_alarm(1); \
133+
for (ii = 1; ret == 0 && !mbedtls_timing_alarmed; ii++) \
134+
{ \
135+
ret = CODE; \
136+
} \
137+
\
138+
tsc = mbedtls_timing_hardclock(); \
139+
for (jj = 0; ret == 0 && jj < 1024; jj++) \
140+
{ \
141+
ret = CODE; \
142+
} \
143+
\
144+
if (ret != 0) \
145+
{ \
146+
PRINT_ERROR; \
147+
} \
148+
else \
149+
{ \
150+
mbedtls_printf("%9lu KiB/s, %9lu cycles/byte\n", \
151+
ii * BUFSIZE / 1024, \
152+
(mbedtls_timing_hardclock() - tsc) \
153+
/ (jj * BUFSIZE)); \
154+
} \
155+
} while (0)
156156

157157
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
158158

@@ -167,67 +167,67 @@ static void mbedtls_set_alarm(int seconds);
167167
* is poor alignment.) */
168168
#define TITLE_SPACE 17
169169

170-
#define MEMORY_MEASURE_INIT \
171-
size_t max_used, max_blocks, max_bytes; \
172-
size_t prv_used, prv_blocks; \
173-
size_t alloc_cnt, free_cnt, prv_alloc, prv_free; \
174-
mbedtls_memory_buffer_alloc_cur_get(&prv_used, &prv_blocks); \
175-
mbedtls_memory_buffer_alloc_max_reset();
176-
177-
#define MEMORY_MEASURE_RESET \
178-
mbedtls_memory_buffer_alloc_count_get(&prv_alloc, &prv_free);
179-
180-
#define MEMORY_MEASURE_PRINT(title_len) \
181-
mbedtls_memory_buffer_alloc_max_get(&max_used, &max_blocks); \
182-
mbedtls_memory_buffer_alloc_count_get(&alloc_cnt, &free_cnt); \
183-
ii = TITLE_SPACE > (title_len) ? TITLE_SPACE - (title_len) : 1; \
184-
while (ii--) mbedtls_printf(" "); \
185-
max_used -= prv_used; \
186-
max_blocks -= prv_blocks; \
187-
max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
188-
mbedtls_printf("%6u heap bytes, %6u allocs", \
189-
(unsigned) max_bytes, \
190-
(unsigned) (alloc_cnt - prv_alloc));
170+
#define MEMORY_MEASURE_INIT \
171+
size_t max_used, max_blocks, max_bytes; \
172+
size_t prv_used, prv_blocks; \
173+
size_t alloc_cnt, free_cnt, prv_alloc, prv_free; \
174+
mbedtls_memory_buffer_alloc_cur_get(&prv_used, &prv_blocks); \
175+
mbedtls_memory_buffer_alloc_max_reset();
176+
177+
#define MEMORY_MEASURE_RESET \
178+
mbedtls_memory_buffer_alloc_count_get(&prv_alloc, &prv_free);
179+
180+
#define MEMORY_MEASURE_PRINT(title_len) \
181+
mbedtls_memory_buffer_alloc_max_get(&max_used, &max_blocks); \
182+
mbedtls_memory_buffer_alloc_count_get(&alloc_cnt, &free_cnt); \
183+
ii = TITLE_SPACE > (title_len) ? TITLE_SPACE - (title_len) : 1; \
184+
while (ii--) mbedtls_printf(" "); \
185+
max_used -= prv_used; \
186+
max_blocks -= prv_blocks; \
187+
max_bytes = max_used + MEM_BLOCK_OVERHEAD * max_blocks; \
188+
mbedtls_printf("%6u heap bytes, %6u allocs", \
189+
(unsigned) max_bytes, \
190+
(unsigned) (alloc_cnt - prv_alloc));
191191

192192
#else
193193
#define MEMORY_MEASURE_INIT
194194
#define MEMORY_MEASURE_RESET
195195
#define MEMORY_MEASURE_PRINT(title_len)
196196
#endif
197197

198-
#define TIME_PUBLIC(TITLE, TYPE, CODE) \
199-
do { \
200-
unsigned long ii; \
201-
int ret; \
202-
MEMORY_MEASURE_INIT; \
203-
\
204-
mbedtls_printf(HEADER_FORMAT, TITLE); \
205-
fflush(stdout); \
206-
mbedtls_set_alarm(3); \
207-
\
208-
ret = 0; \
209-
for (ii = 1; !mbedtls_timing_alarmed && !ret; ii++) \
210-
{ \
211-
MEMORY_MEASURE_RESET; \
212-
CODE; \
213-
} \
214-
\
215-
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) \
216-
{ \
217-
mbedtls_printf("Feature Not Supported. Skipping.\n"); \
218-
ret = 0; \
219-
} \
220-
else if (ret != 0) \
221-
{ \
222-
PRINT_ERROR; \
223-
} \
224-
else \
225-
{ \
226-
mbedtls_printf("%6lu " TYPE "/s", ii / 3); \
227-
MEMORY_MEASURE_PRINT(sizeof(TYPE) + 1); \
228-
mbedtls_printf("\n"); \
229-
} \
230-
} while (0)
198+
#define TIME_PUBLIC(TITLE, TYPE, CODE) \
199+
do { \
200+
unsigned long ii; \
201+
int ret; \
202+
MEMORY_MEASURE_INIT; \
203+
\
204+
mbedtls_printf(HEADER_FORMAT, TITLE); \
205+
fflush(stdout); \
206+
mbedtls_set_alarm(3); \
207+
\
208+
ret = 0; \
209+
for (ii = 1; !mbedtls_timing_alarmed && !ret; ii++) \
210+
{ \
211+
MEMORY_MEASURE_RESET; \
212+
CODE; \
213+
} \
214+
\
215+
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) \
216+
{ \
217+
mbedtls_printf("Feature Not Supported. Skipping.\n"); \
218+
ret = 0; \
219+
} \
220+
else if (ret != 0) \
221+
{ \
222+
PRINT_ERROR; \
223+
} \
224+
else \
225+
{ \
226+
mbedtls_printf("%6lu " TYPE "/s", ii / 3); \
227+
MEMORY_MEASURE_PRINT(sizeof(TYPE) + 1); \
228+
mbedtls_printf("\n"); \
229+
} \
230+
} while (0)
231231

232232
#if !defined(HAVE_HARDCLOCK) && defined(MBEDTLS_HAVE_ASM) && \
233233
(defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
@@ -468,17 +468,17 @@ static int myrand(void *rng_state, unsigned char *output, size_t len)
468468
return 0;
469469
}
470470

471-
#define CHECK_AND_CONTINUE(R) \
472-
{ \
473-
int CHECK_AND_CONTINUE_ret = (R); \
474-
if (CHECK_AND_CONTINUE_ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) { \
475-
mbedtls_printf("Feature not supported. Skipping.\n"); \
476-
continue; \
477-
} \
478-
else if (CHECK_AND_CONTINUE_ret != 0) { \
479-
mbedtls_exit(1); \
480-
} \
481-
}
471+
#define CHECK_AND_CONTINUE(R) \
472+
{ \
473+
int CHECK_AND_CONTINUE_ret = (R); \
474+
if (CHECK_AND_CONTINUE_ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED) { \
475+
mbedtls_printf("Feature not supported. Skipping.\n"); \
476+
continue; \
477+
} \
478+
else if (CHECK_AND_CONTINUE_ret != 0) { \
479+
mbedtls_exit(1); \
480+
} \
481+
}
482482

483483
#if defined(MBEDTLS_ECP_C)
484484
static int set_ecp_curve(const char *string, mbedtls_ecp_curve_info *curve)

0 commit comments

Comments
 (0)