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

Side by Side Diff: src/testsuite/earlynvram2.c

Issue 2663002: Add space redefinition test, early NV read test and early extend test. (Closed) Base URL: ssh://git@chromiumos-git/tpm_lite.git
Patch Set: Fix printf Created 10 years, 6 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
OLDNEW
(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 early writing to the NVRAM.
7 */
8
9 #include <stdio.h>
10 #include <stdint.h>
11 #include <stdlib.h>
12 #include <tss/tcs.h>
13
14 #include "tlcl.h"
15
16 #define INDEX0 0xcafe
17
18 int main(int argc, char** argv) {
19 uint32_t perm;
20 uint32_t result;
21 uint32_t x;
22
23 TlclLibInit();
24
25 #if !USE_TPM_EMULATOR
26 TlclStartup();
27 TlclContinueSelfTest();
28 #endif
29
30 do {
31 result = TlclAssertPhysicalPresenceResult();
32 printf("result of AssertPP = %d\n", result);
33 } while (result == TPM_E_DOING_SELFTEST ||
34 result == TPM_E_NEEDS_SELFTEST);
35
36 if (result != TPM_SUCCESS) {
37 error("AssertPP failed with error %d\n", result);
38 }
39
40 do {
41 result = TlclWrite(INDEX0, (uint8_t*) &x, sizeof(x));
42 printf("result of WriteValue = %d\n", result);
43 } while (result == TPM_E_DOING_SELFTEST ||
44 result == TPM_E_NEEDS_SELFTEST);
45
46 if (result == TPM_E_BADINDEX) {
47 warning("creating INDEX0\n");
48 perm = TPM_NV_PER_PPWRITE;
49 TlclDefineSpace(INDEX0, perm, sizeof(uint32_t));
50 } else if (result != TPM_SUCCESS) {
51 error("Write failed with result %d\n", result);
52 }
53
54 printf("Test completed successfully\n");
55 exit(0);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698