1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 * All rights reserved. 5 */ 6 #ifndef TB_MACROS_H 7 #define TB_MACROS_H 8 9 #include <tee_internal_api_extensions.h> 10 11 #define TB_HEADER(str) \ 12 MSG("\n*********** TESTBENCH ***********" \ 13 "\n*** RUNNING: <<< %s >>>" \ 14 "\n*********************************", str) 15 16 #define TB_FOOTER(str) \ 17 MSG("\n*********** TESTBENCH ***********" \ 18 "\n*** PASSED: <<< %s >>>" \ 19 "\n*********************************", str) 20 21 #define TB_INFO(str) MSG("*** INFO : %s \n", (str)) 22 23 #define HALT \ 24 { \ 25 EMSG("\n*** FAILED ***" \ 26 "\nTestbench halted at line %d in function %s"; \ 27 MSG("\nWaiting for keypress to enable debugging."); \ 28 TEE_Panic(0); \ 29 } 30 31 #define STARTING \ 32 MSG("\n*********** TESTBENCH ***********" \ 33 "\n*** For the GlobalPlatform Math API" \ 34 "\n*********************************") 35 36 #define ALL_PASSED \ 37 MSG("\n*********** TESTBENCH ***********" \ 38 "\n*** ALL TESTS PASSED ***" \ 39 "\n*********************************") 40 41 /* 42 * DEF_BIGINT defines and initialize a BigInt with name and size. 43 */ 44 #define DEF_BIGINT(name, size) \ 45 TEE_BigInt *name; \ 46 size_t name##_size; \ 47 \ 48 name##_size = TEE_BigIntSizeInU32(size); \ 49 name = (TEE_BigInt *)TEE_Malloc(name##_size * sizeof(TEE_BigInt), 0); \ 50 TEE_BigIntInit(name, name##_size) 51 52 /* 53 * DEL_BIGINT frees the BigInt. 54 */ 55 #define DEL_BIGINT(name) TEE_Free(name) 56 57 #endif 58