summaryrefslogtreecommitdiff
path: root/tests/tpm_lite
diff options
context:
space:
mode:
authorLuigi Semenzato <semenzato@google.com>2010-08-04 08:35:12 -0700
committerLuigi Semenzato <semenzato@google.com>2010-08-04 08:35:12 -0700
commit50d48feb9e0df6a990cc5890ce14e1398798eeb1 (patch)
treed1635515a5318dcbe2d58203ecbf01ec52666f7b /tests/tpm_lite
parentd9072f169fbf24a0caa7282214ab292950c74dab (diff)
downloadvboot-50d48feb9e0df6a990cc5890ce14e1398798eeb1.tar.gz
Various bug fixes to tpm_lite. Some changes to the test suite.
Review URL: http://codereview.chromium.org/3091004
Diffstat (limited to 'tests/tpm_lite')
-rw-r--r--tests/tpm_lite/enable.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/tpm_lite/enable.c b/tests/tpm_lite/enable.c
index a9172ba9..73e9c656 100644
--- a/tests/tpm_lite/enable.c
+++ b/tests/tpm_lite/enable.c
@@ -6,17 +6,31 @@
/* Testing: ownership testing code, ForceClear, and nvram write limit.
*/
+#include <stdio.h>
+
#include "tlcl.h"
+#define CHECK(command) do { \
+ uint32_t r = (command); \
+ if (r != 0) { \
+ printf(#command "returned 0x%x\n", r); \
+ } \
+} while(0)
+
int main(int argc, char** argv) {
+ uint8_t disable, deactivated;
TlclLibInit();
TlclStartup();
- TlclSelfTestFull();
+ CHECK(TlclSelfTestFull());
- TlclAssertPhysicalPresence();
- TlclSetEnable();
- (void) TlclSetDeactivated(0); // activates the TPM at the next boot
+ CHECK(TlclAssertPhysicalPresence());
+ CHECK(TlclGetFlags(&disable, &deactivated, NULL));
+ printf("disable is %d, deactivated is %d\n", disable, deactivated);
+ CHECK(TlclSetEnable());
+ CHECK(TlclSetDeactivated(0));
+ CHECK(TlclGetFlags(&disable, &deactivated, NULL));
+ printf("disable is %d, deactivated is %d\n", disable, deactivated);
return 0;
}