1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 /* Testing: ownership testing code, ForceClear, and nvram write limit.
7  */
8 
9 #include <stdio.h>
10 
11 #include "host_common.h"
12 #include "tlcl.h"
13 #include "tlcl_tests.h"
14 
15 
main(int argc,char ** argv)16 int main(int argc, char** argv) {
17   uint8_t disable, deactivated;
18 
19   TlclLibInit();
20   TPM_CHECK(TlclStartupIfNeeded());
21   TPM_CHECK(TlclSelfTestFull());
22   TPM_CHECK(TlclAssertPhysicalPresence());
23   TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
24   printf("disable is %d, deactivated is %d\n", disable, deactivated);
25   TPM_CHECK(TlclSetEnable());
26   TPM_CHECK(TlclSetDeactivated(0));
27   TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
28   printf("disable is %d, deactivated is %d\n", disable, deactivated);
29   if (disable == 1 || deactivated == 1) {
30     VbExError("failed to enable or activate");
31   }
32   printf("TEST SUCCEEDED\n");
33   return 0;
34 }
35