summaryrefslogtreecommitdiff
path: root/tests/tpm_lite
diff options
context:
space:
mode:
authorLuigi Semenzato <semenzato@google.com>2010-08-04 11:51:13 -0700
committerLuigi Semenzato <semenzato@google.com>2010-08-04 11:51:13 -0700
commitfda9488f97de3af2e59de64b365631588431c2d8 (patch)
tree4dbd500fd93a0ac2f7b128d87daa2db8168e8be2 /tests/tpm_lite
parentdd4cfdffab458d90572cc578731848b6623b4649 (diff)
downloadvboot-fda9488f97de3af2e59de64b365631588431c2d8.tar.gz
Utility to run the self test before we can run tcsd.
Also test of the effects of the self test. Review URL: http://codereview.chromium.org/3077016
Diffstat (limited to 'tests/tpm_lite')
-rw-r--r--tests/tpm_lite/Makefile1
-rw-r--r--tests/tpm_lite/startup.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/tpm_lite/Makefile b/tests/tpm_lite/Makefile
index 922ce5eb..4b8426c1 100644
--- a/tests/tpm_lite/Makefile
+++ b/tests/tpm_lite/Makefile
@@ -21,6 +21,7 @@ TEST_NAMES = tpmtest_clear \
tpmtest_readonly \
tpmtest_redefine \
tpmtest_spaceperm \
+ tpmtest_startup \
tpmtest_writelimit \
TEST_BINS = $(addprefix ${BUILD_ROOT}/,$(TEST_NAMES))
diff --git a/tests/tpm_lite/startup.c b/tests/tpm_lite/startup.c
new file mode 100644
index 00000000..542efc5b
--- /dev/null
+++ b/tests/tpm_lite/startup.c
@@ -0,0 +1,31 @@
+/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Only perform a TPM_Startup command.
+ */
+
+#include <stdio.h>
+
+#include "tlcl.h"
+
+int main(int argc, char** argv) {
+ uint32_t result;
+ TlclLibInit();
+ result = TlclStartup();
+ if (result != 0) {
+ printf("tpm startup failed with 0x%x\n", result);
+ }
+ result = TlclGetFlags(NULL, NULL, NULL);
+ if (result != 0) {
+ printf("tpm getflags failed with 0x%x\n", result);
+ }
+ printf("executing SelfTestFull\n");
+ TlclSelfTestFull();
+ result = TlclGetFlags(NULL, NULL, NULL);
+ if (result != 0) {
+ printf("tpm getflags failed with 0x%x\n", result);
+ }
+ return 0;
+}