OLD | NEW |
(Empty) | |
| 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 |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 |
| 6 /* Test of space permissions retrieval. The spaces 0xcafe and 0xcaff must have |
| 7 * already been defined (by running, for instance, the "redefine" test). |
| 8 */ |
| 9 |
| 10 #include <stdint.h> |
| 11 #include <stdio.h> |
| 12 #include <stdlib.h> |
| 13 #include <tss/tcs.h> |
| 14 |
| 15 #include "tlcl.h" |
| 16 #include "utility.h" |
| 17 |
| 18 #define INDEX0 0xcafe |
| 19 #define INDEX1 0xcaff |
| 20 |
| 21 int main(int argc, char** argv) { |
| 22 uint32_t perm; |
| 23 uint32_t perm_pp_gl = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK; |
| 24 uint32_t perm_pp = TPM_NV_PER_PPWRITE; |
| 25 uint32_t result; |
| 26 |
| 27 TlclLibInit(); |
| 28 TlclStartup(); |
| 29 TlclContinueSelfTest(); |
| 30 TlclAssertPhysicalPresence(); |
| 31 |
| 32 result = TlclGetPermissions(INDEX0, &perm); |
| 33 assert(result == TPM_SUCCESS); |
| 34 printf("permissions for INDEX0 = 0x%x\n", perm); |
| 35 assert((perm & perm_pp_gl) == perm_pp_gl); |
| 36 |
| 37 result = TlclGetPermissions(INDEX1, &perm); |
| 38 assert(result == TPM_SUCCESS); |
| 39 printf("permissions for INDEX1 = 0x%x\n", perm); |
| 40 assert((perm & perm_pp) == perm_pp); |
| 41 |
| 42 printf("Test completed successfully\n"); |
| 43 exit(0); |
| 44 } |
OLD | NEW |