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

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

Issue 3389004: Rehaul of firmware TPM tests (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: remove leaked change Created 10 years, 3 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 | « tests/tpm_lite/earlyextend.c ('k') | tests/tpm_lite/earlynvram2.c » ('j') | 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 /* Test of early writing to the NVRAM. 6 /* Test of early writing to the NVRAM.
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 "utility.h" 15 #include "utility.h"
15 16
16 #define INDEX0 0xcafe 17 #define INDEX0 0xcafe
17 18
18 int main(int argc, char** argv) { 19 int main(int argc, char** argv) {
19 uint32_t perm;
20 uint32_t result;
21 uint32_t x; 20 uint32_t x;
22 21
23 TlclLibInit(); 22 TlclLibInit();
24 TlclStartup(); 23 TPM_CHECK(TlclStartup());
25 TlclContinueSelfTest(); 24 TPM_CHECK(TlclContinueSelfTest());
26 25 TPM_CHECK(TlclAssertPhysicalPresence());
27 do { 26 TPM_CHECK(TlclRead(INDEX0, (uint8_t*) &x, sizeof(x)));
28 result = TlclAssertPhysicalPresence(); 27 printf("TEST SUCCEEDED\n");
29 printf("result of AssertPP = %d\n", result); 28 return 0;
30 } while (result == TPM_E_DOING_SELFTEST ||
31 result == TPM_E_NEEDS_SELFTEST);
32
33 if (result != TPM_SUCCESS) {
34 error("AssertPP failed with error %d\n", result);
35 }
36
37 do {
38 result = TlclRead(INDEX0, (uint8_t*) &x, sizeof(x));
39 printf("result of ReadValue = %d\n", result);
40 } while (result == TPM_E_DOING_SELFTEST ||
41 result == TPM_E_NEEDS_SELFTEST);
42
43 if (result == TPM_E_BADINDEX) {
44 VBDEBUG(("creating INDEX0\n"));
45 perm = TPM_NV_PER_PPWRITE;
46 TlclDefineSpace(INDEX0, perm, sizeof(uint32_t));
47 } else if (result != TPM_SUCCESS) {
48 error("Read failed with result %d\n", result);
49 }
50
51 printf("Test completed successfully\n");
52 exit(0);
53 } 29 }
OLDNEW
« no previous file with comments | « tests/tpm_lite/earlyextend.c ('k') | tests/tpm_lite/earlynvram2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698