Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: tests/tpm_lite/testsetup.c

Issue 3389029: Revive TPM firmware autotest. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Add TODO. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « autotest/server/hardware_TPMFirmwareServer/hardware_TPMFirmwareServer.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /* Create two spaces for uses in tests. OK if they already exist. 6 /* Create two spaces for uses in tests. OK if they already exist.
7 */ 7 */
8 8
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 12
13 #include "tlcl.h" 13 #include "tlcl.h"
14 #include "tlcl_tests.h" 14 #include "tlcl_tests.h"
15 #include "utility.h" 15 #include "utility.h"
16 16
17 int main(int argc, char** argv) { 17 int main(int argc, char** argv) {
18 uint32_t perm; 18 uint32_t perm;
19 uint32_t result; 19 uint32_t result;
20 uint32_t x; 20 uint32_t x;
21 21
22 TlclLibInit(); 22 TlclLibInit();
23 23
24 TPM_CHECK(TlclStartupIfNeeded()); 24 TPM_CHECK(TlclStartupIfNeeded());
25 TPM_CHECK(TlclSelfTestFull()); 25 TPM_CHECK(TlclSelfTestFull());
26 TPM_CHECK(TlclAssertPhysicalPresence()); 26 TPM_CHECK(TlclAssertPhysicalPresence());
27 TPM_CHECK(TlclForceClear());
28 TPM_CHECK(TlclSetEnable());
29 TPM_CHECK(TlclSetDeactivated(0));
27 30
28 result = TlclRead(INDEX0, (uint8_t*) &x, sizeof(x)); 31 result = TlclRead(INDEX0, (uint8_t*) &x, sizeof(x));
29 if (result == TPM_E_BADINDEX) { 32 if (result == TPM_E_BADINDEX) {
30 perm = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK; 33 perm = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK;
31 TPM_CHECK(TlclDefineSpace(INDEX0, perm, sizeof(uint32_t))); 34 TPM_CHECK(TlclDefineSpace(INDEX0, perm, sizeof(uint32_t)));
32 } 35 }
33 36
34 result = TlclRead(INDEX1, (uint8_t*) &x, sizeof(x)); 37 result = TlclRead(INDEX1, (uint8_t*) &x, sizeof(x));
35 if (result == TPM_E_BADINDEX) { 38 if (result == TPM_E_BADINDEX) {
36 perm = TPM_NV_PER_PPWRITE; 39 perm = TPM_NV_PER_PPWRITE;
37 TlclDefineSpace(INDEX1, perm, sizeof(uint32_t)); 40 TPM_CHECK(TlclDefineSpace(INDEX1, perm, sizeof(uint32_t)));
38 } 41 }
39 42
40 printf("TEST SUCCEEDED\n"); 43 printf("TEST SUCCEEDED\n");
41 exit(0); 44 exit(0);
42 } 45 }
OLDNEW
« no previous file with comments | « autotest/server/hardware_TPMFirmwareServer/hardware_TPMFirmwareServer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698