diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2017-07-26 20:29:16 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-07-26 20:29:16 +0000 |
commit | 725dfa3a530f7e5a87c34b5ab74db7027c896995 (patch) | |
tree | e33d50e7cde5c725d9b424829b9423454118f1d4 | |
parent | f0db9e9d99bac00bdcf00d93919ca9e30918ad7a (diff) | |
parent | 06e295b58139a538745835f45ed889a30507d008 (diff) | |
download | tpm-725dfa3a530f7e5a87c34b5ab74db7027c896995.tar.gz |
Revert "tpm: Update libchrome APIS to r456626." am: 56b27e3b6e
am: 06e295b581
Change-Id: Ib3ab4b9dce53fef5599cef9a985907fd7c359ae1
-rw-r--r-- | tpm_manager/client/main.cc | 2 | ||||
-rw-r--r-- | tpm_manager/server/openssl_crypto_util_impl.cc | 2 | ||||
-rw-r--r-- | trunks/background_command_transceiver_test.cc | 2 | ||||
-rwxr-xr-x | trunks/generator/generator.py | 4 | ||||
-rw-r--r-- | trunks/hmac_authorization_delegate.cc | 2 | ||||
-rw-r--r-- | trunks/session_manager_impl.cc | 13 | ||||
-rw-r--r-- | trunks/tpm_generated.cc | 432 | ||||
-rw-r--r-- | trunks/tpm_generated_test.cc | 2 | ||||
-rw-r--r-- | trunks/tpm_utility_impl.cc | 3 | ||||
-rw-r--r-- | trunks/tpm_utility_test.cc | 3 | ||||
-rw-r--r-- | trunks/trunks_client_test.cc | 24 |
11 files changed, 242 insertions, 247 deletions
diff --git a/tpm_manager/client/main.cc b/tpm_manager/client/main.cc index 67a6456..1d30a41 100644 --- a/tpm_manager/client/main.cc +++ b/tpm_manager/client/main.cc @@ -293,7 +293,7 @@ class ClientLoop : public ClientLoopBase { // Command line arguments did not match any valid commands. return EX_USAGE; } - base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE, task); + base::MessageLoop::current()->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 640bdae..c5417cb 100644 --- a/tpm_manager/server/openssl_crypto_util_impl.cc +++ b/tpm_manager/server/openssl_crypto_util_impl.cc @@ -26,7 +26,7 @@ bool OpensslCryptoUtilImpl::GetRandomBytes(size_t num_bytes, std::string* random_data) { random_data->resize(num_bytes); unsigned char* random_buffer = - reinterpret_cast<unsigned char*>(base::string_as_array(random_data)); + reinterpret_cast<unsigned char*>(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 f577dc3..8b7174a 100644 --- a/trunks/background_command_transceiver_test.cc +++ b/trunks/background_command_transceiver_test.cc @@ -95,7 +95,7 @@ TEST_F(BackgroundTransceiverTest, Synchronous) { &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_.task_runner()->PostTask(FROM_HERE, + message_loop_.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 990956a..6e50b9e 100755 --- a/trunks/generator/generator.py +++ b/trunks/generator/generator.py @@ -1267,7 +1267,7 @@ TPM_RC Tpm::SerializeCommand_%(method_name)s(%(method_args)s) { command_size += %(var_name)s_bytes.size();""" _AUTHORIZE_COMMAND = """ std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_%(method_name)s(%(method_args)s) { }""" _AUTHORIZE_RESPONSE = """ std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 160f589..59c005e 100644 --- a/trunks/hmac_authorization_delegate.cc +++ b/trunks/hmac_authorization_delegate.cc @@ -299,7 +299,7 @@ void HmacAuthorizationDelegate::AesOperation(std::string* parameter, AES_cfb128_encrypt(reinterpret_cast<const unsigned char*>(parameter->data()), decrypted, parameter->size(), &key, aes_iv, &iv_offset, operation_type); - memcpy(base::string_as_array(parameter), decrypted, parameter->size()); + memcpy(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 e6aa020..998fd38 100644 --- a/trunks/session_manager_impl.cc +++ b/trunks/session_manager_impl.cc @@ -21,8 +21,7 @@ #include <base/logging.h> #include <base/stl_util.h> #include <crypto/openssl_util.h> -#include <openssl/bio.h> -#include <openssl/bn.h> +#include <crypto/scoped_openssl_types.h> #include <openssl/err.h> #include <openssl/evp.h> #if defined(OPENSSL_IS_BORINGSSL) @@ -83,7 +82,7 @@ TPM_RC SessionManagerImpl::StartSession( std::string salt(SHA256_DIGEST_SIZE, 0); unsigned char* salt_buffer = - reinterpret_cast<unsigned char*>(base::string_as_array(&salt)); + reinterpret_cast<unsigned char*>(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 @@ -161,7 +160,7 @@ TPM_RC SessionManagerImpl::EncryptSalt(const std::string& salt, LOG(ERROR) << "Invalid salting key attributes."; return TRUNKS_RC_SESSION_SETUP_ERROR; } - bssl::UniquePtr<RSA> salting_key_rsa(RSA_new()); + crypto::ScopedRSA salting_key_rsa(RSA_new()); salting_key_rsa->e = BN_new(); if (!salting_key_rsa->e) { LOG(ERROR) << "Error creating exponent for RSA: " << GetOpenSSLError(); @@ -175,7 +174,7 @@ TPM_RC SessionManagerImpl::EncryptSalt(const std::string& salt, LOG(ERROR) << "Error setting public area of rsa key: " << GetOpenSSLError(); return TRUNKS_RC_SESSION_SETUP_ERROR; } - bssl::UniquePtr<EVP_PKEY> salting_key(EVP_PKEY_new()); + crypto::ScopedEVP_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; @@ -187,7 +186,7 @@ TPM_RC SessionManagerImpl::EncryptSalt(const std::string& salt, // 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); - bssl::UniquePtr<EVP_PKEY_CTX> salt_encrypt_context( + crypto::ScopedEVP_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(), @@ -204,7 +203,7 @@ TPM_RC SessionManagerImpl::EncryptSalt(const std::string& salt, encrypted_salt->resize(out_length); if (!EVP_PKEY_encrypt( salt_encrypt_context.get(), - reinterpret_cast<uint8_t*>(base::string_as_array(encrypted_salt)), + reinterpret_cast<uint8_t*>(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 2b4679b..1fd8da5 100644 --- a/trunks/tpm_generated.cc +++ b/trunks/tpm_generated.cc @@ -8124,7 +8124,7 @@ TPM_RC Tpm::SerializeCommand_Startup( parameter_section_bytes += startup_type_bytes; command_size += startup_type_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Startup( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Shutdown( parameter_section_bytes += shutdown_type_bytes; command_size += shutdown_type_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Shutdown( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SelfTest( parameter_section_bytes += full_test_bytes; command_size += full_test_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SelfTest( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_IncrementalSelfTest( parameter_section_bytes += to_test_bytes; command_size += to_test_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_IncrementalSelfTest( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetTestResult( crypto::SecureHash::Create(crypto::SecureHash::SHA256)); hash->Update(command_code_bytes.data(), command_code_bytes.size()); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetTestResult( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_StartAuthSession( parameter_section_bytes += auth_hash_bytes; command_size += auth_hash_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_StartAuthSession( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyRestart( handle_section_bytes += session_handle_bytes; command_size += session_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyRestart( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Create( parameter_section_bytes += creation_pcr_bytes; command_size += creation_pcr_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Create( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Load( parameter_section_bytes += in_public_bytes; command_size += in_public_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Load(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_LoadExternal( parameter_section_bytes += hierarchy_bytes; command_size += hierarchy_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_LoadExternal( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ReadPublic( handle_section_bytes += object_handle_bytes; command_size += object_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ReadPublic( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ActivateCredential( parameter_section_bytes += secret_bytes; command_size += secret_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ActivateCredential( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_MakeCredential( parameter_section_bytes += object_name_bytes; command_size += object_name_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_MakeCredential( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Unseal( handle_section_bytes += item_handle_bytes; command_size += item_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Unseal( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ObjectChangeAuth( parameter_section_bytes += new_auth_bytes; command_size += new_auth_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ObjectChangeAuth( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Duplicate( parameter_section_bytes += symmetric_alg_bytes; command_size += symmetric_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Duplicate( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Rewrap( parameter_section_bytes += in_sym_seed_bytes; command_size += in_sym_seed_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Rewrap( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Import( parameter_section_bytes += symmetric_alg_bytes; command_size += symmetric_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Import( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_RSA_Encrypt( parameter_section_bytes += label_bytes; command_size += label_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_RSA_Encrypt( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_RSA_Decrypt( parameter_section_bytes += label_bytes; command_size += label_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_RSA_Decrypt( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ECDH_KeyGen( handle_section_bytes += key_handle_bytes; command_size += key_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ECDH_KeyGen( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ECDH_ZGen( parameter_section_bytes += in_point_bytes; command_size += in_point_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ECDH_ZGen( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ECC_Parameters( parameter_section_bytes += curve_id_bytes; command_size += curve_id_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ECC_Parameters( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ZGen_2Phase( parameter_section_bytes += counter_bytes; command_size += counter_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ZGen_2Phase( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_EncryptDecrypt( parameter_section_bytes += in_data_bytes; command_size += in_data_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_EncryptDecrypt( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Hash( parameter_section_bytes += hierarchy_bytes; command_size += hierarchy_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Hash(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_HMAC( parameter_section_bytes += hash_alg_bytes; command_size += hash_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_HMAC(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetRandom( parameter_section_bytes += bytes_requested_bytes; command_size += bytes_requested_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetRandom( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_StirRandom( parameter_section_bytes += in_data_bytes; command_size += in_data_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_StirRandom( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_HMAC_Start( parameter_section_bytes += hash_alg_bytes; command_size += hash_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_HMAC_Start( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_HashSequenceStart( parameter_section_bytes += hash_alg_bytes; command_size += hash_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_HashSequenceStart( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SequenceUpdate( parameter_section_bytes += buffer_bytes; command_size += buffer_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SequenceUpdate( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SequenceComplete( parameter_section_bytes += hierarchy_bytes; command_size += hierarchy_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SequenceComplete( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_EventSequenceComplete( parameter_section_bytes += buffer_bytes; command_size += buffer_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_EventSequenceComplete( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Certify( parameter_section_bytes += in_scheme_bytes; command_size += in_scheme_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Certify( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_CertifyCreation( parameter_section_bytes += creation_ticket_bytes; command_size += creation_ticket_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_CertifyCreation( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Quote( parameter_section_bytes += pcrselect_bytes; command_size += pcrselect_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Quote(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetSessionAuditDigest( parameter_section_bytes += in_scheme_bytes; command_size += in_scheme_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetSessionAuditDigest( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetCommandAuditDigest( parameter_section_bytes += in_scheme_bytes; command_size += in_scheme_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetCommandAuditDigest( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetTime( parameter_section_bytes += in_scheme_bytes; command_size += in_scheme_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetTime( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Commit( parameter_section_bytes += y2_bytes; command_size += y2_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Commit( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_EC_Ephemeral( parameter_section_bytes += curve_id_bytes; command_size += curve_id_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_EC_Ephemeral( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_VerifySignature( parameter_section_bytes += signature_bytes; command_size += signature_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_VerifySignature( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Sign( parameter_section_bytes += validation_bytes; command_size += validation_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Sign(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SetCommandCodeAuditStatus( parameter_section_bytes += clear_list_bytes; command_size += clear_list_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SetCommandCodeAuditStatus( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_Extend( parameter_section_bytes += digests_bytes; command_size += digests_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_Extend( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_Event( parameter_section_bytes += event_data_bytes; command_size += event_data_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_Event( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_Read( parameter_section_bytes += pcr_selection_in_bytes; command_size += pcr_selection_in_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_Read( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_Allocate( parameter_section_bytes += pcr_allocation_bytes; command_size += pcr_allocation_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_Allocate( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_SetAuthPolicy( parameter_section_bytes += policy_digest_bytes; command_size += policy_digest_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_SetAuthPolicy( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_SetAuthValue( parameter_section_bytes += auth_bytes; command_size += auth_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_SetAuthValue( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PCR_Reset( handle_section_bytes += pcr_handle_bytes; command_size += pcr_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PCR_Reset( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicySigned( parameter_section_bytes += auth_bytes; command_size += auth_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicySigned( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicySecret( parameter_section_bytes += expiration_bytes; command_size += expiration_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicySecret( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyTicket( parameter_section_bytes += ticket_bytes; command_size += ticket_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyTicket( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyOR( parameter_section_bytes += p_hash_list_bytes; command_size += p_hash_list_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyOR( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyPCR( parameter_section_bytes += pcrs_bytes; command_size += pcrs_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyPCR( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyLocality( parameter_section_bytes += locality_bytes; command_size += locality_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyLocality( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyNV( parameter_section_bytes += operation_bytes; command_size += operation_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyNV( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyCounterTimer( parameter_section_bytes += operation_bytes; command_size += operation_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyCounterTimer( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyCommandCode( parameter_section_bytes += code_bytes; command_size += code_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyCommandCode( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyPhysicalPresence( handle_section_bytes += policy_session_bytes; command_size += policy_session_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyPhysicalPresence( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyCpHash( parameter_section_bytes += cp_hash_a_bytes; command_size += cp_hash_a_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyCpHash( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyNameHash( parameter_section_bytes += name_hash_bytes; command_size += name_hash_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyNameHash( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyDuplicationSelect( parameter_section_bytes += include_object_bytes; command_size += include_object_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyDuplicationSelect( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyAuthorize( parameter_section_bytes += check_ticket_bytes; command_size += check_ticket_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyAuthorize( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyAuthValue( handle_section_bytes += policy_session_bytes; command_size += policy_session_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyAuthValue( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyPassword( handle_section_bytes += policy_session_bytes; command_size += policy_session_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyPassword( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyGetDigest( handle_section_bytes += policy_session_bytes; command_size += policy_session_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyGetDigest( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PolicyNvWritten( parameter_section_bytes += written_set_bytes; command_size += written_set_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PolicyNvWritten( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_CreatePrimary( parameter_section_bytes += creation_pcr_bytes; command_size += creation_pcr_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_CreatePrimary( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_HierarchyControl( parameter_section_bytes += state_bytes; command_size += state_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_HierarchyControl( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SetPrimaryPolicy( parameter_section_bytes += hash_alg_bytes; command_size += hash_alg_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SetPrimaryPolicy( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ChangePPS( handle_section_bytes += auth_handle_bytes; command_size += auth_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ChangePPS( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ChangeEPS( handle_section_bytes += auth_handle_bytes; command_size += auth_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ChangeEPS( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_Clear( handle_section_bytes += auth_handle_bytes; command_size += auth_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_Clear(const std::string& response, hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ClearControl( parameter_section_bytes += disable_bytes; command_size += disable_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ClearControl( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_HierarchyChangeAuth( parameter_section_bytes += new_auth_bytes; command_size += new_auth_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_HierarchyChangeAuth( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_DictionaryAttackLockReset( handle_section_bytes += lock_handle_bytes; command_size += lock_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_DictionaryAttackLockReset( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_DictionaryAttackParameters( parameter_section_bytes += lockout_recovery_bytes; command_size += lockout_recovery_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_DictionaryAttackParameters( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_PP_Commands( parameter_section_bytes += clear_list_bytes; command_size += clear_list_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_PP_Commands( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_SetAlgorithmSet( parameter_section_bytes += algorithm_set_bytes; command_size += algorithm_set_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_SetAlgorithmSet( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_FieldUpgradeStart( parameter_section_bytes += manifest_signature_bytes; command_size += manifest_signature_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_FieldUpgradeStart( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_FieldUpgradeData( parameter_section_bytes += fu_data_bytes; command_size += fu_data_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_FieldUpgradeData( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_FirmwareRead( parameter_section_bytes += sequence_number_bytes; command_size += sequence_number_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_FirmwareRead( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ContextSave( handle_section_bytes += save_handle_bytes; command_size += save_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ContextSave( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ContextLoad( parameter_section_bytes += context_bytes; command_size += context_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ContextLoad( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_FlushContext( parameter_section_bytes += flush_handle_bytes; command_size += flush_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_FlushContext( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_EvictControl( parameter_section_bytes += persistent_handle_bytes; command_size += persistent_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_EvictControl( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ReadClock( crypto::SecureHash::Create(crypto::SecureHash::SHA256)); hash->Update(command_code_bytes.data(), command_code_bytes.size()); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ReadClock( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ClockSet( parameter_section_bytes += new_time_bytes; command_size += new_time_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ClockSet( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_ClockRateAdjust( parameter_section_bytes += rate_adjust_bytes; command_size += rate_adjust_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_ClockRateAdjust( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_GetCapability( parameter_section_bytes += property_count_bytes; command_size += property_count_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_GetCapability( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_TestParms( parameter_section_bytes += parameters_bytes; command_size += parameters_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_TestParms( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_DefineSpace( parameter_section_bytes += public_info_bytes; command_size += public_info_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_DefineSpace( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_UndefineSpace( handle_section_bytes += nv_index_bytes; command_size += nv_index_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_UndefineSpace( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_UndefineSpaceSpecial( handle_section_bytes += platform_bytes; command_size += platform_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_UndefineSpaceSpecial( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_ReadPublic( handle_section_bytes += nv_index_bytes; command_size += nv_index_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_ReadPublic( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_Write( parameter_section_bytes += offset_bytes; command_size += offset_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_Write( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_Increment( handle_section_bytes += nv_index_bytes; command_size += nv_index_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_Increment( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_Extend( parameter_section_bytes += data_bytes; command_size += data_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_Extend( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_SetBits( parameter_section_bytes += bits_bytes; command_size += bits_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_SetBits( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_WriteLock( handle_section_bytes += nv_index_bytes; command_size += nv_index_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_WriteLock( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_GlobalWriteLock( handle_section_bytes += auth_handle_bytes; command_size += auth_handle_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_GlobalWriteLock( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_Read( parameter_section_bytes += offset_bytes; command_size += offset_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_Read( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_ReadLock( handle_section_bytes += nv_index_bytes; command_size += nv_index_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_ReadLock( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_ChangeAuth( parameter_section_bytes += new_auth_bytes; command_size += new_auth_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_ChangeAuth( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::SerializeCommand_NV_Certify( parameter_section_bytes += offset_bytes; command_size += offset_bytes.size(); std::string command_hash(32, 0); - hash->Finish(base::string_as_array(&command_hash), command_hash.size()); + hash->Finish(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 @@ TPM_RC Tpm::ParseResponse_NV_Certify( hash->Update(command_code_bytes.data(), command_code_bytes.size()); hash->Update(buffer.data(), buffer.size()); std::string response_hash(32, 0); - hash->Finish(base::string_as_array(&response_hash), response_hash.size()); + hash->Finish(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 7b6cdf4..21e3791 100644 --- a/trunks/tpm_generated_test.cc +++ b/trunks/tpm_generated_test.cc @@ -299,7 +299,7 @@ class PostResponse { public: explicit PostResponse(const std::string& response) : response_(response) {} void operator()(const base::Callback<void(const std::string&)>& callback) { - base::MessageLoop::current()->task_runner()->PostTask(FROM_HERE, + base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, response_)); } diff --git a/trunks/tpm_utility_impl.cc b/trunks/tpm_utility_impl.cc index c5badb0..880f1ea 100644 --- a/trunks/tpm_utility_impl.cc +++ b/trunks/tpm_utility_impl.cc @@ -1829,8 +1829,7 @@ TPM_RC TpmUtilityImpl::EncryptPrivateData(const TPMT_SENSITIVE& sensitive_area, 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*>( - base::string_as_array(&private_data_string)), + reinterpret_cast<unsigned char*>(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 74c0a49..8c9898d 100644 --- a/trunks/tpm_utility_test.cc +++ b/trunks/tpm_utility_test.cc @@ -1153,8 +1153,7 @@ TEST_F(TpmUtilityTest, ImportRSAKeySuccess) { std::string unencrypted_private(private_data.size, 0); AES_cfb128_encrypt( reinterpret_cast<const unsigned char*>(private_data.buffer), - reinterpret_cast<unsigned char*>( - base::string_as_array(&unencrypted_private)), + reinterpret_cast<unsigned char*>(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 97bab14..371e16c 100644 --- a/trunks/trunks_client_test.cc +++ b/trunks/trunks_client_test.cc @@ -27,13 +27,11 @@ #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" @@ -1019,27 +1017,27 @@ void TrunksClientTest::GenerateRSAKeyPair(std::string* modulus, std::string* prime_factor, std::string* public_key) { #if defined(OPENSSL_IS_BORINGSSL) - bssl::UniquePtr<RSA> rsa(RSA_new()); - bssl::UniquePtr<BIGNUM> exponent(BN_new()); + crypto::ScopedRSA rsa(RSA_new()); + crypto::ScopedBIGNUM 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 - bssl::UniquePtr<RSA> rsa(RSA_generate_key(2048, 0x10001, nullptr, nullptr)); + crypto::ScopedRSA 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*>(base::string_as_array(modulus))); + reinterpret_cast<unsigned char*>(string_as_array(modulus))); prime_factor->resize(BN_num_bytes(rsa.get()->p), 0); - BN_bn2bin(rsa.get()->p, reinterpret_cast<unsigned char*>( - base::string_as_array(prime_factor))); + BN_bn2bin(rsa.get()->p, + reinterpret_cast<unsigned char*>(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); } } @@ -1047,14 +1045,14 @@ bool TrunksClientTest::VerifyRSASignature(const std::string& public_key, const std::string& data, const std::string& signature) { auto asn1_ptr = reinterpret_cast<const unsigned char*>(public_key.data()); - bssl::UniquePtr<RSA> rsa( + crypto::ScopedRSA 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*>( - base::string_as_array(&mutable_signature)); + unsigned char* signature_buffer = + reinterpret_cast<unsigned char*>(string_as_array(&mutable_signature)); return (RSA_verify(NID_sha256, digest_buffer, digest.size(), signature_buffer, signature.size(), rsa.get()) == 1); } |