1 | /********************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* TPM Debug Utilities */
|
---|
4 | /* Written by Ken Goldman */
|
---|
5 | /* IBM Thomas J. Watson Research Center */
|
---|
6 | /* $Id: tpm_debug.h 4179 2010-11-10 20:10:24Z kgoldman $ */
|
---|
7 | /* */
|
---|
8 | /* (c) Copyright IBM Corporation 2006, 2010. */
|
---|
9 | /* */
|
---|
10 | /* All rights reserved. */
|
---|
11 | /* */
|
---|
12 | /* Redistribution and use in source and binary forms, with or without */
|
---|
13 | /* modification, are permitted provided that the following conditions are */
|
---|
14 | /* met: */
|
---|
15 | /* */
|
---|
16 | /* Redistributions of source code must retain the above copyright notice, */
|
---|
17 | /* this list of conditions and the following disclaimer. */
|
---|
18 | /* */
|
---|
19 | /* Redistributions in binary form must reproduce the above copyright */
|
---|
20 | /* notice, this list of conditions and the following disclaimer in the */
|
---|
21 | /* documentation and/or other materials provided with the distribution. */
|
---|
22 | /* */
|
---|
23 | /* Neither the names of the IBM Corporation nor the names of its */
|
---|
24 | /* contributors may be used to endorse or promote products derived from */
|
---|
25 | /* this software without specific prior written permission. */
|
---|
26 | /* */
|
---|
27 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
|
---|
28 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
|
---|
29 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
|
---|
30 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
|
---|
31 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
|
---|
32 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
|
---|
33 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
|
---|
34 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
|
---|
35 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
---|
36 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
|
---|
37 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
---|
38 | /********************************************************************************/
|
---|
39 |
|
---|
40 | #ifndef TPM_DEBUG_H
|
---|
41 | #define TPM_DEBUG_H
|
---|
42 |
|
---|
43 | #include "tpm_types.h"
|
---|
44 | #include "tpm_library_intern.h"
|
---|
45 |
|
---|
46 | /* prototypes */
|
---|
47 |
|
---|
48 | void TPM_PrintFour(const char *string, const unsigned char* buff);
|
---|
49 | void TPM_PrintFourLimit(const char *string,
|
---|
50 | const unsigned char* buff, size_t bufflen);
|
---|
51 | void TPM_PrintAll(const char *string, const unsigned char* buff, uint32_t length);
|
---|
52 |
|
---|
53 | #if 0
|
---|
54 | #ifndef TPM_DEBUG /* if debug is turned off */
|
---|
55 |
|
---|
56 | /* dummy function to match the printf prototype */
|
---|
57 | int tpm_swallow_printf_args(const char *format, ...);
|
---|
58 |
|
---|
59 | /* assign to this dummy value to eliminate "statement has no effect" warnings */
|
---|
60 | extern int swallow_rc;
|
---|
61 |
|
---|
62 | /* redefine printf to null */
|
---|
63 | #define printf swallow_rc = swallow_rc && tpm_swallow_printf_args
|
---|
64 | #define TPM_PrintFour(arg1, arg2)
|
---|
65 |
|
---|
66 | #endif /* TPM_DEBUG */
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #ifdef printf
|
---|
70 | # undef printf
|
---|
71 | #endif
|
---|
72 | #define printf(...) TPMLIB_LogPrintf(__VA_ARGS__);
|
---|
73 |
|
---|
74 | #endif
|
---|