| 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 /* This program mimicks the TPM usage from read-only firmware. It exercises | 6 /* This program mimicks the TPM usage from read-only firmware. It exercises |
| 7 * the TPM functionality needed in the read-only firmware. It is meant to be | 7 * the TPM functionality needed in the read-only firmware. It is meant to be |
| 8 * integrated with the rest of the read-only firmware. It is also provided as | 8 * integrated with the rest of the read-only firmware. It is also provided as |
| 9 * a test. | 9 * a test. |
| 10 */ | 10 */ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 int main(int argc, char** argv) { | 65 int main(int argc, char** argv) { |
| 66 uint8_t c; | 66 uint8_t c; |
| 67 uint32_t index_0, index_1, index_2, index_3; | 67 uint32_t index_0, index_1, index_2, index_3; |
| 68 | 68 |
| 69 TlclLibInit(); | 69 TlclLibInit(); |
| 70 | 70 |
| 71 TlclStartup(); | 71 TlclStartup(); |
| 72 TlclSelftestfull(); | 72 TlclSelfTestFull(); |
| 73 | 73 |
| 74 TlclAssertPhysicalPresence(); | 74 TlclAssertPhysicalPresence(); |
| 75 | 75 |
| 76 /* Checks if initialization has completed by trying to read-lock a space | 76 /* Checks if initialization has completed by trying to read-lock a space |
| 77 * that's created at the end of initialization. | 77 * that's created at the end of initialization. |
| 78 */ | 78 */ |
| 79 if (TlclRead(INDEX_INITIALIZED, &c, 0) == TPM_E_BADINDEX) { | 79 if (TlclRead(INDEX_INITIALIZED, &c, 0) == TPM_E_BADINDEX) { |
| 80 /* The initialization did not complete. | 80 /* The initialization did not complete. |
| 81 */ | 81 */ |
| 82 InitializeSpaces(); | 82 InitializeSpaces(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 TlclWriteLock(INDEX0); | 101 TlclWriteLock(INDEX0); |
| 102 if (TlclWrite(INDEX0, (uint8_t*) &index_0, sizeof(index_0)) == TPM_SUCCESS) { | 102 if (TlclWrite(INDEX0, (uint8_t*) &index_0, sizeof(index_0)) == TPM_SUCCESS) { |
| 103 error("index 0 is not locked\n"); | 103 error("index 0 is not locked\n"); |
| 104 } | 104 } |
| 105 | 105 |
| 106 /* Done for now. | 106 /* Done for now. |
| 107 */ | 107 */ |
| 108 printf("Test completed successfully\n"); | 108 printf("Test completed successfully\n"); |
| 109 exit(0); | 109 exit(0); |
| 110 } | 110 } |
| OLD | NEW |