| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* Test of protection from space redefinition. | 6 /* Test of protection from space redefinition. |
| 7 * | 7 * |
| 8 * This test is actually not that interesting because, if I am right, space | 8 * This test is actually not that interesting because, if I am right, space |
| 9 * redefinition is not allowed with PP only. It requires | 9 * redefinition is not allowed with PP only. It requires |
| 10 * TPM_TAG_RQU_AUTH1_COMMAND with owner authentication. | 10 * TPM_TAG_RQU_AUTH1_COMMAND with owner authentication. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #define INDEX0 0xcafe | 21 #define INDEX0 0xcafe |
| 22 #define INDEX1 0xcaff | 22 #define INDEX1 0xcaff |
| 23 | 23 |
| 24 int main(int argc, char** argv) { | 24 int main(int argc, char** argv) { |
| 25 uint32_t perm; | 25 uint32_t perm; |
| 26 uint32_t result; | 26 uint32_t result; |
| 27 uint32_t x; | 27 uint32_t x; |
| 28 | 28 |
| 29 TlclLibInit(); | 29 TlclLibInit(); |
| 30 TlclStartup(); | 30 TlclStartup(); |
| 31 TlclSelftestfull(); | 31 TlclSelfTestFull(); |
| 32 TlclAssertPhysicalPresence(); | 32 TlclAssertPhysicalPresence(); |
| 33 | 33 |
| 34 result = TlclRead(INDEX0, (uint8_t*) &x, sizeof(x)); | 34 result = TlclRead(INDEX0, (uint8_t*) &x, sizeof(x)); |
| 35 if (result == TPM_E_BADINDEX) { | 35 if (result == TPM_E_BADINDEX) { |
| 36 VBDEBUG(("creating INDEX0\n")); | 36 VBDEBUG(("creating INDEX0\n")); |
| 37 } else { | 37 } else { |
| 38 VBDEBUG(("redefining INDEX0\n")); | 38 VBDEBUG(("redefining INDEX0\n")); |
| 39 } | 39 } |
| 40 perm = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK; | 40 perm = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK; |
| 41 TlclDefineSpace(INDEX0, perm, sizeof(uint32_t)); | 41 TlclDefineSpace(INDEX0, perm, sizeof(uint32_t)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 } | 70 } |
| 71 result = TlclDefineSpace(INDEX1, perm, sizeof(uint32_t)); | 71 result = TlclDefineSpace(INDEX1, perm, sizeof(uint32_t)); |
| 72 if (result == TPM_SUCCESS) { | 72 if (result == TPM_SUCCESS) { |
| 73 error("unexpected success redefining INDEX1\n"); | 73 error("unexpected success redefining INDEX1\n"); |
| 74 exit(1); | 74 exit(1); |
| 75 } | 75 } |
| 76 | 76 |
| 77 printf("Test completed successfully\n"); | 77 printf("Test completed successfully\n"); |
| 78 exit(0); | 78 exit(0); |
| 79 } | 79 } |
| OLD | NEW |