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 |
| 17 #define INDEX0 0xcafe |
| 18 #define INDEX1 0xcaff |
| 19 |
| 20 int main(int argc, char** argv) { |
| 21 uint32_t perm; |
| 22 uint32_t perm_pp_gl = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK; |
| 23 uint32_t perm_pp = TPM_NV_PER_PPWRITE; |
| 24 uint32_t result; |
| 25 |
| 26 TlclLibInit(); |
| 27 |
| 28 #if !USE_TPM_EMULATOR |
| 29 TlclStartup(); |
| 30 TlclContinueSelfTest(); |
| 31 #endif |
| 32 |
| 33 TlclAssertPhysicalPresence(); |
| 34 |
| 35 result = TlclGetPermissions(INDEX0, &perm); |
| 36 assert(result == TPM_SUCCESS); |
| 37 printf("permissions for INDEX0 = 0x%x\n", perm); |
| 38 assert((perm & perm_pp_gl) == perm_pp_gl); |
| 39 |
| 40 result = TlclGetPermissions(INDEX1, &perm); |
| 41 assert(result == TPM_SUCCESS); |
| 42 printf("permissions for INDEX1 = 0x%x\n", perm); |
| 43 assert((perm & perm_pp) == perm_pp); |
| 44 |
| 45 printf("Test completed successfully\n"); |
| 46 exit(0); |
| 47 } |
OLD | NEW |