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

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

Issue 2800021: Add fastenable test. (Closed) Base URL: ssh://git@chromiumos-git/tpm_lite.git
Patch Set: 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
« no previous file with comments | « src/testsuite/Makefile ('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
(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 /* Testing: ForceClear and behavior of disable and permanent deactivated flags.
7 *
8 * ForceClear sets the permanent disable and deactivated flags to their default
9 * value of TRUE. The specs say nothing about STCLEAR flags, so they should be
10 * left alone. This test checks that both flags may be reset without a reboot,
11 * resulting in a fully enabled and activated TPM. (We know that because
12 * ForceClear requires that the TPM be enabled and activated to run.)
13 */
14
15 #include <stdio.h>
16 #include <tss/tcs.h>
17
18 #include "tlcl.h"
19
20 #define CHECK(command) do { if ((command) != TPM_SUCCESS) \
21 error(#command "\n"); } \
22 while(0)
23
24 int main(int argc, char** argv) {
25 uint8_t disable, deactivated;
26 int i;
27
28 TlclLibInit();
29
30 #if !USE_TPM_EMULATOR
31 /* The emulator does these itself. */
32 CHECK(TlclStartup());
33 CHECK(TlclSelftestfull());
34 #endif
35
36 CHECK(TlclAssertPhysicalPresence());
37 printf("PP asserted\n");
38
39 CHECK(TlclGetFlags(&disable, &deactivated));
40 printf("disable is %d, deactivated is %d\n", disable, deactivated);
41
42 for (i = 0; i < 2; i++) {
43
44 CHECK(TlclForceClear());
45 printf("tpm is cleared\n");
46
47 CHECK(TlclGetFlags(&disable, &deactivated));
48 printf("disable is %d, deactivated is %d\n", disable, deactivated);
49
50 CHECK(TlclSetEnable());
51 printf("disable flag is cleared\n");
52
53 CHECK(TlclGetFlags(&disable, &deactivated));
54 printf("disable is %d, deactivated is %d\n", disable, deactivated);
55
56 CHECK(TlclSetDeactivated(0));
57 printf("deactivated flag is cleared\n");
58
59 CHECK(TlclGetFlags(&disable, &deactivated));
60 printf("disable is %d, deactivated is %d\n", disable, deactivated);
61 }
62
63 return 0;
64 }
OLDNEW
« no previous file with comments | « src/testsuite/Makefile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698