xref: /xnu-11215.41.3/EXTERNAL_HEADERS/corecrypto/fipspost_trace.h (revision 33de042d024d46de5ff4e89f2471de6608e37fa4)
1 /* Copyright (c) (2017,2019) Apple Inc. All rights reserved.
2  *
3  * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which
4  * is contained in the License.txt file distributed with corecrypto) and only to
5  * people who accept that license. IMPORTANT:  Any license rights granted to you by
6  * Apple Inc. (if any) are limited to internal use within your organization only on
7  * devices and computers you own or control, for the sole purpose of verifying the
8  * security characteristics and correct functioning of the Apple Software.  You may
9  * not, directly or indirectly, redistribute the Apple Software or any portions thereof.
10  */
11 
12 #ifndef _CORECRYPTO_FIPSPOST_TRACE_H_
13 #define _CORECRYPTO_FIPSPOST_TRACE_H_
14 
15 #if CC_FIPSPOST_TRACE
16 
17 /*
18  * Use this string to separate out tests.
19  */
20 #define FIPSPOST_TRACE_TEST_STR    "?"
21 
22 int fipspost_trace_is_active(void);
23 void fipspost_trace_call(const char *fname);
24 
25 /* Only trace when VERBOSE is set to avoid impacting normal boots. */
26 #define FIPSPOST_TRACE_EVENT do {                                       \
27     if (fipspost_trace_is_active()) {                                   \
28         fipspost_trace_call(__FUNCTION__);                              \
29     }                                                                   \
30 } while (0);
31 
32 #define FIPSPOST_TRACE_MESSAGE(MSG) do {                                \
33     if (fipspost_trace_is_active()) {                                   \
34         fipspost_trace_call(MSG);                                       \
35     }                                                                   \
36 } while (0);
37 
38 #else
39 
40 /* Not building a CC_FIPSPOST_TRACE-enabled, no TRACE operations. */
41 #define FIPSPOST_TRACE_EVENT
42 #define FIPSPOST_TRACE_MESSAGE(X)
43 
44 #endif
45 
46 #endif
47