| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* Testing: ownership testing code, ForceClear, and nvram write limit. | 6 /* Testing: ownership testing code, ForceClear, and nvram write limit. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include <stdio.h> |
| 10 |
| 9 #include "tlcl.h" | 11 #include "tlcl.h" |
| 10 | 12 |
| 13 #define CHECK(command) do { \ |
| 14 uint32_t r = (command); \ |
| 15 if (r != 0) { \ |
| 16 printf(#command "returned 0x%x\n", r); \ |
| 17 } \ |
| 18 } while(0) |
| 19 |
| 11 int main(int argc, char** argv) { | 20 int main(int argc, char** argv) { |
| 21 uint8_t disable, deactivated; |
| 12 | 22 |
| 13 TlclLibInit(); | 23 TlclLibInit(); |
| 14 TlclStartup(); | 24 TlclStartup(); |
| 15 TlclSelfTestFull(); | 25 CHECK(TlclSelfTestFull()); |
| 16 | 26 |
| 17 TlclAssertPhysicalPresence(); | 27 CHECK(TlclAssertPhysicalPresence()); |
| 18 TlclSetEnable(); | 28 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 19 (void) TlclSetDeactivated(0); // activates the TPM at the next boot | 29 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 30 CHECK(TlclSetEnable()); |
| 31 CHECK(TlclSetDeactivated(0)); |
| 32 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 33 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 20 | 34 |
| 21 return 0; | 35 return 0; |
| 22 } | 36 } |
| OLD | NEW |