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

Unified Diff: chromeos/dbus/cryptohome_client.cc

Issue 26407002: Add support for the Pkcs11GetTpmTokenInfoForUser cryptohome call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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: chromeos/dbus/cryptohome_client.cc
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index cd027e3e6249f3b87329ff5fcff342934f8dc176..6da34676204bc5bf8c1a8d42b5ebcdf1776ebc17 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -330,6 +330,23 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
+ virtual void Pkcs11GetTpmTokenInfoForUser(
+ const std::string& username,
+ const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
+ dbus::MethodCall method_call(
+ cryptohome::kCryptohomeInterface,
+ cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(username);
+ proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(
+ &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ }
+
+ // CryptohomeClient override.
virtual bool InstallAttributesGet(const std::string& name,
std::vector<uint8>* value,
bool* successful) OVERRIDE {
@@ -774,17 +791,37 @@ class CryptohomeClientImpl : public CryptohomeClient {
void OnPkcs11GetTpmTokenInfo(const Pkcs11GetTpmTokenInfoCallback& callback,
dbus::Response* response) {
if (!response) {
- callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string());
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
return;
}
dbus::MessageReader reader(response);
std::string label;
std::string user_pin;
if (!reader.PopString(&label) || !reader.PopString(&user_pin)) {
- callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string());
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
+ return;
+ }
+ const int kDefaultSlot = 0;
+ callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin, kDefaultSlot);
+ }
+
+ void OnPkcs11GetTpmTokenInfoForUser(
+ const Pkcs11GetTpmTokenInfoCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
+ return;
+ }
+ dbus::MessageReader reader(response);
+ std::string label;
+ std::string user_pin;
+ int slot = 0;
+ if (!reader.PopString(&label) || !reader.PopString(&user_pin) ||
+ !reader.PopInt32(&slot)) {
satorux1 2013/10/08 04:29:33 might want to add: LOG(ERROR) << "Invalid respo
Darren Krahn 2013/10/08 17:06:41 Done. Some responses may be sensitive but I added
+ callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
return;
}
- callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin);
+ callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin, slot);
}
// Handles AsyncCallStatus signal.

Powered by Google App Engine
This is Rietveld 408576698