Index: src/platform/tpm_lite/src/include/tlcl.h |
diff --git a/src/platform/tpm_lite/src/include/tlcl.h b/src/platform/tpm_lite/src/include/tlcl.h |
index e644ebee51467314343b644a0a31bbabaef3de7d..30c73505def661fc7e156a90c59d7fa502567f49 100644 |
--- a/src/platform/tpm_lite/src/include/tlcl.h |
+++ b/src/platform/tpm_lite/src/include/tlcl.h |
@@ -11,7 +11,44 @@ |
#ifndef TPM_LITE_TLCL_H_ |
#define TPM_LITE_TLCL_H_ |
+#include <stdarg.h> |
#include <stdint.h> |
+#include <stdio.h> |
+#include <stdlib.h> |
+ |
+#define POSSIBLY_UNUSED __attribute__((unused)) |
+ |
+#ifdef __STRICT_ANSI__ |
+#define INLINE |
+#else |
+#define INLINE inline |
+#endif |
+ |
+/* Outputs an error message and quits the program. |
+ */ |
+static void error(const char *format, ...) { |
+ va_list ap; |
+ va_start(ap, format); |
+ fprintf(stderr, "ERROR: "); |
+ vfprintf(stderr, format, ap); |
+ va_end(ap); |
+ exit(1); |
+} |
+ |
+/* Outputs a warning and continues. |
+ */ |
+POSSIBLY_UNUSED |
+static void warning(const char *format, ...) { |
+ va_list ap; |
+ va_start(ap, format); |
+ fprintf(stderr, "WARNING: "); |
+ vfprintf(stderr, format, ap); |
+ va_end(ap); |
+} |
+ |
+#define assert(expr) do { if (!(expr)) { \ |
+ error("assert fail: %s at %s:%d\n", \ |
+ #expr, __FILE__, __LINE__); }} while(0) |
/* Call this first. |
*/ |
@@ -58,4 +95,8 @@ void TlclAssertPhysicalPresence(void); |
*/ |
void TlclSetNvLocked(void); |
+/* Returns 1 if the TPM is owned, 0 otherwise. |
+ */ |
+int TlclIsOwned(void); |
+ |
#endif /* TPM_LITE_TLCL_H_ */ |