| 1 | /* |
| 2 | * fipspost_trace.h |
| 3 | * corecrypto |
| 4 | * |
| 5 | * Created on 01/25/2017 |
| 6 | * |
| 7 | * Copyright (c) 2017 Apple Inc. All rights reserved. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #ifndef _CORECRYPTO_FIPSPOST_TRACE_H_ |
| 12 | #define _CORECRYPTO_FIPSPOST_TRACE_H_ |
| 13 | |
| 14 | #if CC_FIPSPOST_TRACE |
| 15 | |
| 16 | /* |
| 17 | * Use this string to separate out tests. |
| 18 | */ |
| 19 | #define FIPSPOST_TRACE_TEST_STR "?" |
| 20 | |
| 21 | int fipspost_trace_is_active(void); |
| 22 | void fipspost_trace_call(const char *fname); |
| 23 | |
| 24 | /* Only trace when VERBOSE is set to avoid impacting normal boots. */ |
| 25 | #define FIPSPOST_TRACE_EVENT do { \ |
| 26 | if (fipspost_trace_is_active()) { \ |
| 27 | fipspost_trace_call(__FUNCTION__); \ |
| 28 | } \ |
| 29 | } while (0); |
| 30 | |
| 31 | #define FIPSPOST_TRACE_MESSAGE(MSG) do { \ |
| 32 | if (fipspost_trace_is_active()) { \ |
| 33 | fipspost_trace_call(MSG); \ |
| 34 | } \ |
| 35 | } while (0); |
| 36 | |
| 37 | #else |
| 38 | |
| 39 | /* Not building a CC_FIPSPOST_TRACE-enabled, no TRACE operations. */ |
| 40 | #define FIPSPOST_TRACE_EVENT |
| 41 | #define FIPSPOST_TRACE_MESSAGE(X) |
| 42 | |
| 43 | #endif |
| 44 | |
| 45 | #endif |
| 46 | |