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

Unified Diff: pkcs11_init.cc

Issue 6823012: cryptohome: Add stub functions to query PKCS11 set up status (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cryptohome.git@master
Patch Set: Created 9 years, 8 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
Index: pkcs11_init.cc
diff --git a/pkcs11_init.cc b/pkcs11_init.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f303eb6525d9a0bbe25a48f4103417920b425484
--- /dev/null
+++ b/pkcs11_init.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
Greg Spencer (Chromium) 2011/04/08 20:21:45 Should just be "2011"
kmixter1 2011/04/08 21:04:14 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Contains the implementation of class Pkcs11Init
+
+#include "pkcs11_init.h"
+
+#include <iostream>
+
+#include <base/logging.h>
+#include <base/file_util.h>
+#include <base/string_util.h>
+#include <glib.h>
+#include <opencryptoki/pkcs11.h>
+
+#include "platform.h"
+
+namespace cryptohome {
+
+const CK_SLOT_ID kDefaultTpmSlotId = 0;
+const CK_CHAR kDefaultOpencryptokiSoPin[] = "87654321";
Greg Spencer (Chromium) 2011/04/08 20:21:45 What are these "Opencryptoki" PINs used for, and w
kmixter1 2011/04/08 21:04:14 So this file is a stripped down version of one tha
+const CK_CHAR kDefaultOpencryptokiUserPin[] = "12345678";
+const CK_CHAR kDefaultSoPin[] = "000000";
+const CK_CHAR kDefaultUserPin[] = "111111";
+const CK_CHAR kDefaultLabel[] = "TPM";
+const char kOpencryptokiDir[] = "/var/lib/opencryptoki";
+const char kUserTokenLink[] = "/var/lib/opencryptoki/tpm/chronos";
+const char kRootTokenLink[] = "/var/lib/opencryptoki/tpm/root";
+const char kUserTokenDir[] = "/home/chronos/user/.tpm";
+const char kRootTokenDir[] = "./chronos";
+const char kPkcs11Group[] = "pkcs11";
+const char kOldTokenEntry[] = "/var/lib/opencryptoki/pk_config_data";
+
+extern const char* kTpmOwnedFile;
+extern const std::string kDefaultSharedUser;
+
+Pkcs11Init::Pkcs11Init() {
+}
+
+Pkcs11Init::~Pkcs11Init() {
+}
+
+void Pkcs11Init::GetTpmTokenInfo(gchar **OUT_label,
+ gchar **OUT_so_pin,
+ gchar **OUT_user_pin) {
+ *OUT_label = g_strdup(reinterpret_cast<const gchar *>(kDefaultLabel));
+ *OUT_so_pin = g_strdup(reinterpret_cast<const gchar *>(kDefaultSoPin));
+ *OUT_user_pin = g_strdup(reinterpret_cast<const gchar *>(kDefaultUserPin));
+}
+
+} // namespace cryptohome

Powered by Google App Engine
This is Rietveld 408576698