blob: ed5d4146c26b38c38ce28bbade06906d894df163 [file] [log] [blame]
SimonB15942102016-04-25 21:34:49 +01001#line 1 "main_test.function"
Paul Bakkerde56ca12013-09-15 17:05:21 +02002SUITE_PRE_DEP
3#define TEST_SUITE_ACTIVE
4
Paul Bakker19343182013-08-16 13:31:10 +02005int verify_string( char **str )
6{
7 if( (*str)[0] != '"' ||
8 (*str)[strlen( *str ) - 1] != '"' )
9 {
Simon Butcher25731362016-09-30 13:11:29 +010010 mbedtls_fprintf( stderr,
11 "Expected string (with \"\") for parameter and got: %s\n", *str );
Paul Bakker19343182013-08-16 13:31:10 +020012 return( -1 );
13 }
14
15 (*str)++;
16 (*str)[strlen( *str ) - 1] = '\0';
17
18 return( 0 );
19}
20
21int verify_int( char *str, int *value )
22{
23 size_t i;
24 int minus = 0;
25 int digits = 1;
26 int hex = 0;
27
28 for( i = 0; i < strlen( str ); i++ )
29 {
30 if( i == 0 && str[i] == '-' )
31 {
32 minus = 1;
33 continue;
34 }
35
36 if( ( ( minus && i == 2 ) || ( !minus && i == 1 ) ) &&
37 str[i - 1] == '0' && str[i] == 'x' )
38 {
39 hex = 1;
40 continue;
41 }
42
Manuel Pégourié-Gonnard725afd82014-02-01 11:54:28 +010043 if( ! ( ( str[i] >= '0' && str[i] <= '9' ) ||
44 ( hex && ( ( str[i] >= 'a' && str[i] <= 'f' ) ||
45 ( str[i] >= 'A' && str[i] <= 'F' ) ) ) ) )
Paul Bakker19343182013-08-16 13:31:10 +020046 {
47 digits = 0;
48 break;
49 }
50 }
51
52 if( digits )
53 {
54 if( hex )
55 *value = strtol( str, NULL, 16 );
56 else
57 *value = strtol( str, NULL, 10 );
58
59 return( 0 );
60 }
61
62MAPPING_CODE
63
Simon Butcher25731362016-09-30 13:11:29 +010064 mbedtls_fprintf( stderr,
65 "Expected integer for parameter and got: %s\n", str );
SimonB8ca7bc42016-04-17 23:24:50 +010066 return( KEY_VALUE_MAPPING_NOT_FOUND );
Paul Bakker19343182013-08-16 13:31:10 +020067}
68
SimonB152ea182016-02-15 23:27:28 +000069
70/*----------------------------------------------------------------------------*/
71/* Test Case code */
72
Paul Bakkerde56ca12013-09-15 17:05:21 +020073FUNCTION_CODE
74SUITE_POST_DEP
75
SimonB15942102016-04-25 21:34:49 +010076#line !LINE_NO! "main_test.function"
77
SimonB152ea182016-02-15 23:27:28 +000078
79/*----------------------------------------------------------------------------*/
80/* Test dispatch code */
81
Simon Butcher25731362016-09-30 13:11:29 +010082#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
83#include <unistd.h>
84#endif
85#include <stdio.h>
86
87
Paul Bakker19343182013-08-16 13:31:10 +020088int dep_check( char *str )
89{
90 if( str == NULL )
91 return( 1 );
92
93DEP_CHECK_CODE
Simon Butcher65b1fa62016-05-23 23:18:26 +010094#line !LINE_NO! "main_test.function"
Paul Bakker19343182013-08-16 13:31:10 +020095
SimonB8ca7bc42016-04-17 23:24:50 +010096 return( DEPENDENCY_NOT_SUPPORTED );
Paul Bakker19343182013-08-16 13:31:10 +020097}
98
Paul Bakker19343182013-08-16 13:31:10 +020099int dispatch_test(int cnt, char *params[50])
100{
101 int ret;
Paul Bakkerb34fef22013-08-20 12:06:33 +0200102 ((void) cnt);
103 ((void) params);
Paul Bakker19343182013-08-16 13:31:10 +0200104
Paul Bakkerb34fef22013-08-20 12:06:33 +0200105#if defined(TEST_SUITE_ACTIVE)
SimonB8ca7bc42016-04-17 23:24:50 +0100106 ret = DISPATCH_TEST_SUCCESS;
107
Simon Butcher65b1fa62016-05-23 23:18:26 +0100108 // Cast to void to avoid compiler warnings
109 (void)ret;
110
Paul Bakker19343182013-08-16 13:31:10 +0200111DISPATCH_FUNCTION
112 {
Simon Butcher65b1fa62016-05-23 23:18:26 +0100113#line !LINE_NO! "main_test.function"
SimonB8ca7bc42016-04-17 23:24:50 +0100114 mbedtls_fprintf( stdout,
115 "FAILED\nSkipping unknown test function '%s'\n",
116 params[0] );
Paul Bakker19343182013-08-16 13:31:10 +0200117 fflush( stdout );
SimonB8ca7bc42016-04-17 23:24:50 +0100118 ret = DISPATCH_TEST_FN_NOT_FOUND;
Paul Bakker19343182013-08-16 13:31:10 +0200119 }
Paul Bakkerb34fef22013-08-20 12:06:33 +0200120#else
SimonB8ca7bc42016-04-17 23:24:50 +0100121 ret = DISPATCH_UNSUPPORTED_SUITE;
Paul Bakkerb34fef22013-08-20 12:06:33 +0200122#endif
Paul Bakker19343182013-08-16 13:31:10 +0200123 return( ret );
124}
125
SimonB152ea182016-02-15 23:27:28 +0000126
127/*----------------------------------------------------------------------------*/
128/* Main Test code */
129
SimonB15942102016-04-25 21:34:49 +0100130#line !LINE_NO! "main_test.function"
131
SimonB8ca7bc42016-04-17 23:24:50 +0100132#define USAGE \
133 "Usage: %s [OPTIONS] files...\n\n" \
134 " Command line arguments:\n" \
135 " files... One or more test data file. If no file is specified\n" \
136 " the followimg default test case is used:\n" \
137 " %s\n\n" \
138 " Options:\n" \
139 " -v | --verbose Display full information about each test\n" \
140 " -h | --help Display this information\n\n", \
141 argv[0], \
SimonB15942102016-04-25 21:34:49 +0100142 "TESTCASE_FILENAME"
SimonB8ca7bc42016-04-17 23:24:50 +0100143
144
Paul Bakker19343182013-08-16 13:31:10 +0200145int get_line( FILE *f, char *buf, size_t len )
146{
147 char *ret;
148
149 ret = fgets( buf, len, f );
150 if( ret == NULL )
151 return( -1 );
152
153 if( strlen( buf ) && buf[strlen(buf) - 1] == '\n' )
154 buf[strlen(buf) - 1] = '\0';
155 if( strlen( buf ) && buf[strlen(buf) - 1] == '\r' )
156 buf[strlen(buf) - 1] = '\0';
157
158 return( 0 );
159}
160
161int parse_arguments( char *buf, size_t len, char *params[50] )
162{
163 int cnt = 0, i;
164 char *cur = buf;
165 char *p = buf, *q;
166
167 params[cnt++] = cur;
168
169 while( *p != '\0' && p < buf + len )
170 {
171 if( *p == '\\' )
172 {
Manuel Pégourié-Gonnard2d5f1422014-01-22 16:01:17 +0100173 p++;
174 p++;
Paul Bakker19343182013-08-16 13:31:10 +0200175 continue;
176 }
177 if( *p == ':' )
178 {
179 if( p + 1 < buf + len )
180 {
181 cur = p + 1;
182 params[cnt++] = cur;
183 }
184 *p = '\0';
185 }
186
Manuel Pégourié-Gonnard2d5f1422014-01-22 16:01:17 +0100187 p++;
Paul Bakker19343182013-08-16 13:31:10 +0200188 }
189
SimonB0269dad2016-02-17 23:34:30 +0000190 /* Replace newlines, question marks and colons in strings */
Paul Bakker19343182013-08-16 13:31:10 +0200191 for( i = 0; i < cnt; i++ )
192 {
193 p = params[i];
194 q = params[i];
195
196 while( *p != '\0' )
197 {
198 if( *p == '\\' && *(p + 1) == 'n' )
199 {
200 p += 2;
201 *(q++) = '\n';
202 }
203 else if( *p == '\\' && *(p + 1) == ':' )
204 {
205 p += 2;
206 *(q++) = ':';
207 }
208 else if( *p == '\\' && *(p + 1) == '?' )
209 {
210 p += 2;
211 *(q++) = '?';
212 }
213 else
214 *(q++) = *(p++);
215 }
216 *q = '\0';
217 }
218
219 return( cnt );
220}
221
Manuel Pégourié-Gonnard7b6dcbe2015-06-22 10:48:01 +0200222static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
223{
224 int ret;
225 char buf[10] = "xxxxxxxxx";
Manuel Pégourié-Gonnard4b00f082015-06-26 11:24:32 +0200226 const char ref[10] = "xxxxxxxxx";
Manuel Pégourié-Gonnard7b6dcbe2015-06-22 10:48:01 +0200227
228 ret = mbedtls_snprintf( buf, n, "%s", "123" );
229 if( ret < 0 || (size_t) ret >= n )
230 ret = -1;
231
Manuel Pégourié-Gonnard4b00f082015-06-26 11:24:32 +0200232 if( strncmp( ref_buf, buf, sizeof( buf ) ) != 0 ||
233 ref_ret != ret ||
234 memcmp( buf + n, ref + n, sizeof( buf ) - n ) != 0 )
Manuel Pégourié-Gonnard7b6dcbe2015-06-22 10:48:01 +0200235 {
236 return( 1 );
237 }
238
239 return( 0 );
240}
241
242static int run_test_snprintf( void )
243{
244 return( test_snprintf( 0, "xxxxxxxxx", -1 ) != 0 ||
Manuel Pégourié-Gonnard4b00f082015-06-26 11:24:32 +0200245 test_snprintf( 1, "", -1 ) != 0 ||
246 test_snprintf( 2, "1", -1 ) != 0 ||
247 test_snprintf( 3, "12", -1 ) != 0 ||
248 test_snprintf( 4, "123", 3 ) != 0 ||
249 test_snprintf( 5, "123", 3 ) != 0 );
Manuel Pégourié-Gonnard7b6dcbe2015-06-22 10:48:01 +0200250}
251
Simon Butcheraad787f2016-01-26 22:13:58 +0000252int main(int argc, const char *argv[])
Paul Bakker19343182013-08-16 13:31:10 +0200253{
SimonB8ca7bc42016-04-17 23:24:50 +0100254 /* Local Configurations and options */
SimonB15942102016-04-25 21:34:49 +0100255 const char *default_filename = "TESTCASE_FILENAME";
Simon Butcheraad787f2016-01-26 22:13:58 +0000256 const char *test_filename = NULL;
257 const char **test_files = NULL;
SimonB8ca7bc42016-04-17 23:24:50 +0100258 int testfile_count = 0;
259 int option_verbose = 0;
Simon Butcher25731362016-09-30 13:11:29 +0100260 int tests_stdout;
SimonB8ca7bc42016-04-17 23:24:50 +0100261
262 /* Other Local variables */
263 int arg_index = 1;
264 const char *next_arg;
265 int testfile_index, ret, i, cnt;
266 int total_errors = 0, total_tests = 0, total_skipped = 0;
Paul Bakker19343182013-08-16 13:31:10 +0200267 FILE *file;
268 char buf[5000];
269 char *params[50];
Manuel Pégourié-Gonnardd14acbc2015-05-29 11:26:37 +0200270 void *pointer;
Paul Bakker19343182013-08-16 13:31:10 +0200271
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200272#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
Manuel Pégourié-Gonnard765bb312014-11-27 11:55:27 +0100273 !defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
Paul Bakker1337aff2013-09-29 14:45:34 +0200274 unsigned char alloc_buf[1000000];
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200275 mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
Paul Bakker19343182013-08-16 13:31:10 +0200276#endif
277
Manuel Pégourié-Gonnardd14acbc2015-05-29 11:26:37 +0200278 /*
279 * The C standard doesn't guarantee that all-bits-0 is the representation
280 * of a NULL pointer. We do however use that in our code for initializing
281 * structures, which should work on every modern platform. Let's be sure.
282 */
283 memset( &pointer, 0, sizeof( void * ) );
284 if( pointer != NULL )
285 {
286 mbedtls_fprintf( stderr, "all-bits-zero is not a NULL pointer\n" );
287 return( 1 );
288 }
289
Manuel Pégourié-Gonnard7b6dcbe2015-06-22 10:48:01 +0200290 /*
291 * Make sure we have a snprintf that correctly zero-terminates
292 */
293 if( run_test_snprintf() != 0 )
294 {
295 mbedtls_fprintf( stderr, "the snprintf implementation is broken\n" );
296 return( 0 );
297 }
298
SimonB8ca7bc42016-04-17 23:24:50 +0100299 while( arg_index < argc)
300 {
301 next_arg = argv[ arg_index ];
302
303 if( strcmp(next_arg, "--verbose" ) == 0 ||
304 strcmp(next_arg, "-v" ) == 0 )
305 {
306 option_verbose = 1;
307 }
308 else if( strcmp(next_arg, "--help" ) == 0 ||
309 strcmp(next_arg, "-h" ) == 0 )
310 {
311 mbedtls_fprintf( stdout, USAGE );
312 mbedtls_exit( EXIT_SUCCESS );
313 }
314 else
315 {
316 /* Not an option, therefore treat all further arguments as the file
317 * list.
318 */
319 test_files = &argv[ arg_index ];
320 testfile_count = argc - arg_index;
321 }
322
323 arg_index++;
324 }
325
326 /* If no files were specified, assume a default */
327 if ( test_files == NULL || testfile_count == 0 )
Paul Bakker19343182013-08-16 13:31:10 +0200328 {
Simon Butcheraad787f2016-01-26 22:13:58 +0000329 test_files = &default_filename;
330 testfile_count = 1;
331 }
Paul Bakker19343182013-08-16 13:31:10 +0200332
SimonB8ca7bc42016-04-17 23:24:50 +0100333 /* Now begin to execute the tests in the testfiles */
Simon Butcheraad787f2016-01-26 22:13:58 +0000334 for ( testfile_index = 0;
335 testfile_index < testfile_count;
336 testfile_index++ )
Paul Bakker19343182013-08-16 13:31:10 +0200337 {
Paul Bakker774180e2016-05-12 15:59:48 +0100338 int unmet_dep_count = 0;
339 char *unmet_dependencies[20];
340
Simon Butcheraad787f2016-01-26 22:13:58 +0000341 test_filename = test_files[ testfile_index ];
Paul Bakker19343182013-08-16 13:31:10 +0200342
Simon Butcheraad787f2016-01-26 22:13:58 +0000343 file = fopen( test_filename, "r" );
344 if( file == NULL )
Paul Bakker19343182013-08-16 13:31:10 +0200345 {
Simon Butcheraad787f2016-01-26 22:13:58 +0000346 mbedtls_fprintf( stderr, "Failed to open test file: %s\n",
347 test_filename );
348 return( 1 );
349 }
350
351 while( !feof( file ) )
352 {
Paul Bakker774180e2016-05-12 15:59:48 +0100353 if( unmet_dep_count > 0 )
354 {
Simon Butcher25731362016-09-30 13:11:29 +0100355 mbedtls_fprintf( stderr,
356 "FATAL: Dep count larger than zero at start of loop\n");
Paul Bakker774180e2016-05-12 15:59:48 +0100357 mbedtls_exit( MBEDTLS_EXIT_FAILURE );
358 }
359 unmet_dep_count = 0;
Simon Butcheraad787f2016-01-26 22:13:58 +0000360
361 if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
362 break;
363 mbedtls_fprintf( stdout, "%s%.66s", test_errors ? "\n" : "", buf );
364 mbedtls_fprintf( stdout, " " );
365 for( i = strlen( buf ) + 1; i < 67; i++ )
366 mbedtls_fprintf( stdout, "." );
367 mbedtls_fprintf( stdout, " " );
368 fflush( stdout );
369
370 total_tests++;
Paul Bakker19343182013-08-16 13:31:10 +0200371
372 if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
373 break;
374 cnt = parse_arguments( buf, strlen(buf), params );
Paul Bakker19343182013-08-16 13:31:10 +0200375
Simon Butcheraad787f2016-01-26 22:13:58 +0000376 if( strcmp( params[0], "depends_on" ) == 0 )
377 {
378 for( i = 1; i < cnt; i++ )
SimonB8ca7bc42016-04-17 23:24:50 +0100379 {
380 if( dep_check( params[i] ) != DEPENDENCY_SUPPORTED )
381 {
Paul Bakker26b60bf2016-05-12 15:55:37 +0100382 if( 0 == option_verbose )
383 {
384 /* Only one count is needed if not verbose */
385 unmet_dep_count++;
386 break;
387 }
388
Paul Bakkera30a72f2016-05-12 15:52:48 +0100389 unmet_dependencies[ unmet_dep_count ] = strdup(params[i]);
390 if( unmet_dependencies[ unmet_dep_count ] == NULL )
SimonB8ca7bc42016-04-17 23:24:50 +0100391 {
Simon Butcher25731362016-09-30 13:11:29 +0100392 mbedtls_fprintf( stderr, "FATAL: Out of memory\n");
Janos Follath55abc212016-04-18 18:18:48 +0100393 mbedtls_exit( MBEDTLS_EXIT_FAILURE );
SimonB8ca7bc42016-04-17 23:24:50 +0100394 }
395 unmet_dep_count++;
396 }
397 }
Paul Bakker19343182013-08-16 13:31:10 +0200398
Simon Butcheraad787f2016-01-26 22:13:58 +0000399 if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
400 break;
401 cnt = parse_arguments( buf, strlen(buf), params );
402 }
SimonB8ca7bc42016-04-17 23:24:50 +0100403
404 // If there are no unmet dependencies execute the test
405 if( unmet_dep_count == 0 )
Simon Butcheraad787f2016-01-26 22:13:58 +0000406 {
407 test_errors = 0;
Simon Butcher25731362016-09-30 13:11:29 +0100408
409#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
410 /* Suppress all output from the library unless we're verbose
411 * mode
412 */
413 if( !option_verbose )
414 {
415 /* Redirect all stdout output to /dev/null */
416 tests_stdout = dup( fileno(stdout) );
417 if( tests_stdout == -1 )
418 {
419 /* Redirection has failed with no stdout so exit */
420 exit(1);
421 }
422
423 fflush( stdout );
424 fclose( stdout );
425 stdout = fopen("/dev/null", "w" );
426 if( stdout == NULL )
427 {
428 /* Redirection has failed with no stdout so exit */
429 exit(1);
430 }
431 }
432#endif /* __unix__ || __APPLE__ __MACH__ */
433
Simon Butcheraad787f2016-01-26 22:13:58 +0000434 ret = dispatch_test( cnt, params );
Simon Butcher25731362016-09-30 13:11:29 +0100435
436#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
437 if( !option_verbose )
438 {
439 /* Restore stdout */
440 fflush( stdout );
441 fclose( stdout );
442
443 stdout = fdopen ( tests_stdout, "w");
444 if( stdout == NULL )
445 {
446 /* Redirection has failed with no stdout so exit */
447 exit(1);
448 }
449 }
450#endif /* __unix__ || __APPLE__ __MACH__ */
451
Simon Butcheraad787f2016-01-26 22:13:58 +0000452 }
453
SimonB8ca7bc42016-04-17 23:24:50 +0100454 if( unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE )
Simon Butcheraad787f2016-01-26 22:13:58 +0000455 {
456 total_skipped++;
457 mbedtls_fprintf( stdout, "----\n" );
SimonB8ca7bc42016-04-17 23:24:50 +0100458
459 if( 1 == option_verbose && ret == DISPATCH_UNSUPPORTED_SUITE )
460 {
461 mbedtls_fprintf( stdout, " Test Suite not enabled" );
462 }
463
464 if( 1 == option_verbose && unmet_dep_count > 0 )
465 {
466 mbedtls_fprintf( stdout, " Unmet dependencies: " );
Paul Bakker774180e2016-05-12 15:59:48 +0100467 for( i = 0; i < unmet_dep_count; i++ )
SimonB8ca7bc42016-04-17 23:24:50 +0100468 {
469 mbedtls_fprintf(stdout, "%s ",
Paul Bakker774180e2016-05-12 15:59:48 +0100470 unmet_dependencies[i]);
471 free(unmet_dependencies[i]);
SimonB8ca7bc42016-04-17 23:24:50 +0100472 }
473 mbedtls_fprintf( stdout, "\n" );
474 }
Simon Butcheraad787f2016-01-26 22:13:58 +0000475 fflush( stdout );
Paul Bakker774180e2016-05-12 15:59:48 +0100476
477 unmet_dep_count = 0;
Simon Butcheraad787f2016-01-26 22:13:58 +0000478 }
SimonB8ca7bc42016-04-17 23:24:50 +0100479 else if( ret == DISPATCH_TEST_SUCCESS && test_errors == 0 )
Simon Butcheraad787f2016-01-26 22:13:58 +0000480 {
481 mbedtls_fprintf( stdout, "PASS\n" );
482 fflush( stdout );
483 }
SimonB8ca7bc42016-04-17 23:24:50 +0100484 else if( ret == DISPATCH_INVALID_TEST_DATA )
Simon Butcheraad787f2016-01-26 22:13:58 +0000485 {
486 mbedtls_fprintf( stderr, "FAILED: FATAL PARSE ERROR\n" );
487 fclose(file);
488 mbedtls_exit( 2 );
489 }
490 else
491 total_errors++;
492
493 if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
494 break;
495 if( strlen(buf) != 0 )
496 {
497 mbedtls_fprintf( stderr, "Should be empty %d\n",
498 (int) strlen(buf) );
499 return( 1 );
500 }
Paul Bakker19343182013-08-16 13:31:10 +0200501 }
Simon Butcheraad787f2016-01-26 22:13:58 +0000502 fclose(file);
Paul Bakker774180e2016-05-12 15:59:48 +0100503
504 /* In case we encounter early end of file */
505 for( i = 0; i < unmet_dep_count; i++ )
506 free( unmet_dependencies[i] );
Paul Bakker19343182013-08-16 13:31:10 +0200507 }
Paul Bakker19343182013-08-16 13:31:10 +0200508
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200509 mbedtls_fprintf( stdout, "\n----------------------------------------------------------------------------\n\n");
Paul Bakker19343182013-08-16 13:31:10 +0200510 if( total_errors == 0 )
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200511 mbedtls_fprintf( stdout, "PASSED" );
Paul Bakker19343182013-08-16 13:31:10 +0200512 else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200513 mbedtls_fprintf( stdout, "FAILED" );
Paul Bakker19343182013-08-16 13:31:10 +0200514
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200515 mbedtls_fprintf( stdout, " (%d / %d tests (%d skipped))\n",
Paul Bakker19343182013-08-16 13:31:10 +0200516 total_tests - total_errors, total_tests, total_skipped );
517
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200518#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
Manuel Pégourié-Gonnard765bb312014-11-27 11:55:27 +0100519 !defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200520#if defined(MBEDTLS_MEMORY_DEBUG)
521 mbedtls_memory_buffer_alloc_status();
Paul Bakker19343182013-08-16 13:31:10 +0200522#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200523 mbedtls_memory_buffer_alloc_free();
Paul Bakker1337aff2013-09-29 14:45:34 +0200524#endif
Paul Bakker19343182013-08-16 13:31:10 +0200525
526 return( total_errors != 0 );
527}
528