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

Unified Diff: tests/tpm_lite/spaceperm.c

Issue 2919010: Add tpm lite to vboot reference (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/tpm_lite/redefine.c ('k') | tests/tpm_lite/writelimit.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/tpm_lite/spaceperm.c
diff --git a/tests/tpm_lite/spaceperm.c b/tests/tpm_lite/spaceperm.c
new file mode 100644
index 0000000000000000000000000000000000000000..f211ca432684301af7cc8f4e52787c5dbb744dfa
--- /dev/null
+++ b/tests/tpm_lite/spaceperm.c
@@ -0,0 +1,44 @@
+/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Test of space permissions retrieval. The spaces 0xcafe and 0xcaff must have
+ * already been defined (by running, for instance, the "redefine" test).
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tss/tcs.h>
+
+#include "tlcl.h"
+#include "utility.h"
+
+#define INDEX0 0xcafe
+#define INDEX1 0xcaff
+
+int main(int argc, char** argv) {
+ uint32_t perm;
+ uint32_t perm_pp_gl = TPM_NV_PER_PPWRITE | TPM_NV_PER_GLOBALLOCK;
+ uint32_t perm_pp = TPM_NV_PER_PPWRITE;
+ uint32_t result;
+
+ TlclLibInit();
+ TlclStartup();
+ TlclContinueSelfTest();
+ TlclAssertPhysicalPresence();
+
+ result = TlclGetPermissions(INDEX0, &perm);
+ assert(result == TPM_SUCCESS);
+ printf("permissions for INDEX0 = 0x%x\n", perm);
+ assert((perm & perm_pp_gl) == perm_pp_gl);
+
+ result = TlclGetPermissions(INDEX1, &perm);
+ assert(result == TPM_SUCCESS);
+ printf("permissions for INDEX1 = 0x%x\n", perm);
+ assert((perm & perm_pp) == perm_pp);
+
+ printf("Test completed successfully\n");
+ exit(0);
+}
« no previous file with comments | « tests/tpm_lite/redefine.c ('k') | tests/tpm_lite/writelimit.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698