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

Unified Diff: tpm.cc

Issue 6821025: entd: move opencryptoki initialization out of entd (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/entd.git@master
Patch Set: switch to using a flag to expect cryptohome to init pkcs11 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
« no previous file with comments | « tpm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tpm.cc
diff --git a/tpm.cc b/tpm.cc
index 95b7e8ae29aaf890bca8aa6b476b7ae704ebc36e..04d3f5af4cb370b64dea1aa5a16092ed6b80e48f 100644
--- a/tpm.cc
+++ b/tpm.cc
@@ -9,6 +9,8 @@
namespace entd {
+bool Tpm::cryptohome_init_pkcs11 = false;
+
bool Tpm::Initialize() {
return true;
}
@@ -52,6 +54,14 @@ bool Tpm::InitializeTemplate(
v8::Handle<v8::Value>(), // Don't need any data.
v8::DEFAULT, // DEFAULT AccessControl
v8::DontDelete);
+ if (cryptohome_init_pkcs11) {
+ instance_t->SetAccessor(v8::String::New("isTokenReady"),
+ Tpm::IsTokenReady,
+ 0, // readonly, so setter is NULL
+ v8::Handle<v8::Value>(), // Don't need any data.
+ v8::DEFAULT, // DEFAULT AccessControl
+ v8::DontDelete);
+ }
return true;
}
@@ -103,4 +113,10 @@ v8::Handle<v8::Value> Tpm::GetStatusString(v8::Local<v8::String> property,
return v8::String::New(status.c_str());
}
+// static
+v8::Handle<v8::Value> Tpm::IsTokenReady(v8::Local<v8::String> property,
+ const v8::AccessorInfo& info) {
+ return v8::Boolean::New(chromeos::CryptohomePkcs11IsTpmTokenReady());
+}
+
} // namespace entd
« no previous file with comments | « tpm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698