Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Unified Diff: src/platform/tpm_lite/src/include/tlcl.h

Issue 870004: Many upgrades to tpm_lite. (Closed)
Patch Set: Fix makefile comment. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/tpm_lite/src/Makefile ('k') | src/platform/tpm_lite/src/testsuite/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ */
« no previous file with comments | « src/platform/tpm_lite/src/Makefile ('k') | src/platform/tpm_lite/src/testsuite/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698