blob: c9dcbc9ffad4ec250cfaa45c4d1e3574e36809c7 [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// This file was extracted from the TCG Published
2// Trusted Platform Module Library
3// Part 4: Supporting Routines
4// Family "2.0"
5// Level 00 Revision 01.16
6// October 30, 2014
7
8#ifndef _TPM_ERROR_H
9#define _TPM_ERROR_H
10#include "TpmBuildSwitches.h"
11#define FATAL_ERROR_ALLOCATION (1)
12#define FATAL_ERROR_DIVIDE_ZERO (2)
13#define FATAL_ERROR_INTERNAL (3)
14#define FATAL_ERROR_PARAMETER (4)
15#define FATAL_ERROR_ENTROPY (5)
16#define FATAL_ERROR_SELF_TEST (6)
17#define FATAL_ERROR_CRYPTO (7)
18#define FATAL_ERROR_NV_UNRECOVERABLE (8)
19#define FATAL_ERROR_REMANUFACTURED (9) // indicates that the TPM has
20 // been re-manufactured after an
21 // unrecoverable NV error
22#define FATAL_ERROR_DRBG (10)
23#define FATAL_ERROR_FORCED (666)
24//
25// These are the crypto assertion routines. When a function returns an unexpected and unrecoverable
26// result, the assertion fails and the TpmFail() is called
27//
28void
29TpmFail(const char *function, int line, int code);
30typedef void (*FAIL_FUNCTION)(const char *, int, int);
31#define FAIL(a) (TpmFail(__FUNCTION__, __LINE__, a))
32#if defined(EMPTY_ASSERT)
33# define pAssert(a) ((void)0)
34#else
Vadim Bendebury34f0a9a2015-05-29 12:24:59 -070035# define pAssert(a) {if (!(a)) { FAIL(FATAL_ERROR_PARAMETER);}}
Vadim Bendebury56797522015-05-20 10:32:25 -070036#endif
37#endif // _TPM_ERROR_H