| 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: ForceClear and behavior of disable and permanent deactivated flags. | 6 /* Testing: ForceClear and behavior of disable and permanent deactivated flags. |
| 7 * | 7 * |
| 8 * ForceClear sets the permanent disable and deactivated flags to their default | 8 * ForceClear sets the permanent disable and deactivated flags to their default |
| 9 * value of TRUE. The specs say nothing about STCLEAR flags, so they should be | 9 * value of TRUE. The specs say nothing about STCLEAR flags, so they should be |
| 10 * left alone. This test checks that both flags may be reset without a reboot, | 10 * left alone. This test checks that both flags may be reset without a reboot, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #define CHECK(command) do { if ((command) != TPM_SUCCESS) \ | 21 #define CHECK(command) do { if ((command) != TPM_SUCCESS) \ |
| 22 error(#command "\n"); } \ | 22 error(#command "\n"); } \ |
| 23 while(0) | 23 while(0) |
| 24 | 24 |
| 25 int main(int argc, char** argv) { | 25 int main(int argc, char** argv) { |
| 26 uint8_t disable, deactivated; | 26 uint8_t disable, deactivated; |
| 27 int i; | 27 int i; |
| 28 | 28 |
| 29 TlclLibInit(); | 29 TlclLibInit(); |
| 30 CHECK(TlclStartup()); | 30 CHECK(TlclStartup()); |
| 31 CHECK(TlclSelftestfull()); | 31 CHECK(TlclSelfTestFull()); |
| 32 | 32 |
| 33 CHECK(TlclAssertPhysicalPresence()); | 33 CHECK(TlclAssertPhysicalPresence()); |
| 34 printf("PP asserted\n"); | 34 printf("PP asserted\n"); |
| 35 | 35 |
| 36 CHECK(TlclGetFlags(&disable, &deactivated)); | 36 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 37 printf("disable is %d, deactivated is %d\n", disable, deactivated); | 37 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 38 | 38 |
| 39 for (i = 0; i < 2; i++) { | 39 for (i = 0; i < 2; i++) { |
| 40 | 40 |
| 41 CHECK(TlclForceClear()); | 41 CHECK(TlclForceClear()); |
| 42 printf("tpm is cleared\n"); | 42 printf("tpm is cleared\n"); |
| 43 | 43 |
| 44 CHECK(TlclGetFlags(&disable, &deactivated)); | 44 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 45 printf("disable is %d, deactivated is %d\n", disable, deactivated); | 45 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 46 | 46 |
| 47 CHECK(TlclSetEnable()); | 47 CHECK(TlclSetEnable()); |
| 48 printf("disable flag is cleared\n"); | 48 printf("disable flag is cleared\n"); |
| 49 | 49 |
| 50 CHECK(TlclGetFlags(&disable, &deactivated)); | 50 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 51 printf("disable is %d, deactivated is %d\n", disable, deactivated); | 51 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 52 | 52 |
| 53 CHECK(TlclSetDeactivated(0)); | 53 CHECK(TlclSetDeactivated(0)); |
| 54 printf("deactivated flag is cleared\n"); | 54 printf("deactivated flag is cleared\n"); |
| 55 | 55 |
| 56 CHECK(TlclGetFlags(&disable, &deactivated)); | 56 CHECK(TlclGetFlags(&disable, &deactivated, NULL)); |
| 57 printf("disable is %d, deactivated is %d\n", disable, deactivated); | 57 printf("disable is %d, deactivated is %d\n", disable, deactivated); |
| 58 } | 58 } |
| 59 | 59 |
| 60 return 0; | 60 return 0; |
| 61 } | 61 } |
| OLD | NEW |