tpm: Update libchrome APIS to r456626.

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

Notable changes from libchrome:
- FOR_EACH_OBSERVER macro removed (replaced
  by use of C++ 11 range-base for loop)
  - base::Values no more FundamentalValue
  - stl_util moved to base namespace
  - some scoped pointers removed in crypto/ in favor
    of BoringSSL UniquePtr.

Test: Build.
Change-Id: If7dba13b7b80da586d623b156cd236485c7e6404
Merged-In: I429e98e8ac2ba03113aa6df8cd521c7fe47cff65
diff --git a/tpm_manager/client/main.cc b/tpm_manager/client/main.cc
index 1d30a41..67a6456 100644
--- a/tpm_manager/client/main.cc
+++ b/tpm_manager/client/main.cc
@@ -293,7 +293,7 @@
       // Command line arguments did not match any valid commands.
       return EX_USAGE;
     }
-    base::MessageLoop::current()->PostTask(FROM_HERE, task);
+    base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE, task);
     return EX_OK;
   }
 
diff --git a/tpm_manager/server/openssl_crypto_util_impl.cc b/tpm_manager/server/openssl_crypto_util_impl.cc
index c5417cb..640bdae 100644
--- a/tpm_manager/server/openssl_crypto_util_impl.cc
+++ b/tpm_manager/server/openssl_crypto_util_impl.cc
@@ -26,7 +26,7 @@
                                            std::string* random_data) {
   random_data->resize(num_bytes);
   unsigned char* random_buffer =
-      reinterpret_cast<unsigned char*>(string_as_array(random_data));
+      reinterpret_cast<unsigned char*>(base::string_as_array(random_data));
   if (RAND_bytes(random_buffer, num_bytes) != 1) {
     LOG(ERROR) << "Error getting random bytes using Openssl.";
     random_data->clear();
diff --git a/trunks/background_command_transceiver_test.cc b/trunks/background_command_transceiver_test.cc
index 8b7174a..f577dc3 100644
--- a/trunks/background_command_transceiver_test.cc
+++ b/trunks/background_command_transceiver_test.cc
@@ -95,7 +95,7 @@
       &next_transceiver_, test_thread_.task_runner());
   std::string output = "not_assigned";
   // Post a synchronous call to be run when we start pumping the loop.
-  message_loop_.PostTask(FROM_HERE,
+  message_loop_.task_runner()->PostTask(FROM_HERE,
                          base::Bind(SendCommandAndWaitAndAssign,
                                     &background_transceiver, &output));
   base::RunLoop run_loop;
diff --git a/trunks/generator/generator.py b/trunks/generator/generator.py
index 6e50b9e..990956a 100755
--- a/trunks/generator/generator.py
+++ b/trunks/generator/generator.py
@@ -1267,7 +1267,7 @@
   command_size += %(var_name)s_bytes.size();"""
   _AUTHORIZE_COMMAND = """
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -1353,7 +1353,7 @@
   }"""
   _AUTHORIZE_RESPONSE = """
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
diff --git a/trunks/hmac_authorization_delegate.cc b/trunks/hmac_authorization_delegate.cc
index 59c005e..160f589 100644
--- a/trunks/hmac_authorization_delegate.cc
+++ b/trunks/hmac_authorization_delegate.cc
@@ -299,7 +299,7 @@
   AES_cfb128_encrypt(reinterpret_cast<const unsigned char*>(parameter->data()),
                      decrypted, parameter->size(), &key, aes_iv, &iv_offset,
                      operation_type);
-  memcpy(string_as_array(parameter), decrypted, parameter->size());
+  memcpy(base::string_as_array(parameter), decrypted, parameter->size());
 }
 
 void HmacAuthorizationDelegate::RegenerateCallerNonce() {
diff --git a/trunks/session_manager_impl.cc b/trunks/session_manager_impl.cc
index 998fd38..e6aa020 100644
--- a/trunks/session_manager_impl.cc
+++ b/trunks/session_manager_impl.cc
@@ -21,7 +21,8 @@
 #include <base/logging.h>
 #include <base/stl_util.h>
 #include <crypto/openssl_util.h>
-#include <crypto/scoped_openssl_types.h>
+#include <openssl/bio.h>
+#include <openssl/bn.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #if defined(OPENSSL_IS_BORINGSSL)
@@ -82,7 +83,7 @@
 
   std::string salt(SHA256_DIGEST_SIZE, 0);
   unsigned char* salt_buffer =
-      reinterpret_cast<unsigned char*>(string_as_array(&salt));
+      reinterpret_cast<unsigned char*>(base::string_as_array(&salt));
   CHECK_EQ(RAND_bytes(salt_buffer, salt.size()), 1)
       << "Error generating a cryptographically random salt.";
   // First we encrypt the cryptographically secure salt using PKCS1_OAEP
@@ -160,7 +161,7 @@
     LOG(ERROR) << "Invalid salting key attributes.";
     return TRUNKS_RC_SESSION_SETUP_ERROR;
   }
-  crypto::ScopedRSA salting_key_rsa(RSA_new());
+  bssl::UniquePtr<RSA> salting_key_rsa(RSA_new());
   salting_key_rsa->e = BN_new();
   if (!salting_key_rsa->e) {
     LOG(ERROR) << "Error creating exponent for RSA: " << GetOpenSSLError();
@@ -174,7 +175,7 @@
     LOG(ERROR) << "Error setting public area of rsa key: " << GetOpenSSLError();
     return TRUNKS_RC_SESSION_SETUP_ERROR;
   }
-  crypto::ScopedEVP_PKEY salting_key(EVP_PKEY_new());
+  bssl::UniquePtr<EVP_PKEY> salting_key(EVP_PKEY_new());
   if (!EVP_PKEY_set1_RSA(salting_key.get(), salting_key_rsa.get())) {
     LOG(ERROR) << "Error setting up EVP_PKEY: " << GetOpenSSLError();
     return TRUNKS_RC_SESSION_SETUP_ERROR;
@@ -186,7 +187,7 @@
   // EVP_PKEY_CTX_set0_rsa_oaep_label takes ownership so we need to malloc.
   uint8_t* oaep_label = static_cast<uint8_t*>(OPENSSL_malloc(kOaepLabelSize));
   memcpy(oaep_label, kOaepLabelValue, kOaepLabelSize);
-  crypto::ScopedEVP_PKEY_CTX salt_encrypt_context(
+  bssl::UniquePtr<EVP_PKEY_CTX> salt_encrypt_context(
       EVP_PKEY_CTX_new(salting_key.get(), nullptr));
   if (!EVP_PKEY_encrypt_init(salt_encrypt_context.get()) ||
       !EVP_PKEY_CTX_set_rsa_padding(salt_encrypt_context.get(),
@@ -203,7 +204,7 @@
   encrypted_salt->resize(out_length);
   if (!EVP_PKEY_encrypt(
           salt_encrypt_context.get(),
-          reinterpret_cast<uint8_t*>(string_as_array(encrypted_salt)),
+          reinterpret_cast<uint8_t*>(base::string_as_array(encrypted_salt)),
           &out_length, reinterpret_cast<const uint8_t*>(salt.data()),
           salt.size())) {
     LOG(ERROR) << "Error encrypting salt: " << GetOpenSSLError();
diff --git a/trunks/tpm_generated.cc b/trunks/tpm_generated.cc
index 1fd8da5..2b4679b 100644
--- a/trunks/tpm_generated.cc
+++ b/trunks/tpm_generated.cc
@@ -8124,7 +8124,7 @@
   parameter_section_bytes += startup_type_bytes;
   command_size += startup_type_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -8222,7 +8222,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -8315,7 +8315,7 @@
   parameter_section_bytes += shutdown_type_bytes;
   command_size += shutdown_type_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -8413,7 +8413,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -8506,7 +8506,7 @@
   parameter_section_bytes += full_test_bytes;
   command_size += full_test_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -8604,7 +8604,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -8697,7 +8697,7 @@
   parameter_section_bytes += to_test_bytes;
   command_size += to_test_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -8796,7 +8796,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -8892,7 +8892,7 @@
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -8992,7 +8992,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -9174,7 +9174,7 @@
   parameter_section_bytes += auth_hash_bytes;
   command_size += auth_hash_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -9280,7 +9280,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -9419,7 +9419,7 @@
   handle_section_bytes += session_handle_bytes;
   command_size += session_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -9517,7 +9517,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -9658,7 +9658,7 @@
   parameter_section_bytes += creation_pcr_bytes;
   command_size += creation_pcr_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -9761,7 +9761,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -9947,7 +9947,7 @@
   parameter_section_bytes += in_public_bytes;
   command_size += in_public_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -10051,7 +10051,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -10202,7 +10202,7 @@
   parameter_section_bytes += hierarchy_bytes;
   command_size += hierarchy_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -10307,7 +10307,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -10429,7 +10429,7 @@
   handle_section_bytes += object_handle_bytes;
   command_size += object_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -10530,7 +10530,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -10698,7 +10698,7 @@
   parameter_section_bytes += secret_bytes;
   command_size += secret_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -10797,7 +10797,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -10954,7 +10954,7 @@
   parameter_section_bytes += object_name_bytes;
   command_size += object_name_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -11054,7 +11054,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -11186,7 +11186,7 @@
   handle_section_bytes += item_handle_bytes;
   command_size += item_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -11285,7 +11285,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -11429,7 +11429,7 @@
   parameter_section_bytes += new_auth_bytes;
   command_size += new_auth_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -11528,7 +11528,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -11693,7 +11693,7 @@
   parameter_section_bytes += symmetric_alg_bytes;
   command_size += symmetric_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -11794,7 +11794,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -11986,7 +11986,7 @@
   parameter_section_bytes += in_sym_seed_bytes;
   command_size += in_sym_seed_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -12086,7 +12086,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -12276,7 +12276,7 @@
   parameter_section_bytes += symmetric_alg_bytes;
   command_size += symmetric_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -12375,7 +12375,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -12539,7 +12539,7 @@
   parameter_section_bytes += label_bytes;
   command_size += label_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -12638,7 +12638,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -12798,7 +12798,7 @@
   parameter_section_bytes += label_bytes;
   command_size += label_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -12897,7 +12897,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -13022,7 +13022,7 @@
   handle_section_bytes += key_handle_bytes;
   command_size += key_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -13122,7 +13122,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -13264,7 +13264,7 @@
   parameter_section_bytes += in_point_bytes;
   command_size += in_point_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -13363,7 +13363,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -13481,7 +13481,7 @@
   parameter_section_bytes += curve_id_bytes;
   command_size += curve_id_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -13580,7 +13580,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -13727,7 +13727,7 @@
   parameter_section_bytes += counter_bytes;
   command_size += counter_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -13827,7 +13827,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -13998,7 +13998,7 @@
   parameter_section_bytes += in_data_bytes;
   command_size += in_data_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -14098,7 +14098,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -14258,7 +14258,7 @@
   parameter_section_bytes += hierarchy_bytes;
   command_size += hierarchy_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -14357,7 +14357,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -14510,7 +14510,7 @@
   parameter_section_bytes += hash_alg_bytes;
   command_size += hash_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -14608,7 +14608,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -14728,7 +14728,7 @@
   parameter_section_bytes += bytes_requested_bytes;
   command_size += bytes_requested_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -14827,7 +14827,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -14949,7 +14949,7 @@
   parameter_section_bytes += in_data_bytes;
   command_size += in_data_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -15047,7 +15047,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -15167,7 +15167,7 @@
   parameter_section_bytes += hash_alg_bytes;
   command_size += hash_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -15271,7 +15271,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -15391,7 +15391,7 @@
   parameter_section_bytes += hash_alg_bytes;
   command_size += hash_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -15495,7 +15495,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -15615,7 +15615,7 @@
   parameter_section_bytes += buffer_bytes;
   command_size += buffer_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -15713,7 +15713,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -15840,7 +15840,7 @@
   parameter_section_bytes += hierarchy_bytes;
   command_size += hierarchy_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -15940,7 +15940,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -16101,7 +16101,7 @@
   parameter_section_bytes += buffer_bytes;
   command_size += buffer_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -16200,7 +16200,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -16352,7 +16352,7 @@
   parameter_section_bytes += in_scheme_bytes;
   command_size += in_scheme_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -16452,7 +16452,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -16641,7 +16641,7 @@
   parameter_section_bytes += creation_ticket_bytes;
   command_size += creation_ticket_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -16741,7 +16741,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -16918,7 +16918,7 @@
   parameter_section_bytes += pcrselect_bytes;
   command_size += pcrselect_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -17017,7 +17017,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -17197,7 +17197,7 @@
   parameter_section_bytes += in_scheme_bytes;
   command_size += in_scheme_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -17297,7 +17297,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -17477,7 +17477,7 @@
   parameter_section_bytes += in_scheme_bytes;
   command_size += in_scheme_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -17577,7 +17577,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -17753,7 +17753,7 @@
   parameter_section_bytes += in_scheme_bytes;
   command_size += in_scheme_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -17853,7 +17853,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -18026,7 +18026,7 @@
   parameter_section_bytes += y2_bytes;
   command_size += y2_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -18129,7 +18129,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -18281,7 +18281,7 @@
   parameter_section_bytes += curve_id_bytes;
   command_size += curve_id_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -18382,7 +18382,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -18527,7 +18527,7 @@
   parameter_section_bytes += signature_bytes;
   command_size += signature_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -18626,7 +18626,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -18773,7 +18773,7 @@
   parameter_section_bytes += validation_bytes;
   command_size += validation_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -18871,7 +18871,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -19010,7 +19010,7 @@
   parameter_section_bytes += clear_list_bytes;
   command_size += clear_list_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -19108,7 +19108,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -19228,7 +19228,7 @@
   parameter_section_bytes += digests_bytes;
   command_size += digests_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -19326,7 +19326,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -19441,7 +19441,7 @@
   parameter_section_bytes += event_data_bytes;
   command_size += event_data_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -19540,7 +19540,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -19647,7 +19647,7 @@
   parameter_section_bytes += pcr_selection_in_bytes;
   command_size += pcr_selection_in_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -19748,7 +19748,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -19876,7 +19876,7 @@
   parameter_section_bytes += pcr_allocation_bytes;
   command_size += pcr_allocation_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -19978,7 +19978,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -20147,7 +20147,7 @@
   parameter_section_bytes += policy_digest_bytes;
   command_size += policy_digest_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -20245,7 +20245,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -20372,7 +20372,7 @@
   parameter_section_bytes += auth_bytes;
   command_size += auth_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -20470,7 +20470,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -20572,7 +20572,7 @@
   handle_section_bytes += pcr_handle_bytes;
   command_size += pcr_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -20670,7 +20670,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -20829,7 +20829,7 @@
   parameter_section_bytes += auth_bytes;
   command_size += auth_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -20929,7 +20929,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -21126,7 +21126,7 @@
   parameter_section_bytes += expiration_bytes;
   command_size += expiration_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -21226,7 +21226,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -21420,7 +21420,7 @@
   parameter_section_bytes += ticket_bytes;
   command_size += ticket_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -21518,7 +21518,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -21635,7 +21635,7 @@
   parameter_section_bytes += p_hash_list_bytes;
   command_size += p_hash_list_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -21733,7 +21733,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -21859,7 +21859,7 @@
   parameter_section_bytes += pcrs_bytes;
   command_size += pcrs_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -21957,7 +21957,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -22068,7 +22068,7 @@
   parameter_section_bytes += locality_bytes;
   command_size += locality_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -22166,7 +22166,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -22322,7 +22322,7 @@
   parameter_section_bytes += operation_bytes;
   command_size += operation_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -22420,7 +22420,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -22569,7 +22569,7 @@
   parameter_section_bytes += operation_bytes;
   command_size += operation_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -22667,7 +22667,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -22784,7 +22784,7 @@
   parameter_section_bytes += code_bytes;
   command_size += code_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -22882,7 +22882,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -22986,7 +22986,7 @@
   handle_section_bytes += policy_session_bytes;
   command_size += policy_session_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -23084,7 +23084,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -23202,7 +23202,7 @@
   parameter_section_bytes += cp_hash_a_bytes;
   command_size += cp_hash_a_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -23300,7 +23300,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -23417,7 +23417,7 @@
   parameter_section_bytes += name_hash_bytes;
   command_size += name_hash_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -23515,7 +23515,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -23651,7 +23651,7 @@
   parameter_section_bytes += include_object_bytes;
   command_size += include_object_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -23749,7 +23749,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -23902,7 +23902,7 @@
   parameter_section_bytes += check_ticket_bytes;
   command_size += check_ticket_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -24000,7 +24000,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -24108,7 +24108,7 @@
   handle_section_bytes += policy_session_bytes;
   command_size += policy_session_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -24206,7 +24206,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -24304,7 +24304,7 @@
   handle_section_bytes += policy_session_bytes;
   command_size += policy_session_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -24402,7 +24402,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -24499,7 +24499,7 @@
   handle_section_bytes += policy_session_bytes;
   command_size += policy_session_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -24598,7 +24598,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -24726,7 +24726,7 @@
   parameter_section_bytes += written_set_bytes;
   command_size += written_set_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -24824,7 +24824,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -24970,7 +24970,7 @@
   parameter_section_bytes += creation_pcr_bytes;
   command_size += creation_pcr_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -25079,7 +25079,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -25260,7 +25260,7 @@
   parameter_section_bytes += state_bytes;
   command_size += state_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -25358,7 +25358,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -25490,7 +25490,7 @@
   parameter_section_bytes += hash_alg_bytes;
   command_size += hash_alg_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -25588,7 +25588,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -25694,7 +25694,7 @@
   handle_section_bytes += auth_handle_bytes;
   command_size += auth_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -25792,7 +25792,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -25888,7 +25888,7 @@
   handle_section_bytes += auth_handle_bytes;
   command_size += auth_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -25986,7 +25986,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -26082,7 +26082,7 @@
   handle_section_bytes += auth_handle_bytes;
   command_size += auth_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -26179,7 +26179,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -26284,7 +26284,7 @@
   parameter_section_bytes += disable_bytes;
   command_size += disable_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -26382,7 +26382,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -26497,7 +26497,7 @@
   parameter_section_bytes += new_auth_bytes;
   command_size += new_auth_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -26595,7 +26595,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -26699,7 +26699,7 @@
   handle_section_bytes += lock_handle_bytes;
   command_size += lock_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -26797,7 +26797,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -26927,7 +26927,7 @@
   parameter_section_bytes += lockout_recovery_bytes;
   command_size += lockout_recovery_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -27025,7 +27025,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -27154,7 +27154,7 @@
   parameter_section_bytes += clear_list_bytes;
   command_size += clear_list_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -27252,7 +27252,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -27361,7 +27361,7 @@
   parameter_section_bytes += algorithm_set_bytes;
   command_size += algorithm_set_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -27459,7 +27459,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -27598,7 +27598,7 @@
   parameter_section_bytes += manifest_signature_bytes;
   command_size += manifest_signature_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -27696,7 +27696,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -27813,7 +27813,7 @@
   parameter_section_bytes += fu_data_bytes;
   command_size += fu_data_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -27913,7 +27913,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -28025,7 +28025,7 @@
   parameter_section_bytes += sequence_number_bytes;
   command_size += sequence_number_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -28124,7 +28124,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -28239,7 +28239,7 @@
   handle_section_bytes += save_handle_bytes;
   command_size += save_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -28338,7 +28338,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -28441,7 +28441,7 @@
   parameter_section_bytes += context_bytes;
   command_size += context_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -28545,7 +28545,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -28642,7 +28642,7 @@
   parameter_section_bytes += flush_handle_bytes;
   command_size += flush_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -28740,7 +28740,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -28854,7 +28854,7 @@
   parameter_section_bytes += persistent_handle_bytes;
   command_size += persistent_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -28952,7 +28952,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -29046,7 +29046,7 @@
       crypto::SecureHash::Create(crypto::SecureHash::SHA256));
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -29145,7 +29145,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -29252,7 +29252,7 @@
   parameter_section_bytes += new_time_bytes;
   command_size += new_time_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -29350,7 +29350,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -29457,7 +29457,7 @@
   parameter_section_bytes += rate_adjust_bytes;
   command_size += rate_adjust_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -29555,7 +29555,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -29672,7 +29672,7 @@
   parameter_section_bytes += property_count_bytes;
   command_size += property_count_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -29772,7 +29772,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -29886,7 +29886,7 @@
   parameter_section_bytes += parameters_bytes;
   command_size += parameters_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -29984,7 +29984,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -30104,7 +30104,7 @@
   parameter_section_bytes += public_info_bytes;
   command_size += public_info_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -30202,7 +30202,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -30315,7 +30315,7 @@
   handle_section_bytes += nv_index_bytes;
   command_size += nv_index_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -30413,7 +30413,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -30529,7 +30529,7 @@
   handle_section_bytes += platform_bytes;
   command_size += platform_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -30627,7 +30627,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -30734,7 +30734,7 @@
   handle_section_bytes += nv_index_bytes;
   command_size += nv_index_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -30834,7 +30834,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -30995,7 +30995,7 @@
   parameter_section_bytes += offset_bytes;
   command_size += offset_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -31093,7 +31093,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -31209,7 +31209,7 @@
   handle_section_bytes += nv_index_bytes;
   command_size += nv_index_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -31307,7 +31307,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -31436,7 +31436,7 @@
   parameter_section_bytes += data_bytes;
   command_size += data_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -31534,7 +31534,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -31657,7 +31657,7 @@
   parameter_section_bytes += bits_bytes;
   command_size += bits_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -31755,7 +31755,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -31869,7 +31869,7 @@
   handle_section_bytes += nv_index_bytes;
   command_size += nv_index_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -31967,7 +31967,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -32069,7 +32069,7 @@
   handle_section_bytes += auth_handle_bytes;
   command_size += auth_handle_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -32167,7 +32167,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -32295,7 +32295,7 @@
   parameter_section_bytes += offset_bytes;
   command_size += offset_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -32394,7 +32394,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -32531,7 +32531,7 @@
   handle_section_bytes += nv_index_bytes;
   command_size += nv_index_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -32629,7 +32629,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -32748,7 +32748,7 @@
   parameter_section_bytes += new_auth_bytes;
   command_size += new_auth_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -32846,7 +32846,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
@@ -33009,7 +33009,7 @@
   parameter_section_bytes += offset_bytes;
   command_size += offset_bytes.size();
   std::string command_hash(32, 0);
-  hash->Finish(string_as_array(&command_hash), command_hash.size());
+  hash->Finish(base::string_as_array(&command_hash), command_hash.size());
   std::string authorization_section_bytes;
   std::string authorization_size_bytes;
   if (authorization_delegate) {
@@ -33109,7 +33109,7 @@
   hash->Update(command_code_bytes.data(), command_code_bytes.size());
   hash->Update(buffer.data(), buffer.size());
   std::string response_hash(32, 0);
-  hash->Finish(string_as_array(&response_hash), response_hash.size());
+  hash->Finish(base::string_as_array(&response_hash), response_hash.size());
   if (tag == TPM_ST_SESSIONS) {
     CHECK(authorization_delegate) << "Authorization delegate missing!";
     if (!authorization_delegate->CheckResponseAuthorization(
diff --git a/trunks/tpm_generated_test.cc b/trunks/tpm_generated_test.cc
index 21e3791..7b6cdf4 100644
--- a/trunks/tpm_generated_test.cc
+++ b/trunks/tpm_generated_test.cc
@@ -299,7 +299,7 @@
  public:
   explicit PostResponse(const std::string& response) : response_(response) {}
   void operator()(const base::Callback<void(const std::string&)>& callback) {
-    base::MessageLoop::current()->PostTask(FROM_HERE,
+    base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE,
                                            base::Bind(callback, response_));
   }
 
diff --git a/trunks/tpm_utility_impl.cc b/trunks/tpm_utility_impl.cc
index 880f1ea..c5badb0 100644
--- a/trunks/tpm_utility_impl.cc
+++ b/trunks/tpm_utility_impl.cc
@@ -1829,7 +1829,8 @@
   unsigned char iv[MAX_AES_BLOCK_SIZE_BYTES] = {0};
   AES_cfb128_encrypt(
       reinterpret_cast<const unsigned char*>(unencrypted_private_data.data()),
-      reinterpret_cast<unsigned char*>(string_as_array(&private_data_string)),
+      reinterpret_cast<unsigned char*>(
+          base::string_as_array(&private_data_string)),
       unencrypted_private_data.size(), &key, iv, &iv_in, AES_ENCRYPT);
   *encrypted_private_data = Make_TPM2B_PRIVATE(private_data_string);
   if (result != TPM_RC_SUCCESS) {
diff --git a/trunks/tpm_utility_test.cc b/trunks/tpm_utility_test.cc
index 8c9898d..74c0a49 100644
--- a/trunks/tpm_utility_test.cc
+++ b/trunks/tpm_utility_test.cc
@@ -1153,7 +1153,8 @@
   std::string unencrypted_private(private_data.size, 0);
   AES_cfb128_encrypt(
       reinterpret_cast<const unsigned char*>(private_data.buffer),
-      reinterpret_cast<unsigned char*>(string_as_array(&unencrypted_private)),
+      reinterpret_cast<unsigned char*>(
+          base::string_as_array(&unencrypted_private)),
       private_data.size, &key, iv, &iv_in, AES_DECRYPT);
   TPM2B_DIGEST inner_integrity;
   EXPECT_EQ(TPM_RC_SUCCESS, Parse_TPM2B_DIGEST(&unencrypted_private,
diff --git a/trunks/trunks_client_test.cc b/trunks/trunks_client_test.cc
index 371e16c..97bab14 100644
--- a/trunks/trunks_client_test.cc
+++ b/trunks/trunks_client_test.cc
@@ -27,11 +27,13 @@
 #include <base/stl_util.h>
 #include <brillo/bind_lambda.h>
 #include <crypto/openssl_util.h>
-#include <crypto/scoped_openssl_types.h>
 #include <crypto/sha2.h>
+#include <openssl/bio.h>
 #include <openssl/bn.h>
+#include <openssl/crypto.h>
 #include <openssl/err.h>
 #include <openssl/rsa.h>
+#include <openssl/ssl.h>
 
 #include "trunks/authorization_delegate.h"
 #include "trunks/error_codes.h"
@@ -1017,27 +1019,27 @@
                                           std::string* prime_factor,
                                           std::string* public_key) {
 #if defined(OPENSSL_IS_BORINGSSL)
-  crypto::ScopedRSA rsa(RSA_new());
-  crypto::ScopedBIGNUM exponent(BN_new());
+  bssl::UniquePtr<RSA> rsa(RSA_new());
+  bssl::UniquePtr<BIGNUM> exponent(BN_new());
   CHECK(BN_set_word(exponent.get(), RSA_F4));
   CHECK(RSA_generate_key_ex(rsa.get(), 2048, exponent.get(), nullptr))
       << "Failed to generate RSA key: " << GetOpenSSLError();
 #else
-  crypto::ScopedRSA rsa(RSA_generate_key(2048, 0x10001, nullptr, nullptr));
+  bssl::UniquePtr<RSA> rsa(RSA_generate_key(2048, 0x10001, nullptr, nullptr));
   CHECK(rsa.get());
 #endif
   modulus->resize(BN_num_bytes(rsa.get()->n), 0);
   BN_bn2bin(rsa.get()->n,
-            reinterpret_cast<unsigned char*>(string_as_array(modulus)));
+            reinterpret_cast<unsigned char*>(base::string_as_array(modulus)));
   prime_factor->resize(BN_num_bytes(rsa.get()->p), 0);
-  BN_bn2bin(rsa.get()->p,
-            reinterpret_cast<unsigned char*>(string_as_array(prime_factor)));
+  BN_bn2bin(rsa.get()->p, reinterpret_cast<unsigned char*>(
+      base::string_as_array(prime_factor)));
   if (public_key) {
     unsigned char* buffer = NULL;
     int length = i2d_RSAPublicKey(rsa.get(), &buffer);
     CHECK_GT(length, 0);
-    crypto::ScopedOpenSSLBytes scoped_buffer(buffer);
     public_key->assign(reinterpret_cast<char*>(buffer), length);
+    OPENSSL_free(buffer);
   }
 }
 
@@ -1045,14 +1047,14 @@
                                           const std::string& data,
                                           const std::string& signature) {
   auto asn1_ptr = reinterpret_cast<const unsigned char*>(public_key.data());
-  crypto::ScopedRSA rsa(
+  bssl::UniquePtr<RSA> rsa(
       d2i_RSAPublicKey(nullptr, &asn1_ptr, public_key.size()));
   CHECK(rsa.get());
   std::string digest = crypto::SHA256HashString(data);
   auto digest_buffer = reinterpret_cast<const unsigned char*>(digest.data());
   std::string mutable_signature(signature);
-  unsigned char* signature_buffer =
-      reinterpret_cast<unsigned char*>(string_as_array(&mutable_signature));
+  unsigned char* signature_buffer = reinterpret_cast<unsigned char*>(
+      base::string_as_array(&mutable_signature));
   return (RSA_verify(NID_sha256, digest_buffer, digest.size(), signature_buffer,
                      signature.size(), rsa.get()) == 1);
 }