tpmtest_spaceperm.c 856 B

12345678910111213141516171819202122232425262728293031323334353637
  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. /* Test of space permissions retrieval.
  6. */
  7. #include <stdint.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include "host_common.h"
  11. #include "tlcl.h"
  12. #include "tlcl_tests.h"
  13. #define PERMPPGL (TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK)
  14. #define PERMPP TPM_NV_PER_PPWRITE
  15. int main(int argc, char** argv) {
  16. uint32_t perm;
  17. TlclLibInit();
  18. TPM_CHECK(TlclStartupIfNeeded());
  19. TPM_CHECK(TlclContinueSelfTest());
  20. TPM_CHECK(TlclAssertPhysicalPresence());
  21. TPM_CHECK(TlclGetPermissions(INDEX0, &perm));
  22. VbAssert((perm & PERMPPGL) == PERMPPGL);
  23. TPM_CHECK(TlclGetPermissions(INDEX1, &perm));
  24. VbAssert((perm & PERMPP) == PERMPP);
  25. printf("TEST SUCCEEDED\n");
  26. exit(0);
  27. }