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