trunks: Update libchrome APIs to r395517

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

BUG: 28985443
TEST: All tests in trunks_test pass on dragonboard-eng build

Change-Id: Ic6613d2bda07c0ac892690de852dc4e08e028fc7
diff --git a/trunks/background_command_transceiver.cc b/trunks/background_command_transceiver.cc
index 7748649..4a62e7d 100644
--- a/trunks/background_command_transceiver.cc
+++ b/trunks/background_command_transceiver.cc
@@ -22,7 +22,7 @@
 #include <base/logging.h>
 #include <base/single_thread_task_runner.h>
 #include <base/synchronization/waitable_event.h>
-#include <base/thread_task_runner_handle.h>
+#include <base/threading/thread_task_runner_handle.h>
 
 namespace {
 
diff --git a/trunks/generator/generator.py b/trunks/generator/generator.py
index d818f8f..06c7a40 100755
--- a/trunks/generator/generator.py
+++ b/trunks/generator/generator.py
@@ -115,6 +115,7 @@
 #include "trunks/trunks_export.h"
 """
 _IMPLEMENTATION_FILE_INCLUDES = """
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
@@ -1252,7 +1253,7 @@
     %(var_name)s_bytes.replace(2, std::string::npos, tmp);
   }"""
   _HASH_START = """
-  scoped_ptr<crypto::SecureHash> hash(crypto::SecureHash::Create(
+  std::unique_ptr<crypto::SecureHash> hash(crypto::SecureHash::Create(
       crypto::SecureHash::SHA256));"""
   _HASH_UPDATE = """
   hash->Update(%(var_name)s.data(),
diff --git a/trunks/hmac_authorization_delegate.cc b/trunks/hmac_authorization_delegate.cc
index d88ff91..59c005e 100644
--- a/trunks/hmac_authorization_delegate.cc
+++ b/trunks/hmac_authorization_delegate.cc
@@ -17,7 +17,6 @@
 #include "trunks/hmac_authorization_delegate.h"
 
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/stl_util.h>
 #include <crypto/secure_util.h>
 #include <openssl/aes.h>
diff --git a/trunks/hmac_session_impl.h b/trunks/hmac_session_impl.h
index 97726a7..0cc4095 100644
--- a/trunks/hmac_session_impl.h
+++ b/trunks/hmac_session_impl.h
@@ -19,6 +19,7 @@
 
 #include "trunks/hmac_session.h"
 
+#include <memory>
 #include <string>
 
 #include <base/macros.h>
@@ -69,7 +70,7 @@
   HmacAuthorizationDelegate hmac_delegate_;
   // This object is used to manage the TPM session associated with this
   // HmacSession.
-  scoped_ptr<SessionManager> session_manager_;
+  std::unique_ptr<SessionManager> session_manager_;
 
   friend class HmacSessionTest;
   DISALLOW_COPY_AND_ASSIGN(HmacSessionImpl);
diff --git a/trunks/policy_session_impl.h b/trunks/policy_session_impl.h
index e04f16c..7f78062 100644
--- a/trunks/policy_session_impl.h
+++ b/trunks/policy_session_impl.h
@@ -19,6 +19,7 @@
 
 #include "trunks/policy_session.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -74,7 +75,7 @@
   HmacAuthorizationDelegate hmac_delegate_;
   // This object is used to manage the TPM session associated with this
   // AuthorizationSession.
-  scoped_ptr<SessionManager> session_manager_;
+  std::unique_ptr<SessionManager> session_manager_;
 
   friend class PolicySessionTest;
   DISALLOW_COPY_AND_ASSIGN(PolicySessionImpl);
diff --git a/trunks/tpm_generated.cc b/trunks/tpm_generated.cc
index 44cf3df..1fd8da5 100644
--- a/trunks/tpm_generated.cc
+++ b/trunks/tpm_generated.cc
@@ -18,6 +18,7 @@
 
 #include "trunks/tpm_generated.h"
 
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
@@ -8116,7 +8117,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(startup_type_bytes.data(), startup_type_bytes.size());
@@ -8215,7 +8216,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -8307,7 +8308,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(shutdown_type_bytes.data(), shutdown_type_bytes.size());
@@ -8406,7 +8407,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -8498,7 +8499,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(full_test_bytes.data(), full_test_bytes.size());
@@ -8597,7 +8598,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -8689,7 +8690,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(to_test_bytes.data(), to_test_bytes.size());
@@ -8789,7 +8790,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -8887,7 +8888,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   std::string command_hash(32, 0);
@@ -8985,7 +8986,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -9148,7 +9149,7 @@
     }
     nonce_caller_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(tpm_key_name.data(), tpm_key_name.size());
@@ -9273,7 +9274,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -9411,7 +9412,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(session_handle_name.data(), session_handle_name.size());
@@ -9510,7 +9511,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -9638,7 +9639,7 @@
     }
     in_sensitive_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(parent_handle_name.data(), parent_handle_name.size());
@@ -9754,7 +9755,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -9933,7 +9934,7 @@
     }
     in_private_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(parent_handle_name.data(), parent_handle_name.size());
@@ -10044,7 +10045,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -10188,7 +10189,7 @@
     }
     in_private_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(in_private_bytes.data(), in_private_bytes.size());
@@ -10300,7 +10301,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -10421,7 +10422,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(object_handle_name.data(), object_handle_name.size());
@@ -10523,7 +10524,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -10681,7 +10682,7 @@
     }
     credential_blob_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(activate_handle_name.data(), activate_handle_name.size());
@@ -10790,7 +10791,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -10940,7 +10941,7 @@
     }
     credential_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(handle_name.data(), handle_name.size());
@@ -11047,7 +11048,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -11178,7 +11179,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(item_handle_name.data(), item_handle_name.size());
@@ -11278,7 +11279,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -11415,7 +11416,7 @@
     }
     new_auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(object_handle_name.data(), object_handle_name.size());
@@ -11521,7 +11522,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -11676,7 +11677,7 @@
     }
     encryption_key_in_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(object_handle_name.data(), object_handle_name.size());
@@ -11787,7 +11788,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -11966,7 +11967,7 @@
     }
     in_duplicate_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(old_parent_name.data(), old_parent_name.size());
@@ -12079,7 +12080,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -12253,7 +12254,7 @@
     }
     encryption_key_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(parent_handle_name.data(), parent_handle_name.size());
@@ -12368,7 +12369,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -12522,7 +12523,7 @@
     }
     message_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -12631,7 +12632,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -12781,7 +12782,7 @@
     }
     cipher_text_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -12890,7 +12891,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -13014,7 +13015,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -13115,7 +13116,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -13253,7 +13254,7 @@
     }
     in_point_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -13356,7 +13357,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -13473,7 +13474,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(curve_id_bytes.data(), curve_id_bytes.size());
@@ -13573,7 +13574,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -13707,7 +13708,7 @@
     }
     in_qs_b_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_a_name.data(), key_a_name.size());
@@ -13820,7 +13821,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -13978,7 +13979,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -14091,7 +14092,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -14244,7 +14245,7 @@
     }
     data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(data_bytes.data(), data_bytes.size());
@@ -14350,7 +14351,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -14496,7 +14497,7 @@
     }
     buffer_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(handle_name.data(), handle_name.size());
@@ -14601,7 +14602,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -14720,7 +14721,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(bytes_requested_bytes.data(), bytes_requested_bytes.size());
@@ -14820,7 +14821,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -14941,7 +14942,7 @@
     }
     in_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(in_data_bytes.data(), in_data_bytes.size());
@@ -15040,7 +15041,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -15153,7 +15154,7 @@
     }
     auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(handle_name.data(), handle_name.size());
@@ -15264,7 +15265,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -15380,7 +15381,7 @@
     }
     auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_bytes.data(), auth_bytes.size());
@@ -15488,7 +15489,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -15604,7 +15605,7 @@
     }
     buffer_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sequence_handle_name.data(), sequence_handle_name.size());
@@ -15706,7 +15707,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -15826,7 +15827,7 @@
     }
     buffer_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sequence_handle_name.data(), sequence_handle_name.size());
@@ -15933,7 +15934,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -16087,7 +16088,7 @@
     }
     buffer_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_handle_name.data(), pcr_handle_name.size());
@@ -16193,7 +16194,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -16335,7 +16336,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(object_handle_name.data(), object_handle_name.size());
@@ -16445,7 +16446,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -16618,7 +16619,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sign_handle_name.data(), sign_handle_name.size());
@@ -16734,7 +16735,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -16901,7 +16902,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sign_handle_name.data(), sign_handle_name.size());
@@ -17010,7 +17011,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -17176,7 +17177,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(privacy_admin_handle_name.data(),
@@ -17290,7 +17291,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -17460,7 +17461,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(privacy_handle_name.data(), privacy_handle_name.size());
@@ -17570,7 +17571,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -17735,7 +17736,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(privacy_admin_handle_name.data(),
@@ -17846,7 +17847,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -18006,7 +18007,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sign_handle_name.data(), sign_handle_name.size());
@@ -18122,7 +18123,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -18270,7 +18271,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(param_size_bytes.data(), param_size_bytes.size());
@@ -18375,7 +18376,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -18513,7 +18514,7 @@
     }
     digest_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -18619,7 +18620,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -18756,7 +18757,7 @@
     }
     digest_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(key_handle_name.data(), key_handle_name.size());
@@ -18864,7 +18865,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -18993,7 +18994,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -19101,7 +19102,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -19217,7 +19218,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_handle_name.data(), pcr_handle_name.size());
@@ -19319,7 +19320,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -19430,7 +19431,7 @@
     }
     event_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_handle_name.data(), pcr_handle_name.size());
@@ -19533,7 +19534,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -19639,7 +19640,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_selection_in_bytes.data(), pcr_selection_in_bytes.size());
@@ -19741,7 +19742,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -19865,7 +19866,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -19971,7 +19972,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -20130,7 +20131,7 @@
     }
     auth_policy_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -20238,7 +20239,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -20361,7 +20362,7 @@
     }
     auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_handle_name.data(), pcr_handle_name.size());
@@ -20463,7 +20464,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -20564,7 +20565,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(pcr_handle_name.data(), pcr_handle_name.size());
@@ -20663,7 +20664,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -20803,7 +20804,7 @@
     }
     nonce_tpm_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_object_name.data(), auth_object_name.size());
@@ -20922,7 +20923,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -21103,7 +21104,7 @@
     }
     nonce_tpm_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -21219,7 +21220,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -21397,7 +21398,7 @@
     }
     timeout_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -21511,7 +21512,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -21624,7 +21625,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -21726,7 +21727,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -21845,7 +21846,7 @@
     }
     pcr_digest_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -21950,7 +21951,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -22057,7 +22058,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -22159,7 +22160,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -22299,7 +22300,7 @@
     }
     operand_b_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -22413,7 +22414,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -22552,7 +22553,7 @@
     }
     operand_b_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -22660,7 +22661,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -22773,7 +22774,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -22875,7 +22876,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -22978,7 +22979,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -23077,7 +23078,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -23191,7 +23192,7 @@
     }
     cp_hash_a_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -23293,7 +23294,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -23406,7 +23407,7 @@
     }
     name_hash_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -23508,7 +23509,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -23634,7 +23635,7 @@
     }
     object_name_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -23742,7 +23743,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -23882,7 +23883,7 @@
     }
     approved_policy_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -23993,7 +23994,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -24100,7 +24101,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -24199,7 +24200,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -24296,7 +24297,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -24395,7 +24396,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -24491,7 +24492,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -24591,7 +24592,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -24715,7 +24716,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(policy_session_name.data(), policy_session_name.size());
@@ -24817,7 +24818,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -24950,7 +24951,7 @@
     }
     in_sensitive_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(primary_handle_name.data(), primary_handle_name.size());
@@ -25072,7 +25073,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -25246,7 +25247,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -25351,7 +25352,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -25476,7 +25477,7 @@
     }
     auth_policy_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -25581,7 +25582,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -25686,7 +25687,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -25785,7 +25786,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -25880,7 +25881,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -25979,7 +25980,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -26074,7 +26075,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -26172,7 +26173,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -26273,7 +26274,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -26375,7 +26376,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -26486,7 +26487,7 @@
     }
     new_auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -26588,7 +26589,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -26691,7 +26692,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(lock_handle_name.data(), lock_handle_name.size());
@@ -26790,7 +26791,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -26910,7 +26911,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(lock_handle_name.data(), lock_handle_name.size());
@@ -27018,7 +27019,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -27140,7 +27141,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -27245,7 +27246,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -27350,7 +27351,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -27452,7 +27453,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -27580,7 +27581,7 @@
     }
     fu_digest_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(authorization_name.data(), authorization_name.size());
@@ -27689,7 +27690,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -27805,7 +27806,7 @@
     }
     fu_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(fu_data_bytes.data(), fu_data_bytes.size());
@@ -27906,7 +27907,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -28017,7 +28018,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sequence_number_bytes.data(), sequence_number_bytes.size());
@@ -28117,7 +28118,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -28231,7 +28232,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(save_handle_name.data(), save_handle_name.size());
@@ -28331,7 +28332,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -28433,7 +28434,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(context_bytes.data(), context_bytes.size());
@@ -28538,7 +28539,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -28634,7 +28635,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(flush_handle_bytes.data(), flush_handle_bytes.size());
@@ -28733,7 +28734,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -28840,7 +28841,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -28945,7 +28946,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -29041,7 +29042,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   std::string command_hash(32, 0);
@@ -29138,7 +29139,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -29241,7 +29242,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -29343,7 +29344,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -29446,7 +29447,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_name.data(), auth_name.size());
@@ -29548,7 +29549,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -29658,7 +29659,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(capability_bytes.data(), capability_bytes.size());
@@ -29765,7 +29766,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -29878,7 +29879,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(parameters_bytes.data(), parameters_bytes.size());
@@ -29977,7 +29978,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -30090,7 +30091,7 @@
     }
     auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -30195,7 +30196,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -30304,7 +30305,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -30406,7 +30407,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -30518,7 +30519,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(nv_index_name.data(), nv_index_name.size());
@@ -30620,7 +30621,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -30726,7 +30727,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(nv_index_name.data(), nv_index_name.size());
@@ -30827,7 +30828,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -30978,7 +30979,7 @@
     }
     data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -31086,7 +31087,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -31198,7 +31199,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -31300,7 +31301,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -31422,7 +31423,7 @@
     }
     data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -31527,7 +31528,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -31643,7 +31644,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -31748,7 +31749,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -31858,7 +31859,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -31960,7 +31961,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -32061,7 +32062,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -32160,7 +32161,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -32278,7 +32279,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -32387,7 +32388,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -32520,7 +32521,7 @@
   if (rc != TPM_RC_SUCCESS) {
     return rc;
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(auth_handle_name.data(), auth_handle_name.size());
@@ -32622,7 +32623,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -32737,7 +32738,7 @@
     }
     new_auth_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(nv_index_name.data(), nv_index_name.size());
@@ -32839,7 +32840,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
@@ -32983,7 +32984,7 @@
     }
     qualifying_data_bytes.replace(2, std::string::npos, tmp);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(sign_handle_name.data(), sign_handle_name.size());
@@ -33102,7 +33103,7 @@
     // Keep the parameter section in |buffer|.
     buffer.erase(parameter_section_size);
   }
-  scoped_ptr<crypto::SecureHash> hash(
+  std::unique_ptr<crypto::SecureHash> hash(
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(response_code_bytes.data(), response_code_bytes.size());
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
diff --git a/trunks/tpm_utility_impl.cc b/trunks/tpm_utility_impl.cc
index 39559d3..fe79d93 100644
--- a/trunks/tpm_utility_impl.cc
+++ b/trunks/tpm_utility_impl.cc
@@ -16,8 +16,9 @@
 
 #include "trunks/tpm_utility_impl.h"
 
+#include <memory>
+
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/sha1.h>
 #include <base/stl_util.h>
 #include <crypto/openssl_util.h>
@@ -97,7 +98,7 @@
 
 TPM_RC TpmUtilityImpl::Clear() {
   TPM_RC result = TPM_RC_SUCCESS;
-  scoped_ptr<AuthorizationDelegate> password_delegate(
+  std::unique_ptr<AuthorizationDelegate> password_delegate(
       factory_.GetPasswordAuthorization(""));
   result = factory_.GetTpm()->ClearSync(TPM_RH_PLATFORM,
                                         NameFromHandle(TPM_RH_PLATFORM),
@@ -105,7 +106,7 @@
   // If there was an error in the initialization, platform auth is in a bad
   // state.
   if (result == TPM_RC_AUTH_MISSING) {
-    scoped_ptr<AuthorizationDelegate> authorization(
+    std::unique_ptr<AuthorizationDelegate> authorization(
         factory_.GetPasswordAuthorization(kPlatformPassword));
     result = factory_.GetTpm()->ClearSync(
         TPM_RH_PLATFORM, NameFromHandle(TPM_RH_PLATFORM), authorization.get());
@@ -131,7 +132,7 @@
 
 TPM_RC TpmUtilityImpl::InitializeTpm() {
   TPM_RC result = TPM_RC_SUCCESS;
-  scoped_ptr<TpmState> tpm_state(factory_.GetTpmState());
+  std::unique_ptr<TpmState> tpm_state(factory_.GetTpmState());
   result = tpm_state->Initialize();
   if (result) {
     LOG(ERROR) << __func__ << ": " << GetErrorString(result);
@@ -148,7 +149,7 @@
   // We expect the firmware has already locked down the platform hierarchy. If
   // it hasn't, do it now.
   if (tpm_state->IsPlatformHierarchyEnabled()) {
-    scoped_ptr<AuthorizationDelegate> empty_password(
+    std::unique_ptr<AuthorizationDelegate> empty_password(
         factory_.GetPasswordAuthorization(""));
     result = SetHierarchyAuthorization(TPM_RH_PLATFORM, kPlatformPassword,
                                        empty_password.get());
@@ -165,7 +166,7 @@
       LOG(ERROR) << __func__ << ": " << GetErrorString(result);
       return result;
     }
-    scoped_ptr<AuthorizationDelegate> authorization(
+    std::unique_ptr<AuthorizationDelegate> authorization(
         factory_.GetPasswordAuthorization(kPlatformPassword));
     result = DisablePlatformHierarchy(authorization.get());
     if (result != TPM_RC_SUCCESS) {
@@ -217,7 +218,7 @@
         PCR_SELECT_MAX;
     ++pcr_allocation.count;
   }
-  scoped_ptr<AuthorizationDelegate> platform_delegate(
+  std::unique_ptr<AuthorizationDelegate> platform_delegate(
       factory_.GetPasswordAuthorization(platform_password));
   TPMI_YES_NO allocation_success;
   uint32_t max_pcr;
@@ -261,14 +262,14 @@
     return result;
   }
 
-  scoped_ptr<HmacSession> session = factory_.GetHmacSession();
+  std::unique_ptr<HmacSession> session = factory_.GetHmacSession();
   result = session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error initializing AuthorizationSession: "
                << GetErrorString(result);
     return result;
   }
-  scoped_ptr<TpmState> tpm_state(factory_.GetTpmState());
+  std::unique_ptr<TpmState> tpm_state(factory_.GetTpmState());
   result = tpm_state->Initialize();
   session->SetEntityAuthorizationValue("");
   session->SetFutureAuthorizationValue(endorsement_password);
@@ -654,7 +655,7 @@
   in_scheme.scheme = TPM_ALG_NULL;
   TPM2B_ATTEST certify_info;
   TPMT_SIGNATURE signature;
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_.GetPasswordAuthorization("");
   TPM_RC result = factory_.GetTpm()->CertifyCreationSync(
       TPM_RH_NULL, "", key_handle, "", qualifying_data, creation_hash,
@@ -1024,7 +1025,7 @@
     return result;
   }
   TPM_HANDLE object_handle;
-  scoped_ptr<AuthorizationDelegate> password_delegate =
+  std::unique_ptr<AuthorizationDelegate> password_delegate =
       factory_.GetPasswordAuthorization("");
   result = LoadKey(sealed_data, password_delegate.get(), &object_handle);
   if (result != TPM_RC_SUCCESS) {
@@ -1063,7 +1064,7 @@
                                                   const std::string& pcr_value,
                                                   std::string* policy_digest) {
   CHECK(policy_digest);
-  scoped_ptr<PolicySession> session = factory_.GetTrialSession();
+  std::unique_ptr<PolicySession> session = factory_.GetTrialSession();
   TPM_RC result = session->StartUnboundSession(false);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting unbound trial session: "
@@ -1352,13 +1353,13 @@
 
 TPM_RC TpmUtilityImpl::SetKnownOwnerPassword(
     const std::string& known_owner_password) {
-  scoped_ptr<TpmState> tpm_state(factory_.GetTpmState());
+  std::unique_ptr<TpmState> tpm_state(factory_.GetTpmState());
   TPM_RC result = tpm_state->Initialize();
   if (result) {
     LOG(ERROR) << __func__ << ": " << GetErrorString(result);
     return result;
   }
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_.GetPasswordAuthorization("");
   if (tpm_state->IsOwnerPasswordSet()) {
     LOG(INFO) << "Owner password is already set. "
@@ -1378,7 +1379,7 @@
 TPM_RC TpmUtilityImpl::CreateStorageRootKeys(
     const std::string& owner_password) {
   TPM_RC result = TPM_RC_SUCCESS;
-  scoped_ptr<TpmState> tpm_state(factory_.GetTpmState());
+  std::unique_ptr<TpmState> tpm_state(factory_.GetTpmState());
   result = tpm_state->Initialize();
   if (result) {
     LOG(ERROR) << __func__ << ": " << GetErrorString(result);
@@ -1396,7 +1397,7 @@
   TPMT_TK_CREATION creation_ticket;
   TPM2B_NAME object_name;
   object_name.size = 0;
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_.GetPasswordAuthorization(owner_password);
   if (tpm_state->IsRSASupported()) {
     bool exists = false;
@@ -1525,7 +1526,7 @@
   // TODO(usanghi): MITM vulnerability with SaltingKey creation.
   // Currently we cannot verify the key returned by the TPM.
   // crbug.com/442331
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_.GetPasswordAuthorization("");
   result = factory_.GetTpm()->CreateSync(
       kRSAStorageRootKey, parent_name, sensitive_create,
@@ -1547,7 +1548,7 @@
     return result;
   }
   ScopedKeyHandle key(factory_, key_handle);
-  scoped_ptr<AuthorizationDelegate> owner_delegate =
+  std::unique_ptr<AuthorizationDelegate> owner_delegate =
       factory_.GetPasswordAuthorization(owner_password);
   result = factory_.GetTpm()->EvictControlSync(
       TPM_RH_OWNER, NameFromHandle(TPM_RH_OWNER), key_handle,
diff --git a/trunks/tpm_utility_impl.h b/trunks/tpm_utility_impl.h
index 0d6ff80..eb71eeb 100644
--- a/trunks/tpm_utility_impl.h
+++ b/trunks/tpm_utility_impl.h
@@ -23,7 +23,6 @@
 #include <string>
 
 #include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
 #include <gtest/gtest_prod.h>
 
 #include "trunks/trunks_export.h"
diff --git a/trunks/trunks_client.cc b/trunks/trunks_client.cc
index 76e2305..ef5f0d0 100644
--- a/trunks/trunks_client.cc
+++ b/trunks/trunks_client.cc
@@ -18,10 +18,12 @@
 // does not provide direct access to the trunksd D-Bus interface.
 
 #include <stdio.h>
+#include <memory>
 #include <string>
 
 #include <base/command_line.h>
 #include <base/logging.h>
+#include <base/memory/ptr_util.h>
 #include <brillo/syslog_logging.h>
 
 #include "trunks/error_codes.h"
@@ -91,7 +93,7 @@
 }
 
 int DumpStatus(TrunksFactory* factory) {
-  scoped_ptr<trunks::TpmState> state = factory->GetTpmState();
+  std::unique_ptr<trunks::TpmState> state = factory->GetTpmState();
   trunks::TPM_RC result = state->Initialize();
   if (result != trunks::TPM_RC_SUCCESS) {
     LOG(ERROR) << "Failed to read TPM state: "
@@ -136,8 +138,8 @@
     return 0;
   }
 
-  scoped_ptr<TrunksFactory> factory = scoped_ptr<TrunksFactory>(
-      new trunks::TrunksFactoryImpl(true /* failure_is_fatal */));
+  std::unique_ptr<TrunksFactory> factory =
+      base::MakeUnique<trunks::TrunksFactoryImpl>(true /* failure_is_fatal */);
 
   if (cl->HasSwitch("status")) {
     return DumpStatus(factory.get());
diff --git a/trunks/trunks_client_test.cc b/trunks/trunks_client_test.cc
index 2c8611e..4b4f650 100644
--- a/trunks/trunks_client_test.cc
+++ b/trunks/trunks_client_test.cc
@@ -62,14 +62,14 @@
   crypto::EnsureOpenSSLInit();
 }
 
-TrunksClientTest::TrunksClientTest(scoped_ptr<TrunksFactory> factory)
+TrunksClientTest::TrunksClientTest(std::unique_ptr<TrunksFactory> factory)
     : factory_(std::move(factory)) {}
 
 TrunksClientTest::~TrunksClientTest() {}
 
 bool TrunksClientTest::RNGTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -97,8 +97,8 @@
 }
 
 bool TrunksClientTest::SignTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -138,8 +138,8 @@
 }
 
 bool TrunksClientTest::DecryptTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -165,8 +165,8 @@
 }
 
 bool TrunksClientTest::ImportTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -195,8 +195,8 @@
 }
 
 bool TrunksClientTest::AuthChangeTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -236,8 +236,8 @@
 }
 
 bool TrunksClientTest::VerifyKeyCreationTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -291,8 +291,8 @@
 }
 
 bool TrunksClientTest::SealedDataTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -313,7 +313,7 @@
     LOG(ERROR) << "Error creating Sealed Object: " << GetErrorString(result);
     return false;
   }
-  scoped_ptr<PolicySession> policy_session = factory_->GetPolicySession();
+  std::unique_ptr<PolicySession> policy_session = factory_->GetPolicySession();
   result = policy_session->StartUnboundSession(false);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting policy session: " << GetErrorString(result);
@@ -357,8 +357,8 @@
 }
 
 bool TrunksClientTest::PCRTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   if (utility->StartSession(session.get()) != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session.";
     return false;
@@ -394,8 +394,8 @@
 }
 
 bool TrunksClientTest::PolicyAuthValueTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<PolicySession> trial_session = factory_->GetTrialSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<PolicySession> trial_session = factory_->GetTrialSession();
   TPM_RC result;
   result = trial_session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
@@ -417,7 +417,7 @@
   // Now that we have the digest, we can close the trial session and use hmac.
   trial_session.reset();
 
-  scoped_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
+  std::unique_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
   result = hmac_session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session: " << GetErrorString(result);
@@ -445,7 +445,7 @@
   // Now we can reset the hmac_session.
   hmac_session.reset();
 
-  scoped_ptr<PolicySession> policy_session = factory_->GetPolicySession();
+  std::unique_ptr<PolicySession> policy_session = factory_->GetPolicySession();
   result = policy_session->StartUnboundSession(false);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting policy session: " << GetErrorString(result);
@@ -503,8 +503,8 @@
 }
 
 bool TrunksClientTest::PolicyAndTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<PolicySession> trial_session = factory_->GetTrialSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<PolicySession> trial_session = factory_->GetTrialSession();
   TPM_RC result;
   result = trial_session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
@@ -542,7 +542,7 @@
   // Now that we have the digest, we can close the trial session and use hmac.
   trial_session.reset();
 
-  scoped_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
+  std::unique_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
   result = hmac_session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session: " << GetErrorString(result);
@@ -571,7 +571,7 @@
   // Now we can reset the hmac_session.
   hmac_session.reset();
 
-  scoped_ptr<PolicySession> policy_session = factory_->GetPolicySession();
+  std::unique_ptr<PolicySession> policy_session = factory_->GetPolicySession();
   result = policy_session->StartUnboundSession(false);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting policy session: " << GetErrorString(result);
@@ -597,7 +597,7 @@
     LOG(ERROR) << "Error using key to sign: " << GetErrorString(result);
     return false;
   }
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_->GetPasswordAuthorization("");
   result = utility->ExtendPCR(pcr_index, pcr_extend_data, delegate.get());
   if (result != TPM_RC_SUCCESS) {
@@ -667,8 +667,8 @@
 }
 
 bool TrunksClientTest::PolicyOrTest() {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<PolicySession> trial_session = factory_->GetTrialSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<PolicySession> trial_session = factory_->GetTrialSession();
   TPM_RC result;
   // Specify a policy that asserts either TPM_CC_RSA_Encrypt or
   // TPM_CC_RSA_Decrypt. A key created under this policy can only be used
@@ -722,7 +722,7 @@
   // Now that we have the digest, we can close the trial session and use hmac.
   trial_session.reset();
 
-  scoped_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
+  std::unique_ptr<HmacSession> hmac_session = factory_->GetHmacSession();
   result = hmac_session->StartUnboundSession(true);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session: " << GetErrorString(result);
@@ -751,7 +751,7 @@
   // Now we can reset the hmac_session.
   hmac_session.reset();
 
-  scoped_ptr<PolicySession> policy_session = factory_->GetPolicySession();
+  std::unique_ptr<PolicySession> policy_session = factory_->GetPolicySession();
   result = policy_session->StartUnboundSession(false);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting policy session: " << GetErrorString(result);
@@ -813,8 +813,8 @@
 }
 
 bool TrunksClientTest::NvramTest(const std::string& owner_password) {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
-  scoped_ptr<HmacSession> session = factory_->GetHmacSession();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<HmacSession> session = factory_->GetHmacSession();
   TPM_RC result = session->StartUnboundSession(true /* enable encryption */);
   if (result != TPM_RC_SUCCESS) {
     LOG(ERROR) << "Error starting hmac session: " << GetErrorString(result);
@@ -894,7 +894,7 @@
   }
   CHECK_EQ(key_handles.size(), kNumKeys);
   CHECK_EQ(public_key_map.size(), kNumKeys);
-  scoped_ptr<AuthorizationDelegate> delegate =
+  std::unique_ptr<AuthorizationDelegate> delegate =
       factory_->GetPasswordAuthorization("");
   for (size_t i = 0; i < kNumKeys; ++i) {
     const ScopedKeyHandle& key_handle = *key_handles[i];
@@ -916,7 +916,7 @@
 
 bool TrunksClientTest::ManySessionsTest() {
   const size_t kNumSessions = 20;
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
   std::vector<std::unique_ptr<HmacSession>> sessions;
   for (size_t i = 0; i < kNumSessions; ++i) {
     std::unique_ptr<HmacSession> session(factory_->GetHmacSession().release());
@@ -952,7 +952,7 @@
     TPM_HANDLE key_handle,
     const std::string& key_authorization,
     HmacSession* session) {
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
   std::string ciphertext;
   session->SetEntityAuthorizationValue("");
   TPM_RC result = utility->AsymmetricEncrypt(
@@ -1028,7 +1028,7 @@
   std::string prime_factor;
   GenerateRSAKeyPair(&modulus, &prime_factor, public_key);
   std::string key_blob;
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
   TPM_RC result = utility->ImportRSAKey(
       TpmUtility::AsymmetricKeyUsage::kSignKey, modulus, 0x10001, prime_factor,
       "",  // password
@@ -1053,7 +1053,7 @@
                                      AuthorizationDelegate* delegate) {
   std::string signature;
   std::string data_to_sign("sign_this");
-  scoped_ptr<TpmUtility> utility = factory_->GetTpmUtility();
+  std::unique_ptr<TpmUtility> utility = factory_->GetTpmUtility();
   TPM_RC result =
       utility->Sign(key_handle.get(), TPM_ALG_RSASSA, TPM_ALG_SHA256,
                     data_to_sign, delegate, &signature);
diff --git a/trunks/trunks_client_test.h b/trunks/trunks_client_test.h
index 92f8683..b7aba79 100644
--- a/trunks/trunks_client_test.h
+++ b/trunks/trunks_client_test.h
@@ -17,10 +17,9 @@
 #ifndef TRUNKS_TRUNKS_CLIENT_TEST_H_
 #define TRUNKS_TRUNKS_CLIENT_TEST_H_
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
-
 #include "trunks/scoped_key_handle.h"
 #include "trunks/tpm_generated.h"
 #include "trunks/trunks_factory.h"
@@ -38,7 +37,7 @@
  public:
   TrunksClientTest();
   // Takes ownership of factory.
-  explicit TrunksClientTest(scoped_ptr<TrunksFactory> factory);
+  explicit TrunksClientTest(std::unique_ptr<TrunksFactory> factory);
   virtual ~TrunksClientTest();
 
   // This test verifies that the Random Number Generator on the TPM is working
@@ -137,7 +136,7 @@
                      AuthorizationDelegate* delegate);
 
   // Factory for instantiation of Tpm classes
-  scoped_ptr<TrunksFactory> factory_;
+  std::unique_ptr<TrunksFactory> factory_;
 
   DISALLOW_COPY_AND_ASSIGN(TrunksClientTest);
 };
diff --git a/trunks/trunks_factory.h b/trunks/trunks_factory.h
index 92046cf..cf6f76b 100644
--- a/trunks/trunks_factory.h
+++ b/trunks/trunks_factory.h
@@ -17,10 +17,10 @@
 #ifndef TRUNKS_TRUNKS_FACTORY_H_
 #define TRUNKS_TRUNKS_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
 
 #include "trunks/trunks_export.h"
 
@@ -48,30 +48,30 @@
   virtual Tpm* GetTpm() const = 0;
 
   // Returns an uninitialized TpmState instance. The caller takes ownership.
-  virtual scoped_ptr<TpmState> GetTpmState() const = 0;
+  virtual std::unique_ptr<TpmState> GetTpmState() const = 0;
 
   // Returns a TpmUtility instance. The caller takes ownership.
-  virtual scoped_ptr<TpmUtility> GetTpmUtility() const = 0;
+  virtual std::unique_ptr<TpmUtility> GetTpmUtility() const = 0;
 
   // Returns an AuthorizationDelegate instance for basic password authorization.
   // The caller takes ownership.
-  virtual scoped_ptr<AuthorizationDelegate> GetPasswordAuthorization(
+  virtual std::unique_ptr<AuthorizationDelegate> GetPasswordAuthorization(
       const std::string& password) const = 0;
 
   // Returns a SessionManager instance. The caller takes ownership.
-  virtual scoped_ptr<SessionManager> GetSessionManager() const = 0;
+  virtual std::unique_ptr<SessionManager> GetSessionManager() const = 0;
 
   // Returns a HmacSession instance. The caller takes ownership.
-  virtual scoped_ptr<HmacSession> GetHmacSession() const = 0;
+  virtual std::unique_ptr<HmacSession> GetHmacSession() const = 0;
 
   // Returns a PolicySession instance. The caller takes ownership.
-  virtual scoped_ptr<PolicySession> GetPolicySession() const = 0;
+  virtual std::unique_ptr<PolicySession> GetPolicySession() const = 0;
 
   // Returns a TrialSession instance. The caller takes ownership.
-  virtual scoped_ptr<PolicySession> GetTrialSession() const = 0;
+  virtual std::unique_ptr<PolicySession> GetTrialSession() const = 0;
 
   // Returns a BlobParser instance. The caller takes ownership.
-  virtual scoped_ptr<BlobParser> GetBlobParser() const = 0;
+  virtual std::unique_ptr<BlobParser> GetBlobParser() const = 0;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(TrunksFactory);
diff --git a/trunks/trunks_factory_for_test.cc b/trunks/trunks_factory_for_test.cc
index 2efcb98..0556cba 100644
--- a/trunks/trunks_factory_for_test.cc
+++ b/trunks/trunks_factory_for_test.cc
@@ -16,6 +16,9 @@
 
 #include "trunks/trunks_factory_for_test.h"
 
+#include <memory>
+
+#include <base/memory/ptr_util.h>
 #include <gmock/gmock.h>
 
 #include "trunks/authorization_delegate.h"
@@ -508,40 +511,39 @@
   return tpm_;
 }
 
-scoped_ptr<TpmState> TrunksFactoryForTest::GetTpmState() const {
-  return scoped_ptr<TpmState>(new TpmStateForwarder(tpm_state_));
+std::unique_ptr<TpmState> TrunksFactoryForTest::GetTpmState() const {
+  return base::MakeUnique<TpmStateForwarder>(tpm_state_);
 }
 
-scoped_ptr<TpmUtility> TrunksFactoryForTest::GetTpmUtility() const {
-  return scoped_ptr<TpmUtility>(new TpmUtilityForwarder(tpm_utility_));
+std::unique_ptr<TpmUtility> TrunksFactoryForTest::GetTpmUtility() const {
+  return base::MakeUnique<TpmUtilityForwarder>(tpm_utility_);
 }
 
-scoped_ptr<AuthorizationDelegate>
+std::unique_ptr<AuthorizationDelegate>
 TrunksFactoryForTest::GetPasswordAuthorization(
     const std::string& password) const {
-  return scoped_ptr<AuthorizationDelegate>(
-      new AuthorizationDelegateForwarder(password_authorization_delegate_));
+  return base::MakeUnique<AuthorizationDelegateForwarder>(
+      password_authorization_delegate_);
 }
 
-scoped_ptr<SessionManager> TrunksFactoryForTest::GetSessionManager() const {
-  return scoped_ptr<SessionManager>(
-      new SessionManagerForwarder(session_manager_));
+std::unique_ptr<SessionManager> TrunksFactoryForTest::GetSessionManager() const {
+  return base::MakeUnique<SessionManagerForwarder>(session_manager_);
 }
 
-scoped_ptr<HmacSession> TrunksFactoryForTest::GetHmacSession() const {
-  return scoped_ptr<HmacSession>(new HmacSessionForwarder(hmac_session_));
+std::unique_ptr<HmacSession> TrunksFactoryForTest::GetHmacSession() const {
+  return base::MakeUnique<HmacSessionForwarder>(hmac_session_);
 }
 
-scoped_ptr<PolicySession> TrunksFactoryForTest::GetPolicySession() const {
-  return scoped_ptr<PolicySession>(new PolicySessionForwarder(policy_session_));
+std::unique_ptr<PolicySession> TrunksFactoryForTest::GetPolicySession() const {
+  return base::MakeUnique<PolicySessionForwarder>(policy_session_);
 }
 
-scoped_ptr<PolicySession> TrunksFactoryForTest::GetTrialSession() const {
-  return scoped_ptr<PolicySession>(new PolicySessionForwarder(policy_session_));
+std::unique_ptr<PolicySession> TrunksFactoryForTest::GetTrialSession() const {
+  return base::MakeUnique<PolicySessionForwarder>(policy_session_);
 }
 
-scoped_ptr<BlobParser> TrunksFactoryForTest::GetBlobParser() const {
-  return scoped_ptr<BlobParser>(new BlobParserForwarder(blob_parser_));
+std::unique_ptr<BlobParser> TrunksFactoryForTest::GetBlobParser() const {
+  return base::MakeUnique<BlobParserForwarder>(blob_parser_);
 }
 
 }  // namespace trunks
diff --git a/trunks/trunks_factory_for_test.h b/trunks/trunks_factory_for_test.h
index 447e212..01f96ba 100644
--- a/trunks/trunks_factory_for_test.h
+++ b/trunks/trunks_factory_for_test.h
@@ -19,10 +19,10 @@
 
 #include "trunks/trunks_factory.h"
 
+#include <memory>
 #include <string>
 
 #include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
 
 #include "trunks/password_authorization_delegate.h"
 #include "trunks/trunks_export.h"
@@ -62,15 +62,15 @@
 
   // TrunksFactory methods.
   Tpm* GetTpm() const override;
-  scoped_ptr<TpmState> GetTpmState() const override;
-  scoped_ptr<TpmUtility> GetTpmUtility() const override;
-  scoped_ptr<AuthorizationDelegate> GetPasswordAuthorization(
+  std::unique_ptr<TpmState> GetTpmState() const override;
+  std::unique_ptr<TpmUtility> GetTpmUtility() const override;
+  std::unique_ptr<AuthorizationDelegate> GetPasswordAuthorization(
       const std::string& password) const override;
-  scoped_ptr<SessionManager> GetSessionManager() const override;
-  scoped_ptr<HmacSession> GetHmacSession() const override;
-  scoped_ptr<PolicySession> GetPolicySession() const override;
-  scoped_ptr<PolicySession> GetTrialSession() const override;
-  scoped_ptr<BlobParser> GetBlobParser() const override;
+  std::unique_ptr<SessionManager> GetSessionManager() const override;
+  std::unique_ptr<HmacSession> GetHmacSession() const override;
+  std::unique_ptr<PolicySession> GetPolicySession() const override;
+  std::unique_ptr<PolicySession> GetTrialSession() const override;
+  std::unique_ptr<BlobParser> GetBlobParser() const override;
 
   // Mutators to inject custom mocks.
   void set_tpm(Tpm* tpm) { tpm_ = tpm; }
@@ -98,21 +98,21 @@
   void set_blob_parser(BlobParser* blob_parser) { blob_parser_ = blob_parser; }
 
  private:
-  scoped_ptr<MockTpm> default_tpm_;
+  std::unique_ptr<MockTpm> default_tpm_;
   Tpm* tpm_;
-  scoped_ptr<MockTpmState> default_tpm_state_;
+  std::unique_ptr<MockTpmState> default_tpm_state_;
   TpmState* tpm_state_;
-  scoped_ptr<MockTpmUtility> default_tpm_utility_;
+  std::unique_ptr<MockTpmUtility> default_tpm_utility_;
   TpmUtility* tpm_utility_;
-  scoped_ptr<PasswordAuthorizationDelegate> default_authorization_delegate_;
+  std::unique_ptr<PasswordAuthorizationDelegate> default_authorization_delegate_;
   AuthorizationDelegate* password_authorization_delegate_;
-  scoped_ptr<MockSessionManager> default_session_manager_;
+  std::unique_ptr<MockSessionManager> default_session_manager_;
   SessionManager* session_manager_;
-  scoped_ptr<MockHmacSession> default_hmac_session_;
+  std::unique_ptr<MockHmacSession> default_hmac_session_;
   HmacSession* hmac_session_;
-  scoped_ptr<MockPolicySession> default_policy_session_;
+  std::unique_ptr<MockPolicySession> default_policy_session_;
   PolicySession* policy_session_;
-  scoped_ptr<MockBlobParser> default_blob_parser_;
+  std::unique_ptr<MockBlobParser> default_blob_parser_;
   BlobParser* blob_parser_;
 
   DISALLOW_COPY_AND_ASSIGN(TrunksFactoryForTest);
diff --git a/trunks/trunks_factory_impl.cc b/trunks/trunks_factory_impl.cc
index 8b832c4..f0b39cb 100644
--- a/trunks/trunks_factory_impl.cc
+++ b/trunks/trunks_factory_impl.cc
@@ -17,6 +17,7 @@
 #include "trunks/trunks_factory_impl.h"
 
 #include <base/logging.h>
+#include <base/memory/ptr_util.h>
 
 #include "trunks/blob_parser.h"
 #include "trunks/hmac_session_impl.h"
@@ -62,38 +63,37 @@
   return tpm_.get();
 }
 
-scoped_ptr<TpmState> TrunksFactoryImpl::GetTpmState() const {
-  return scoped_ptr<TpmState>(new TpmStateImpl(*this));
+std::unique_ptr<TpmState> TrunksFactoryImpl::GetTpmState() const {
+  return base::MakeUnique<TpmStateImpl>(*this);
 }
 
-scoped_ptr<TpmUtility> TrunksFactoryImpl::GetTpmUtility() const {
-  return scoped_ptr<TpmUtility>(new TpmUtilityImpl(*this));
+std::unique_ptr<TpmUtility> TrunksFactoryImpl::GetTpmUtility() const {
+  return base::MakeUnique<TpmUtilityImpl>(*this);
 }
 
-scoped_ptr<AuthorizationDelegate> TrunksFactoryImpl::GetPasswordAuthorization(
-    const std::string& password) const {
-  return scoped_ptr<AuthorizationDelegate>(
-      new PasswordAuthorizationDelegate(password));
+std::unique_ptr<AuthorizationDelegate>
+TrunksFactoryImpl::GetPasswordAuthorization(const std::string& password) const {
+  return base::MakeUnique<PasswordAuthorizationDelegate>(password);
 }
 
-scoped_ptr<SessionManager> TrunksFactoryImpl::GetSessionManager() const {
-  return scoped_ptr<SessionManager>(new SessionManagerImpl(*this));
+std::unique_ptr<SessionManager> TrunksFactoryImpl::GetSessionManager() const {
+  return base::MakeUnique<SessionManagerImpl>(*this);
 }
 
-scoped_ptr<HmacSession> TrunksFactoryImpl::GetHmacSession() const {
-  return scoped_ptr<HmacSession>(new HmacSessionImpl(*this));
+std::unique_ptr<HmacSession> TrunksFactoryImpl::GetHmacSession() const {
+  return base::MakeUnique<HmacSessionImpl>(*this);
 }
 
-scoped_ptr<PolicySession> TrunksFactoryImpl::GetPolicySession() const {
-  return scoped_ptr<PolicySession>(new PolicySessionImpl(*this, TPM_SE_POLICY));
+std::unique_ptr<PolicySession> TrunksFactoryImpl::GetPolicySession() const {
+  return base::MakeUnique<PolicySessionImpl>(*this, TPM_SE_POLICY);
 }
 
-scoped_ptr<PolicySession> TrunksFactoryImpl::GetTrialSession() const {
-  return scoped_ptr<PolicySession>(new PolicySessionImpl(*this, TPM_SE_TRIAL));
+std::unique_ptr<PolicySession> TrunksFactoryImpl::GetTrialSession() const {
+  return base::MakeUnique<PolicySessionImpl>(*this, TPM_SE_TRIAL);
 }
 
-scoped_ptr<BlobParser> TrunksFactoryImpl::GetBlobParser() const {
-  return scoped_ptr<BlobParser>(new BlobParser());
+std::unique_ptr<BlobParser> TrunksFactoryImpl::GetBlobParser() const {
+  return base::MakeUnique<BlobParser>();
 }
 
 }  // namespace trunks
diff --git a/trunks/trunks_factory_impl.h b/trunks/trunks_factory_impl.h
index 03d25bf..b4c91d2 100644
--- a/trunks/trunks_factory_impl.h
+++ b/trunks/trunks_factory_impl.h
@@ -19,10 +19,10 @@
 
 #include "trunks/trunks_factory.h"
 
+#include <memory>
 #include <string>
 
 #include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
 
 #include "trunks/command_transceiver.h"
 #include "trunks/trunks_export.h"
@@ -45,20 +45,20 @@
 
   // TrunksFactory methods.
   Tpm* GetTpm() const override;
-  scoped_ptr<TpmState> GetTpmState() const override;
-  scoped_ptr<TpmUtility> GetTpmUtility() const override;
-  scoped_ptr<AuthorizationDelegate> GetPasswordAuthorization(
+  std::unique_ptr<TpmState> GetTpmState() const override;
+  std::unique_ptr<TpmUtility> GetTpmUtility() const override;
+  std::unique_ptr<AuthorizationDelegate> GetPasswordAuthorization(
       const std::string& password) const override;
-  scoped_ptr<SessionManager> GetSessionManager() const override;
-  scoped_ptr<HmacSession> GetHmacSession() const override;
-  scoped_ptr<PolicySession> GetPolicySession() const override;
-  scoped_ptr<PolicySession> GetTrialSession() const override;
-  scoped_ptr<BlobParser> GetBlobParser() const override;
+  std::unique_ptr<SessionManager> GetSessionManager() const override;
+  std::unique_ptr<HmacSession> GetHmacSession() const override;
+  std::unique_ptr<PolicySession> GetPolicySession() const override;
+  std::unique_ptr<PolicySession> GetTrialSession() const override;
+  std::unique_ptr<BlobParser> GetBlobParser() const override;
 
  private:
-  scoped_ptr<CommandTransceiver> default_transceiver_;
+  std::unique_ptr<CommandTransceiver> default_transceiver_;
   CommandTransceiver* transceiver_;
-  scoped_ptr<Tpm> tpm_;
+  std::unique_ptr<Tpm> tpm_;
 
   DISALLOW_COPY_AND_ASSIGN(TrunksFactoryImpl);
 };