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 |