tpmtest_enable.c 995 B

1234567891011121314151617181920212223242526272829303132333435
  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. /* Testing: ownership testing code, ForceClear, and nvram write limit.
  6. */
  7. #include <stdio.h>
  8. #include "host_common.h"
  9. #include "tlcl.h"
  10. #include "tlcl_tests.h"
  11. int main(int argc, char** argv) {
  12. uint8_t disable, deactivated;
  13. TlclLibInit();
  14. TPM_CHECK(TlclStartupIfNeeded());
  15. TPM_CHECK(TlclSelfTestFull());
  16. TPM_CHECK(TlclAssertPhysicalPresence());
  17. TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
  18. printf("disable is %d, deactivated is %d\n", disable, deactivated);
  19. TPM_CHECK(TlclSetEnable());
  20. TPM_CHECK(TlclSetDeactivated(0));
  21. TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
  22. printf("disable is %d, deactivated is %d\n", disable, deactivated);
  23. if (disable == 1 || deactivated == 1) {
  24. VbExError("failed to enable or activate");
  25. }
  26. printf("TEST SUCCEEDED\n");
  27. return 0;
  28. }