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

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

Issue 2719006: Added TPM command to read space permissions, and a correctness test. (Closed) Base URL: ssh://git@chromiumos-git/tpm_lite.git
Patch Set: Alphabetize. 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') | src/tlcl/generator.c » ('j') | 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 /* Test of space permissions retrieval. The spaces 0xcafe and 0xcaff must have
7 * already been defined (by running, for instance, the "redefine" test).
8 */
9
10 #include <stdint.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <tss/tcs.h>
14
15 #include "tlcl.h"
16
17 #define INDEX0 0xcafe
18 #define INDEX1 0xcaff
19
20 int main(int argc, char** argv) {
21 uint32_t perm;
22 uint32_t perm_pp_gl = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK;
23 uint32_t perm_pp = TPM_NV_PER_PPWRITE;
24 uint32_t result;
25
26 TlclLibInit();
27
28 #if !USE_TPM_EMULATOR
29 TlclStartup();
30 TlclContinueSelfTest();
31 #endif
32
33 TlclAssertPhysicalPresence();
34
35 result = TlclGetPermissions(INDEX0, &perm);
36 assert(result == TPM_SUCCESS);
37 printf("permissions for INDEX0 = 0x%x\n", perm);
38 assert((perm & perm_pp_gl) == perm_pp_gl);
39
40 result = TlclGetPermissions(INDEX1, &perm);
41 assert(result == TPM_SUCCESS);
42 printf("permissions for INDEX1 = 0x%x\n", perm);
43 assert((perm & perm_pp) == perm_pp);
44
45 printf("Test completed successfully\n");
46 exit(0);
47 }
OLDNEW
« no previous file with comments | « src/testsuite/Makefile ('k') | src/tlcl/generator.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698