C++程序  |  1646行  |  84.47 KB

//
// Copyright (C) 2014 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#ifndef TRUNKS_MOCK_TPM_H_
#define TRUNKS_MOCK_TPM_H_

#include <string>

#include <base/callback.h>
#include <gmock/gmock.h>

#include "trunks/tpm_generated.h"

namespace trunks {

class MockTpm : public Tpm {
 public:
  MockTpm();
  ~MockTpm() override;

  MOCK_METHOD3(Startup,
               void(const TPM_SU& startup_type,
                    AuthorizationDelegate* authorization_delegate,
                    const StartupResponse& callback));
  MOCK_METHOD2(StartupSync,
               TPM_RC(const TPM_SU& startup_type,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(Shutdown,
               void(const TPM_SU& shutdown_type,
                    AuthorizationDelegate* authorization_delegate,
                    const ShutdownResponse& callback));
  MOCK_METHOD2(ShutdownSync,
               TPM_RC(const TPM_SU& shutdown_type,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(SelfTest,
               void(const TPMI_YES_NO& full_test,
                    AuthorizationDelegate* authorization_delegate,
                    const SelfTestResponse& callback));
  MOCK_METHOD2(SelfTestSync,
               TPM_RC(const TPMI_YES_NO& full_test,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(IncrementalSelfTest,
               void(const TPML_ALG& to_test,
                    AuthorizationDelegate* authorization_delegate,
                    const IncrementalSelfTestResponse& callback));
  MOCK_METHOD3(IncrementalSelfTestSync,
               TPM_RC(const TPML_ALG& to_test,
                      TPML_ALG* to_do_list,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD2(GetTestResult,
               void(AuthorizationDelegate* authorization_delegate,
                    const GetTestResultResponse& callback));
  MOCK_METHOD3(GetTestResultSync,
               TPM_RC(TPM2B_MAX_BUFFER* out_data,
                      TPM_RC* test_result,
                      AuthorizationDelegate* authorization_delegate));
  // Too many args to mock, forward to *Short version.
  void StartAuthSession(const TPMI_DH_OBJECT& tpm_key,
                        const std::string& tpm_key_name,
                        const TPMI_DH_ENTITY& bind,
                        const std::string& bind_name,
                        const TPM2B_NONCE& nonce_caller,
                        const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
                        const TPM_SE& session_type,
                        const TPMT_SYM_DEF& symmetric,
                        const TPMI_ALG_HASH& auth_hash,
                        AuthorizationDelegate* authorization_delegate,
                        const StartAuthSessionResponse& callback) override;
  MOCK_METHOD9(StartAuthSessionShort,
               void(const TPMI_DH_OBJECT& tpm_key,
                    const TPMI_DH_ENTITY& bind,
                    const TPM2B_NONCE& nonce_caller,
                    const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
                    const TPM_SE& session_type,
                    const TPMT_SYM_DEF& symmetric,
                    const TPMI_ALG_HASH& auth_hash,
                    AuthorizationDelegate* authorization_delegate,
                    const StartAuthSessionResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC StartAuthSessionSync(
      const TPMI_DH_OBJECT& tpm_key,
      const std::string& tpm_key_name,
      const TPMI_DH_ENTITY& bind,
      const std::string& bind_name,
      const TPM2B_NONCE& nonce_caller,
      const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
      const TPM_SE& session_type,
      const TPMT_SYM_DEF& symmetric,
      const TPMI_ALG_HASH& auth_hash,
      TPMI_SH_AUTH_SESSION* session_handle,
      TPM2B_NONCE* nonce_tpm,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(StartAuthSessionSyncShort,
                TPM_RC(const TPMI_DH_OBJECT& tpm_key,
                       const TPMI_DH_ENTITY& bind,
                       const TPM2B_NONCE& nonce_caller,
                       const TPM2B_ENCRYPTED_SECRET& encrypted_salt,
                       const TPM_SE& session_type,
                       const TPMT_SYM_DEF& symmetric,
                       const TPMI_ALG_HASH& auth_hash,
                       TPMI_SH_AUTH_SESSION* session_handle,
                       TPM2B_NONCE* nonce_tpm,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PolicyRestart,
               void(const TPMI_SH_POLICY& session_handle,
                    const std::string& session_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyRestartResponse& callback));
  MOCK_METHOD3(PolicyRestartSync,
               TPM_RC(const TPMI_SH_POLICY& session_handle,
                      const std::string& session_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(Create,
               void(const TPMI_DH_OBJECT& parent_handle,
                    const std::string& parent_handle_name,
                    const TPM2B_SENSITIVE_CREATE& in_sensitive,
                    const TPM2B_PUBLIC& in_public,
                    const TPM2B_DATA& outside_info,
                    const TPML_PCR_SELECTION& creation_pcr,
                    AuthorizationDelegate* authorization_delegate,
                    const CreateResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC CreateSync(const TPMI_DH_OBJECT& parent_handle,
                    const std::string& parent_handle_name,
                    const TPM2B_SENSITIVE_CREATE& in_sensitive,
                    const TPM2B_PUBLIC& in_public,
                    const TPM2B_DATA& outside_info,
                    const TPML_PCR_SELECTION& creation_pcr,
                    TPM2B_PRIVATE* out_private,
                    TPM2B_PUBLIC* out_public,
                    TPM2B_CREATION_DATA* creation_data,
                    TPM2B_DIGEST* creation_hash,
                    TPMT_TK_CREATION* creation_ticket,
                    AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(CreateSyncShort,
                TPM_RC(const TPMI_DH_OBJECT& parent_handle,
                       const TPM2B_SENSITIVE_CREATE& in_sensitive,
                       const TPM2B_PUBLIC& in_public,
                       const TPML_PCR_SELECTION& creation_pcr,
                       TPM2B_PRIVATE* out_private,
                       TPM2B_PUBLIC* out_public,
                       TPM2B_CREATION_DATA* creation_data,
                       TPM2B_DIGEST* creation_hash,
                       TPMT_TK_CREATION* creation_ticket,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(Load,
               void(const TPMI_DH_OBJECT& parent_handle,
                    const std::string& parent_handle_name,
                    const TPM2B_PRIVATE& in_private,
                    const TPM2B_PUBLIC& in_public,
                    AuthorizationDelegate* authorization_delegate,
                    const LoadResponse& callback));
  MOCK_METHOD7(LoadSync,
               TPM_RC(const TPMI_DH_OBJECT& parent_handle,
                      const std::string& parent_handle_name,
                      const TPM2B_PRIVATE& in_private,
                      const TPM2B_PUBLIC& in_public,
                      TPM_HANDLE* object_handle,
                      TPM2B_NAME* name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(LoadExternal,
               void(const TPM2B_SENSITIVE& in_private,
                    const TPM2B_PUBLIC& in_public,
                    const TPMI_RH_HIERARCHY& hierarchy,
                    AuthorizationDelegate* authorization_delegate,
                    const LoadExternalResponse& callback));
  MOCK_METHOD6(LoadExternalSync,
               TPM_RC(const TPM2B_SENSITIVE& in_private,
                      const TPM2B_PUBLIC& in_public,
                      const TPMI_RH_HIERARCHY& hierarchy,
                      TPM_HANDLE* object_handle,
                      TPM2B_NAME* name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(ReadPublic,
               void(const TPMI_DH_OBJECT& object_handle,
                    const std::string& object_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ReadPublicResponse& callback));
  MOCK_METHOD6(ReadPublicSync,
               TPM_RC(const TPMI_DH_OBJECT& object_handle,
                      const std::string& object_handle_name,
                      TPM2B_PUBLIC* out_public,
                      TPM2B_NAME* name,
                      TPM2B_NAME* qualified_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(ActivateCredential,
               void(const TPMI_DH_OBJECT& activate_handle,
                    const std::string& activate_handle_name,
                    const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_ID_OBJECT& credential_blob,
                    const TPM2B_ENCRYPTED_SECRET& secret,
                    AuthorizationDelegate* authorization_delegate,
                    const ActivateCredentialResponse& callback));
  MOCK_METHOD8(ActivateCredentialSync,
               TPM_RC(const TPMI_DH_OBJECT& activate_handle,
                      const std::string& activate_handle_name,
                      const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_ID_OBJECT& credential_blob,
                      const TPM2B_ENCRYPTED_SECRET& secret,
                      TPM2B_DIGEST* cert_info,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(MakeCredential,
               void(const TPMI_DH_OBJECT& handle,
                    const std::string& handle_name,
                    const TPM2B_DIGEST& credential,
                    const TPM2B_NAME& object_name,
                    AuthorizationDelegate* authorization_delegate,
                    const MakeCredentialResponse& callback));
  MOCK_METHOD7(MakeCredentialSync,
               TPM_RC(const TPMI_DH_OBJECT& handle,
                      const std::string& handle_name,
                      const TPM2B_DIGEST& credential,
                      const TPM2B_NAME& object_name,
                      TPM2B_ID_OBJECT* credential_blob,
                      TPM2B_ENCRYPTED_SECRET* secret,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(Unseal,
               void(const TPMI_DH_OBJECT& item_handle,
                    const std::string& item_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const UnsealResponse& callback));
  MOCK_METHOD4(UnsealSync,
               TPM_RC(const TPMI_DH_OBJECT& item_handle,
                      const std::string& item_handle_name,
                      TPM2B_SENSITIVE_DATA* out_data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(ObjectChangeAuth,
               void(const TPMI_DH_OBJECT& object_handle,
                    const std::string& object_handle_name,
                    const TPMI_DH_OBJECT& parent_handle,
                    const std::string& parent_handle_name,
                    const TPM2B_AUTH& new_auth,
                    AuthorizationDelegate* authorization_delegate,
                    const ObjectChangeAuthResponse& callback));
  MOCK_METHOD7(ObjectChangeAuthSync,
               TPM_RC(const TPMI_DH_OBJECT& object_handle,
                      const std::string& object_handle_name,
                      const TPMI_DH_OBJECT& parent_handle,
                      const std::string& parent_handle_name,
                      const TPM2B_AUTH& new_auth,
                      TPM2B_PRIVATE* out_private,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(Duplicate,
               void(const TPMI_DH_OBJECT& object_handle,
                    const std::string& object_handle_name,
                    const TPMI_DH_OBJECT& new_parent_handle,
                    const std::string& new_parent_handle_name,
                    const TPM2B_DATA& encryption_key_in,
                    const TPMT_SYM_DEF_OBJECT& symmetric_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const DuplicateResponse& callback));
  MOCK_METHOD10(DuplicateSync,
                TPM_RC(const TPMI_DH_OBJECT& object_handle,
                       const std::string& object_handle_name,
                       const TPMI_DH_OBJECT& new_parent_handle,
                       const std::string& new_parent_handle_name,
                       const TPM2B_DATA& encryption_key_in,
                       const TPMT_SYM_DEF_OBJECT& symmetric_alg,
                       TPM2B_DATA* encryption_key_out,
                       TPM2B_PRIVATE* duplicate,
                       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD9(Rewrap,
               void(const TPMI_DH_OBJECT& old_parent,
                    const std::string& old_parent_name,
                    const TPMI_DH_OBJECT& new_parent,
                    const std::string& new_parent_name,
                    const TPM2B_PRIVATE& in_duplicate,
                    const TPM2B_NAME& name,
                    const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
                    AuthorizationDelegate* authorization_delegate,
                    const RewrapResponse& callback));
  MOCK_METHOD10(RewrapSync,
                TPM_RC(const TPMI_DH_OBJECT& old_parent,
                       const std::string& old_parent_name,
                       const TPMI_DH_OBJECT& new_parent,
                       const std::string& new_parent_name,
                       const TPM2B_PRIVATE& in_duplicate,
                       const TPM2B_NAME& name,
                       const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
                       TPM2B_PRIVATE* out_duplicate,
                       TPM2B_ENCRYPTED_SECRET* out_sym_seed,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD9(Import,
               void(const TPMI_DH_OBJECT& parent_handle,
                    const std::string& parent_handle_name,
                    const TPM2B_DATA& encryption_key,
                    const TPM2B_PUBLIC& object_public,
                    const TPM2B_PRIVATE& duplicate,
                    const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
                    const TPMT_SYM_DEF_OBJECT& symmetric_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const ImportResponse& callback));
  MOCK_METHOD9(ImportSync,
               TPM_RC(const TPMI_DH_OBJECT& parent_handle,
                      const std::string& parent_handle_name,
                      const TPM2B_DATA& encryption_key,
                      const TPM2B_PUBLIC& object_public,
                      const TPM2B_PRIVATE& duplicate,
                      const TPM2B_ENCRYPTED_SECRET& in_sym_seed,
                      const TPMT_SYM_DEF_OBJECT& symmetric_alg,
                      TPM2B_PRIVATE* out_private,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(RSA_Encrypt,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_PUBLIC_KEY_RSA& message,
                    const TPMT_RSA_DECRYPT& in_scheme,
                    const TPM2B_DATA& label,
                    AuthorizationDelegate* authorization_delegate,
                    const RSA_EncryptResponse& callback));
  MOCK_METHOD7(RSA_EncryptSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_PUBLIC_KEY_RSA& message,
                      const TPMT_RSA_DECRYPT& in_scheme,
                      const TPM2B_DATA& label,
                      TPM2B_PUBLIC_KEY_RSA* out_data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(RSA_Decrypt,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_PUBLIC_KEY_RSA& cipher_text,
                    const TPMT_RSA_DECRYPT& in_scheme,
                    const TPM2B_DATA& label,
                    AuthorizationDelegate* authorization_delegate,
                    const RSA_DecryptResponse& callback));
  MOCK_METHOD7(RSA_DecryptSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_PUBLIC_KEY_RSA& cipher_text,
                      const TPMT_RSA_DECRYPT& in_scheme,
                      const TPM2B_DATA& label,
                      TPM2B_PUBLIC_KEY_RSA* message,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(ECDH_KeyGen,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ECDH_KeyGenResponse& callback));
  MOCK_METHOD5(ECDH_KeyGenSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      TPM2B_ECC_POINT* z_point,
                      TPM2B_ECC_POINT* pub_point,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(ECDH_ZGen,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_ECC_POINT& in_point,
                    AuthorizationDelegate* authorization_delegate,
                    const ECDH_ZGenResponse& callback));
  MOCK_METHOD5(ECDH_ZGenSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_ECC_POINT& in_point,
                      TPM2B_ECC_POINT* out_point,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(ECC_Parameters,
               void(const TPMI_ECC_CURVE& curve_id,
                    AuthorizationDelegate* authorization_delegate,
                    const ECC_ParametersResponse& callback));
  MOCK_METHOD3(ECC_ParametersSync,
               TPM_RC(const TPMI_ECC_CURVE& curve_id,
                      TPMS_ALGORITHM_DETAIL_ECC* parameters,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(ZGen_2Phase,
               void(const TPMI_DH_OBJECT& key_a,
                    const std::string& key_a_name,
                    const TPM2B_ECC_POINT& in_qs_b,
                    const TPM2B_ECC_POINT& in_qe_b,
                    const TPMI_ECC_KEY_EXCHANGE& in_scheme,
                    const UINT16& counter,
                    AuthorizationDelegate* authorization_delegate,
                    const ZGen_2PhaseResponse& callback));
  MOCK_METHOD9(ZGen_2PhaseSync,
               TPM_RC(const TPMI_DH_OBJECT& key_a,
                      const std::string& key_a_name,
                      const TPM2B_ECC_POINT& in_qs_b,
                      const TPM2B_ECC_POINT& in_qe_b,
                      const TPMI_ECC_KEY_EXCHANGE& in_scheme,
                      const UINT16& counter,
                      TPM2B_ECC_POINT* out_z1,
                      TPM2B_ECC_POINT* out_z2,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(EncryptDecrypt,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPMI_YES_NO& decrypt,
                    const TPMI_ALG_SYM_MODE& mode,
                    const TPM2B_IV& iv_in,
                    const TPM2B_MAX_BUFFER& in_data,
                    AuthorizationDelegate* authorization_delegate,
                    const EncryptDecryptResponse& callback));
  MOCK_METHOD9(EncryptDecryptSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPMI_YES_NO& decrypt,
                      const TPMI_ALG_SYM_MODE& mode,
                      const TPM2B_IV& iv_in,
                      const TPM2B_MAX_BUFFER& in_data,
                      TPM2B_MAX_BUFFER* out_data,
                      TPM2B_IV* iv_out,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(Hash,
               void(const TPM2B_MAX_BUFFER& data,
                    const TPMI_ALG_HASH& hash_alg,
                    const TPMI_RH_HIERARCHY& hierarchy,
                    AuthorizationDelegate* authorization_delegate,
                    const HashResponse& callback));
  MOCK_METHOD6(HashSync,
               TPM_RC(const TPM2B_MAX_BUFFER& data,
                      const TPMI_ALG_HASH& hash_alg,
                      const TPMI_RH_HIERARCHY& hierarchy,
                      TPM2B_DIGEST* out_hash,
                      TPMT_TK_HASHCHECK* validation,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(HMAC,
               void(const TPMI_DH_OBJECT& handle,
                    const std::string& handle_name,
                    const TPM2B_MAX_BUFFER& buffer,
                    const TPMI_ALG_HASH& hash_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const HMACResponse& callback));
  MOCK_METHOD6(HMACSync,
               TPM_RC(const TPMI_DH_OBJECT& handle,
                      const std::string& handle_name,
                      const TPM2B_MAX_BUFFER& buffer,
                      const TPMI_ALG_HASH& hash_alg,
                      TPM2B_DIGEST* out_hmac,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(GetRandom,
               void(const UINT16& bytes_requested,
                    AuthorizationDelegate* authorization_delegate,
                    const GetRandomResponse& callback));
  MOCK_METHOD3(GetRandomSync,
               TPM_RC(const UINT16& bytes_requested,
                      TPM2B_DIGEST* random_bytes,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(StirRandom,
               void(const TPM2B_SENSITIVE_DATA& in_data,
                    AuthorizationDelegate* authorization_delegate,
                    const StirRandomResponse& callback));
  MOCK_METHOD2(StirRandomSync,
               TPM_RC(const TPM2B_SENSITIVE_DATA& in_data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(HMAC_Start,
               void(const TPMI_DH_OBJECT& handle,
                    const std::string& handle_name,
                    const TPM2B_AUTH& auth,
                    const TPMI_ALG_HASH& hash_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const HMAC_StartResponse& callback));
  MOCK_METHOD6(HMAC_StartSync,
               TPM_RC(const TPMI_DH_OBJECT& handle,
                      const std::string& handle_name,
                      const TPM2B_AUTH& auth,
                      const TPMI_ALG_HASH& hash_alg,
                      TPMI_DH_OBJECT* sequence_handle,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(HashSequenceStart,
               void(const TPM2B_AUTH& auth,
                    const TPMI_ALG_HASH& hash_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const HashSequenceStartResponse& callback));
  MOCK_METHOD4(HashSequenceStartSync,
               TPM_RC(const TPM2B_AUTH& auth,
                      const TPMI_ALG_HASH& hash_alg,
                      TPMI_DH_OBJECT* sequence_handle,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(SequenceUpdate,
               void(const TPMI_DH_OBJECT& sequence_handle,
                    const std::string& sequence_handle_name,
                    const TPM2B_MAX_BUFFER& buffer,
                    AuthorizationDelegate* authorization_delegate,
                    const SequenceUpdateResponse& callback));
  MOCK_METHOD4(SequenceUpdateSync,
               TPM_RC(const TPMI_DH_OBJECT& sequence_handle,
                      const std::string& sequence_handle_name,
                      const TPM2B_MAX_BUFFER& buffer,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(SequenceComplete,
               void(const TPMI_DH_OBJECT& sequence_handle,
                    const std::string& sequence_handle_name,
                    const TPM2B_MAX_BUFFER& buffer,
                    const TPMI_RH_HIERARCHY& hierarchy,
                    AuthorizationDelegate* authorization_delegate,
                    const SequenceCompleteResponse& callback));
  MOCK_METHOD7(SequenceCompleteSync,
               TPM_RC(const TPMI_DH_OBJECT& sequence_handle,
                      const std::string& sequence_handle_name,
                      const TPM2B_MAX_BUFFER& buffer,
                      const TPMI_RH_HIERARCHY& hierarchy,
                      TPM2B_DIGEST* result,
                      TPMT_TK_HASHCHECK* validation,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(EventSequenceComplete,
               void(const TPMI_DH_PCR& pcr_handle,
                    const std::string& pcr_handle_name,
                    const TPMI_DH_OBJECT& sequence_handle,
                    const std::string& sequence_handle_name,
                    const TPM2B_MAX_BUFFER& buffer,
                    AuthorizationDelegate* authorization_delegate,
                    const EventSequenceCompleteResponse& callback));
  MOCK_METHOD7(EventSequenceCompleteSync,
               TPM_RC(const TPMI_DH_PCR& pcr_handle,
                      const std::string& pcr_handle_name,
                      const TPMI_DH_OBJECT& sequence_handle,
                      const std::string& sequence_handle_name,
                      const TPM2B_MAX_BUFFER& buffer,
                      TPML_DIGEST_VALUES* results,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(Certify,
               void(const TPMI_DH_OBJECT& object_handle,
                    const std::string& object_handle_name,
                    const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const TPM2B_DATA& qualifying_data,
                    const TPMT_SIG_SCHEME& in_scheme,
                    AuthorizationDelegate* authorization_delegate,
                    const CertifyResponse& callback));
  MOCK_METHOD9(CertifySync,
               TPM_RC(const TPMI_DH_OBJECT& object_handle,
                      const std::string& object_handle_name,
                      const TPMI_DH_OBJECT& sign_handle,
                      const std::string& sign_handle_name,
                      const TPM2B_DATA& qualifying_data,
                      const TPMT_SIG_SCHEME& in_scheme,
                      TPM2B_ATTEST* certify_info,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD10(CertifyCreation,
                void(const TPMI_DH_OBJECT& sign_handle,
                     const std::string& sign_handle_name,
                     const TPMI_DH_OBJECT& object_handle,
                     const std::string& object_handle_name,
                     const TPM2B_DATA& qualifying_data,
                     const TPM2B_DIGEST& creation_hash,
                     const TPMT_SIG_SCHEME& in_scheme,
                     const TPMT_TK_CREATION& creation_ticket,
                     AuthorizationDelegate* authorization_delegate,
                     const CertifyCreationResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC CertifyCreationSync(
      const TPMI_DH_OBJECT& sign_handle,
      const std::string& sign_handle_name,
      const TPMI_DH_OBJECT& object_handle,
      const std::string& object_handle_name,
      const TPM2B_DATA& qualifying_data,
      const TPM2B_DIGEST& creation_hash,
      const TPMT_SIG_SCHEME& in_scheme,
      const TPMT_TK_CREATION& creation_ticket,
      TPM2B_ATTEST* certify_info,
      TPMT_SIGNATURE* signature,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD9(CertifyCreationSyncShort,
               TPM_RC(const TPMI_DH_OBJECT& sign_handle,
                      const TPMI_DH_OBJECT& object_handle,
                      const TPM2B_DATA& qualifying_data,
                      const TPM2B_DIGEST& creation_hash,
                      const TPMT_SIG_SCHEME& in_scheme,
                      const TPMT_TK_CREATION& creation_ticket,
                      TPM2B_ATTEST* certify_info,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(Quote,
               void(const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const TPM2B_DATA& qualifying_data,
                    const TPMT_SIG_SCHEME& in_scheme,
                    const TPML_PCR_SELECTION& pcrselect,
                    AuthorizationDelegate* authorization_delegate,
                    const QuoteResponse& callback));
  MOCK_METHOD8(QuoteSync,
               TPM_RC(const TPMI_DH_OBJECT& sign_handle,
                      const std::string& sign_handle_name,
                      const TPM2B_DATA& qualifying_data,
                      const TPMT_SIG_SCHEME& in_scheme,
                      const TPML_PCR_SELECTION& pcrselect,
                      TPM2B_ATTEST* quoted,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD10(GetSessionAuditDigest,
                void(const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
                     const std::string& privacy_admin_handle_name,
                     const TPMI_DH_OBJECT& sign_handle,
                     const std::string& sign_handle_name,
                     const TPMI_SH_HMAC& session_handle,
                     const std::string& session_handle_name,
                     const TPM2B_DATA& qualifying_data,
                     const TPMT_SIG_SCHEME& in_scheme,
                     AuthorizationDelegate* authorization_delegate,
                     const GetSessionAuditDigestResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC GetSessionAuditDigestSync(
      const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
      const std::string& privacy_admin_handle_name,
      const TPMI_DH_OBJECT& sign_handle,
      const std::string& sign_handle_name,
      const TPMI_SH_HMAC& session_handle,
      const std::string& session_handle_name,
      const TPM2B_DATA& qualifying_data,
      const TPMT_SIG_SCHEME& in_scheme,
      TPM2B_ATTEST* audit_info,
      TPMT_SIGNATURE* signature,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD8(GetSessionAuditDigestSyncShort,
               TPM_RC(const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
                      const TPMI_DH_OBJECT& sign_handle,
                      const TPMI_SH_HMAC& session_handle,
                      const TPM2B_DATA& qualifying_data,
                      const TPMT_SIG_SCHEME& in_scheme,
                      TPM2B_ATTEST* audit_info,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(GetCommandAuditDigest,
               void(const TPMI_RH_ENDORSEMENT& privacy_handle,
                    const std::string& privacy_handle_name,
                    const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const TPM2B_DATA& qualifying_data,
                    const TPMT_SIG_SCHEME& in_scheme,
                    AuthorizationDelegate* authorization_delegate,
                    const GetCommandAuditDigestResponse& callback));
  MOCK_METHOD9(GetCommandAuditDigestSync,
               TPM_RC(const TPMI_RH_ENDORSEMENT& privacy_handle,
                      const std::string& privacy_handle_name,
                      const TPMI_DH_OBJECT& sign_handle,
                      const std::string& sign_handle_name,
                      const TPM2B_DATA& qualifying_data,
                      const TPMT_SIG_SCHEME& in_scheme,
                      TPM2B_ATTEST* audit_info,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(GetTime,
               void(const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
                    const std::string& privacy_admin_handle_name,
                    const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const TPM2B_DATA& qualifying_data,
                    const TPMT_SIG_SCHEME& in_scheme,
                    AuthorizationDelegate* authorization_delegate,
                    const GetTimeResponse& callback));
  MOCK_METHOD9(GetTimeSync,
               TPM_RC(const TPMI_RH_ENDORSEMENT& privacy_admin_handle,
                      const std::string& privacy_admin_handle_name,
                      const TPMI_DH_OBJECT& sign_handle,
                      const std::string& sign_handle_name,
                      const TPM2B_DATA& qualifying_data,
                      const TPMT_SIG_SCHEME& in_scheme,
                      TPM2B_ATTEST* time_info,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(Commit,
               void(const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const UINT32& param_size,
                    const TPM2B_ECC_POINT& p1,
                    const TPM2B_SENSITIVE_DATA& s2,
                    const TPM2B_ECC_PARAMETER& y2,
                    AuthorizationDelegate* authorization_delegate,
                    const CommitResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC CommitSync(const TPMI_DH_OBJECT& sign_handle,
                    const std::string& sign_handle_name,
                    const UINT32& param_size,
                    const TPM2B_ECC_POINT& p1,
                    const TPM2B_SENSITIVE_DATA& s2,
                    const TPM2B_ECC_PARAMETER& y2,
                    UINT32* param_size_out,
                    TPM2B_ECC_POINT* k,
                    TPM2B_ECC_POINT* l,
                    TPM2B_ECC_POINT* e,
                    UINT16* counter,
                    AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(CommitSyncShort,
                TPM_RC(const TPMI_DH_OBJECT& sign_handle,
                       const UINT32& param_size,
                       const TPM2B_ECC_POINT& p1,
                       const TPM2B_ECC_PARAMETER& y2,
                       UINT32* param_size_out,
                       TPM2B_ECC_POINT* k,
                       TPM2B_ECC_POINT* l,
                       TPM2B_ECC_POINT* e,
                       UINT16* counter,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(EC_Ephemeral,
               void(const UINT32& param_size,
                    const TPMI_ECC_CURVE& curve_id,
                    AuthorizationDelegate* authorization_delegate,
                    const EC_EphemeralResponse& callback));
  MOCK_METHOD6(EC_EphemeralSync,
               TPM_RC(const UINT32& param_size,
                      const TPMI_ECC_CURVE& curve_id,
                      UINT32* param_size_out,
                      TPM2B_ECC_POINT* q,
                      UINT16* counter,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(VerifySignature,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_DIGEST& digest,
                    const TPMT_SIGNATURE& signature,
                    AuthorizationDelegate* authorization_delegate,
                    const VerifySignatureResponse& callback));
  MOCK_METHOD6(VerifySignatureSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_DIGEST& digest,
                      const TPMT_SIGNATURE& signature,
                      TPMT_TK_VERIFIED* validation,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(Sign,
               void(const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_DIGEST& digest,
                    const TPMT_SIG_SCHEME& in_scheme,
                    const TPMT_TK_HASHCHECK& validation,
                    AuthorizationDelegate* authorization_delegate,
                    const SignResponse& callback));
  MOCK_METHOD7(SignSync,
               TPM_RC(const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_DIGEST& digest,
                      const TPMT_SIG_SCHEME& in_scheme,
                      const TPMT_TK_HASHCHECK& validation,
                      TPMT_SIGNATURE* signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(SetCommandCodeAuditStatus,
               void(const TPMI_RH_PROVISION& auth,
                    const std::string& auth_name,
                    const TPMI_ALG_HASH& audit_alg,
                    const TPML_CC& set_list,
                    const TPML_CC& clear_list,
                    AuthorizationDelegate* authorization_delegate,
                    const SetCommandCodeAuditStatusResponse& callback));
  MOCK_METHOD6(SetCommandCodeAuditStatusSync,
               TPM_RC(const TPMI_RH_PROVISION& auth,
                      const std::string& auth_name,
                      const TPMI_ALG_HASH& audit_alg,
                      const TPML_CC& set_list,
                      const TPML_CC& clear_list,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PCR_Extend,
               void(const TPMI_DH_PCR& pcr_handle,
                    const std::string& pcr_handle_name,
                    const TPML_DIGEST_VALUES& digests,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_ExtendResponse& callback));
  MOCK_METHOD4(PCR_ExtendSync,
               TPM_RC(const TPMI_DH_PCR& pcr_handle,
                      const std::string& pcr_handle_name,
                      const TPML_DIGEST_VALUES& digests,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PCR_Event,
               void(const TPMI_DH_PCR& pcr_handle,
                    const std::string& pcr_handle_name,
                    const TPM2B_EVENT& event_data,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_EventResponse& callback));
  MOCK_METHOD5(PCR_EventSync,
               TPM_RC(const TPMI_DH_PCR& pcr_handle,
                      const std::string& pcr_handle_name,
                      const TPM2B_EVENT& event_data,
                      TPML_DIGEST_VALUES* digests,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(PCR_Read,
               void(const TPML_PCR_SELECTION& pcr_selection_in,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_ReadResponse& callback));
  MOCK_METHOD5(PCR_ReadSync,
               TPM_RC(const TPML_PCR_SELECTION& pcr_selection_in,
                      UINT32* pcr_update_counter,
                      TPML_PCR_SELECTION* pcr_selection_out,
                      TPML_DIGEST* pcr_values,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PCR_Allocate,
               void(const TPMI_RH_PLATFORM& auth_handle,
                    const std::string& auth_handle_name,
                    const TPML_PCR_SELECTION& pcr_allocation,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_AllocateResponse& callback));
  MOCK_METHOD8(PCR_AllocateSync,
               TPM_RC(const TPMI_RH_PLATFORM& auth_handle,
                      const std::string& auth_handle_name,
                      const TPML_PCR_SELECTION& pcr_allocation,
                      TPMI_YES_NO* allocation_success,
                      UINT32* max_pcr,
                      UINT32* size_needed,
                      UINT32* size_available,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(PCR_SetAuthPolicy,
               void(const TPMI_RH_PLATFORM& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_DH_PCR& pcr_num,
                    const std::string& pcr_num_name,
                    const TPM2B_DIGEST& auth_policy,
                    const TPMI_ALG_HASH& policy_digest,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_SetAuthPolicyResponse& callback));
  MOCK_METHOD7(PCR_SetAuthPolicySync,
               TPM_RC(const TPMI_RH_PLATFORM& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_DH_PCR& pcr_num,
                      const std::string& pcr_num_name,
                      const TPM2B_DIGEST& auth_policy,
                      const TPMI_ALG_HASH& policy_digest,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PCR_SetAuthValue,
               void(const TPMI_DH_PCR& pcr_handle,
                    const std::string& pcr_handle_name,
                    const TPM2B_DIGEST& auth,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_SetAuthValueResponse& callback));
  MOCK_METHOD4(PCR_SetAuthValueSync,
               TPM_RC(const TPMI_DH_PCR& pcr_handle,
                      const std::string& pcr_handle_name,
                      const TPM2B_DIGEST& auth,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PCR_Reset,
               void(const TPMI_DH_PCR& pcr_handle,
                    const std::string& pcr_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PCR_ResetResponse& callback));
  MOCK_METHOD3(PCR_ResetSync,
               TPM_RC(const TPMI_DH_PCR& pcr_handle,
                      const std::string& pcr_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  // Too many args to mock, forward to *Short version.
  void PolicySigned(const TPMI_DH_OBJECT& auth_object,
                    const std::string& auth_object_name,
                    const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_NONCE& nonce_tpm,
                    const TPM2B_DIGEST& cp_hash_a,
                    const TPM2B_NONCE& policy_ref,
                    const INT32& expiration,
                    const TPMT_SIGNATURE& auth,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicySignedResponse& callback) override;
  MOCK_METHOD9(PolicySignedShort,
               void(const TPMI_DH_OBJECT& auth_object,
                    const TPMI_SH_POLICY& policy_session,
                    const TPM2B_NONCE& nonce_tpm,
                    const TPM2B_DIGEST& cp_hash_a,
                    const TPM2B_NONCE& policy_ref,
                    const INT32& expiration,
                    const TPMT_SIGNATURE& auth,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicySignedResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC PolicySignedSync(
      const TPMI_DH_OBJECT& auth_object,
      const std::string& auth_object_name,
      const TPMI_SH_POLICY& policy_session,
      const std::string& policy_session_name,
      const TPM2B_NONCE& nonce_tpm,
      const TPM2B_DIGEST& cp_hash_a,
      const TPM2B_NONCE& policy_ref,
      const INT32& expiration,
      const TPMT_SIGNATURE& auth,
      TPM2B_TIMEOUT* timeout,
      TPMT_TK_AUTH* policy_ticket,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(PolicySignedSyncShort,
                TPM_RC(const TPMI_DH_OBJECT& auth_object,
                       const TPMI_SH_POLICY& policy_session,
                       const TPM2B_NONCE& nonce_tpm,
                       const TPM2B_DIGEST& cp_hash_a,
                       const TPM2B_NONCE& policy_ref,
                       const INT32& expiration,
                       const TPMT_SIGNATURE& auth,
                       TPM2B_TIMEOUT* timeout,
                       TPMT_TK_AUTH* policy_ticket,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD10(PolicySecret,
                void(const TPMI_DH_ENTITY& auth_handle,
                     const std::string& auth_handle_name,
                     const TPMI_SH_POLICY& policy_session,
                     const std::string& policy_session_name,
                     const TPM2B_NONCE& nonce_tpm,
                     const TPM2B_DIGEST& cp_hash_a,
                     const TPM2B_NONCE& policy_ref,
                     const INT32& expiration,
                     AuthorizationDelegate* authorization_delegate,
                     const PolicySecretResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC PolicySecretSync(
      const TPMI_DH_ENTITY& auth_handle,
      const std::string& auth_handle_name,
      const TPMI_SH_POLICY& policy_session,
      const std::string& policy_session_name,
      const TPM2B_NONCE& nonce_tpm,
      const TPM2B_DIGEST& cp_hash_a,
      const TPM2B_NONCE& policy_ref,
      const INT32& expiration,
      TPM2B_TIMEOUT* timeout,
      TPMT_TK_AUTH* policy_ticket,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD9(PolicySecretSyncShort,
               TPM_RC(const TPMI_DH_ENTITY& auth_handle,
                      const TPMI_SH_POLICY& policy_session,
                      const TPM2B_NONCE& nonce_tpm,
                      const TPM2B_DIGEST& cp_hash_a,
                      const TPM2B_NONCE& policy_ref,
                      const INT32& expiration,
                      TPM2B_TIMEOUT* timeout,
                      TPMT_TK_AUTH* policy_ticket,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD9(PolicyTicket,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_TIMEOUT& timeout,
                    const TPM2B_DIGEST& cp_hash_a,
                    const TPM2B_NONCE& policy_ref,
                    const TPM2B_NAME& auth_name,
                    const TPMT_TK_AUTH& ticket,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyTicketResponse& callback));
  MOCK_METHOD8(PolicyTicketSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_TIMEOUT& timeout,
                      const TPM2B_DIGEST& cp_hash_a,
                      const TPM2B_NONCE& policy_ref,
                      const TPM2B_NAME& auth_name,
                      const TPMT_TK_AUTH& ticket,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyOR,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPML_DIGEST& p_hash_list,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyORResponse& callback));
  MOCK_METHOD4(PolicyORSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPML_DIGEST& p_hash_list,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(PolicyPCR,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_DIGEST& pcr_digest,
                    const TPML_PCR_SELECTION& pcrs,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyPCRResponse& callback));
  MOCK_METHOD5(PolicyPCRSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_DIGEST& pcr_digest,
                      const TPML_PCR_SELECTION& pcrs,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyLocality,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPMA_LOCALITY& locality,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyLocalityResponse& callback));
  MOCK_METHOD4(PolicyLocalitySync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPMA_LOCALITY& locality,
                      AuthorizationDelegate* authorization_delegate));
  // Too many args to mock, forward to *Short version.
  void PolicyNV(const TPMI_RH_NV_AUTH& auth_handle,
                const std::string& auth_handle_name,
                const TPMI_RH_NV_INDEX& nv_index,
                const std::string& nv_index_name,
                const TPMI_SH_POLICY& policy_session,
                const std::string& policy_session_name,
                const TPM2B_OPERAND& operand_b,
                const UINT16& offset,
                const TPM_EO& operation,
                AuthorizationDelegate* authorization_delegate,
                const PolicyNVResponse& callback) override;
  MOCK_METHOD8(PolicyNVShort,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const TPMI_SH_POLICY& policy_session,
                    const TPM2B_OPERAND& operand_b,
                    const UINT16& offset,
                    const TPM_EO& operation,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyNVResponse& callback));
  MOCK_METHOD10(PolicyNVSync,
                TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                       const std::string& auth_handle_name,
                       const TPMI_RH_NV_INDEX& nv_index,
                       const std::string& nv_index_name,
                       const TPMI_SH_POLICY& policy_session,
                       const std::string& policy_session_name,
                       const TPM2B_OPERAND& operand_b,
                       const UINT16& offset,
                       const TPM_EO& operation,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(PolicyCounterTimer,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_OPERAND& operand_b,
                    const UINT16& offset,
                    const TPM_EO& operation,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyCounterTimerResponse& callback));
  MOCK_METHOD6(PolicyCounterTimerSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_OPERAND& operand_b,
                      const UINT16& offset,
                      const TPM_EO& operation,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyCommandCode,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM_CC& code,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyCommandCodeResponse& callback));
  MOCK_METHOD4(PolicyCommandCodeSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM_CC& code,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PolicyPhysicalPresence,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyPhysicalPresenceResponse& callback));
  MOCK_METHOD3(PolicyPhysicalPresenceSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyCpHash,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_DIGEST& cp_hash_a,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyCpHashResponse& callback));
  MOCK_METHOD4(PolicyCpHashSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_DIGEST& cp_hash_a,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyNameHash,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_DIGEST& name_hash,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyNameHashResponse& callback));
  MOCK_METHOD4(PolicyNameHashSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_DIGEST& name_hash,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(PolicyDuplicationSelect,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_NAME& object_name,
                    const TPM2B_NAME& new_parent_name,
                    const TPMI_YES_NO& include_object,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyDuplicationSelectResponse& callback));
  MOCK_METHOD6(PolicyDuplicationSelectSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_NAME& object_name,
                      const TPM2B_NAME& new_parent_name,
                      const TPMI_YES_NO& include_object,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(PolicyAuthorize,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPM2B_DIGEST& approved_policy,
                    const TPM2B_NONCE& policy_ref,
                    const TPM2B_NAME& key_sign,
                    const TPMT_TK_VERIFIED& check_ticket,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyAuthorizeResponse& callback));
  MOCK_METHOD7(PolicyAuthorizeSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPM2B_DIGEST& approved_policy,
                      const TPM2B_NONCE& policy_ref,
                      const TPM2B_NAME& key_sign,
                      const TPMT_TK_VERIFIED& check_ticket,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PolicyAuthValue,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyAuthValueResponse& callback));
  MOCK_METHOD3(PolicyAuthValueSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PolicyPassword,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyPasswordResponse& callback));
  MOCK_METHOD3(PolicyPasswordSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(PolicyGetDigest,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyGetDigestResponse& callback));
  MOCK_METHOD4(PolicyGetDigestSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      TPM2B_DIGEST* policy_digest,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(PolicyNvWritten,
               void(const TPMI_SH_POLICY& policy_session,
                    const std::string& policy_session_name,
                    const TPMI_YES_NO& written_set,
                    AuthorizationDelegate* authorization_delegate,
                    const PolicyNvWrittenResponse& callback));
  MOCK_METHOD4(PolicyNvWrittenSync,
               TPM_RC(const TPMI_SH_POLICY& policy_session,
                      const std::string& policy_session_name,
                      const TPMI_YES_NO& written_set,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(CreatePrimary,
               void(const TPMI_RH_HIERARCHY& primary_handle,
                    const std::string& primary_handle_name,
                    const TPM2B_SENSITIVE_CREATE& in_sensitive,
                    const TPM2B_PUBLIC& in_public,
                    const TPM2B_DATA& outside_info,
                    const TPML_PCR_SELECTION& creation_pcr,
                    AuthorizationDelegate* authorization_delegate,
                    const CreatePrimaryResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC CreatePrimarySync(
      const TPMI_RH_HIERARCHY& primary_handle,
      const std::string& primary_handle_name,
      const TPM2B_SENSITIVE_CREATE& in_sensitive,
      const TPM2B_PUBLIC& in_public,
      const TPM2B_DATA& outside_info,
      const TPML_PCR_SELECTION& creation_pcr,
      TPM_HANDLE* object_handle,
      TPM2B_PUBLIC* out_public,
      TPM2B_CREATION_DATA* creation_data,
      TPM2B_DIGEST* creation_hash,
      TPMT_TK_CREATION* creation_ticket,
      TPM2B_NAME* name,
      AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(CreatePrimarySyncShort,
                TPM_RC(const TPMI_RH_HIERARCHY& primary_handle,
                       const TPM2B_PUBLIC& in_public,
                       const TPML_PCR_SELECTION& creation_pcr,
                       TPM_HANDLE* object_handle,
                       TPM2B_PUBLIC* out_public,
                       TPM2B_CREATION_DATA* creation_data,
                       TPM2B_DIGEST* creation_hash,
                       TPMT_TK_CREATION* creation_ticket,
                       TPM2B_NAME* name,
                       AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(HierarchyControl,
               void(const TPMI_RH_HIERARCHY& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_ENABLES& enable,
                    const TPMI_YES_NO& state,
                    AuthorizationDelegate* authorization_delegate,
                    const HierarchyControlResponse& callback));
  MOCK_METHOD5(HierarchyControlSync,
               TPM_RC(const TPMI_RH_HIERARCHY& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_ENABLES& enable,
                      const TPMI_YES_NO& state,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(SetPrimaryPolicy,
               void(const TPMI_RH_HIERARCHY& auth_handle,
                    const std::string& auth_handle_name,
                    const TPM2B_DIGEST& auth_policy,
                    const TPMI_ALG_HASH& hash_alg,
                    AuthorizationDelegate* authorization_delegate,
                    const SetPrimaryPolicyResponse& callback));
  MOCK_METHOD5(SetPrimaryPolicySync,
               TPM_RC(const TPMI_RH_HIERARCHY& auth_handle,
                      const std::string& auth_handle_name,
                      const TPM2B_DIGEST& auth_policy,
                      const TPMI_ALG_HASH& hash_alg,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(ChangePPS,
               void(const TPMI_RH_PLATFORM& auth_handle,
                    const std::string& auth_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ChangePPSResponse& callback));
  MOCK_METHOD3(ChangePPSSync,
               TPM_RC(const TPMI_RH_PLATFORM& auth_handle,
                      const std::string& auth_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(ChangeEPS,
               void(const TPMI_RH_PLATFORM& auth_handle,
                    const std::string& auth_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ChangeEPSResponse& callback));
  MOCK_METHOD3(ChangeEPSSync,
               TPM_RC(const TPMI_RH_PLATFORM& auth_handle,
                      const std::string& auth_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(Clear,
               void(const TPMI_RH_CLEAR& auth_handle,
                    const std::string& auth_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ClearResponse& callback));
  MOCK_METHOD3(ClearSync,
               TPM_RC(const TPMI_RH_CLEAR& auth_handle,
                      const std::string& auth_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(ClearControl,
               void(const TPMI_RH_CLEAR& auth,
                    const std::string& auth_name,
                    const TPMI_YES_NO& disable,
                    AuthorizationDelegate* authorization_delegate,
                    const ClearControlResponse& callback));
  MOCK_METHOD4(ClearControlSync,
               TPM_RC(const TPMI_RH_CLEAR& auth,
                      const std::string& auth_name,
                      const TPMI_YES_NO& disable,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(HierarchyChangeAuth,
               void(const TPMI_RH_HIERARCHY_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPM2B_AUTH& new_auth,
                    AuthorizationDelegate* authorization_delegate,
                    const HierarchyChangeAuthResponse& callback));
  MOCK_METHOD4(HierarchyChangeAuthSync,
               TPM_RC(const TPMI_RH_HIERARCHY_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPM2B_AUTH& new_auth,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(DictionaryAttackLockReset,
               void(const TPMI_RH_LOCKOUT& lock_handle,
                    const std::string& lock_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const DictionaryAttackLockResetResponse& callback));
  MOCK_METHOD3(DictionaryAttackLockResetSync,
               TPM_RC(const TPMI_RH_LOCKOUT& lock_handle,
                      const std::string& lock_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(DictionaryAttackParameters,
               void(const TPMI_RH_LOCKOUT& lock_handle,
                    const std::string& lock_handle_name,
                    const UINT32& new_max_tries,
                    const UINT32& new_recovery_time,
                    const UINT32& lockout_recovery,
                    AuthorizationDelegate* authorization_delegate,
                    const DictionaryAttackParametersResponse& callback));
  MOCK_METHOD6(DictionaryAttackParametersSync,
               TPM_RC(const TPMI_RH_LOCKOUT& lock_handle,
                      const std::string& lock_handle_name,
                      const UINT32& new_max_tries,
                      const UINT32& new_recovery_time,
                      const UINT32& lockout_recovery,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(PP_Commands,
               void(const TPMI_RH_PLATFORM& auth,
                    const std::string& auth_name,
                    const TPML_CC& set_list,
                    const TPML_CC& clear_list,
                    AuthorizationDelegate* authorization_delegate,
                    const PP_CommandsResponse& callback));
  MOCK_METHOD5(PP_CommandsSync,
               TPM_RC(const TPMI_RH_PLATFORM& auth,
                      const std::string& auth_name,
                      const TPML_CC& set_list,
                      const TPML_CC& clear_list,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(SetAlgorithmSet,
               void(const TPMI_RH_PLATFORM& auth_handle,
                    const std::string& auth_handle_name,
                    const UINT32& algorithm_set,
                    AuthorizationDelegate* authorization_delegate,
                    const SetAlgorithmSetResponse& callback));
  MOCK_METHOD4(SetAlgorithmSetSync,
               TPM_RC(const TPMI_RH_PLATFORM& auth_handle,
                      const std::string& auth_handle_name,
                      const UINT32& algorithm_set,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(FieldUpgradeStart,
               void(const TPMI_RH_PLATFORM& authorization,
                    const std::string& authorization_name,
                    const TPMI_DH_OBJECT& key_handle,
                    const std::string& key_handle_name,
                    const TPM2B_DIGEST& fu_digest,
                    const TPMT_SIGNATURE& manifest_signature,
                    AuthorizationDelegate* authorization_delegate,
                    const FieldUpgradeStartResponse& callback));
  MOCK_METHOD7(FieldUpgradeStartSync,
               TPM_RC(const TPMI_RH_PLATFORM& authorization,
                      const std::string& authorization_name,
                      const TPMI_DH_OBJECT& key_handle,
                      const std::string& key_handle_name,
                      const TPM2B_DIGEST& fu_digest,
                      const TPMT_SIGNATURE& manifest_signature,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(FieldUpgradeData,
               void(const TPM2B_MAX_BUFFER& fu_data,
                    AuthorizationDelegate* authorization_delegate,
                    const FieldUpgradeDataResponse& callback));
  MOCK_METHOD4(FieldUpgradeDataSync,
               TPM_RC(const TPM2B_MAX_BUFFER& fu_data,
                      TPMT_HA* next_digest,
                      TPMT_HA* first_digest,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(FirmwareRead,
               void(const UINT32& sequence_number,
                    AuthorizationDelegate* authorization_delegate,
                    const FirmwareReadResponse& callback));
  MOCK_METHOD3(FirmwareReadSync,
               TPM_RC(const UINT32& sequence_number,
                      TPM2B_MAX_BUFFER* fu_data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(ContextSave,
               void(const TPMI_DH_CONTEXT& save_handle,
                    const std::string& save_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const ContextSaveResponse& callback));
  MOCK_METHOD4(ContextSaveSync,
               TPM_RC(const TPMI_DH_CONTEXT& save_handle,
                      const std::string& save_handle_name,
                      TPMS_CONTEXT* context,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(ContextLoad,
               void(const TPMS_CONTEXT& context,
                    AuthorizationDelegate* authorization_delegate,
                    const ContextLoadResponse& callback));
  MOCK_METHOD3(ContextLoadSync,
               TPM_RC(const TPMS_CONTEXT& context,
                      TPMI_DH_CONTEXT* loaded_handle,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(FlushContext,
               void(const TPMI_DH_CONTEXT& flush_handle,
                    AuthorizationDelegate* authorization_delegate,
                    const FlushContextResponse& callback));
  MOCK_METHOD2(FlushContextSync,
               TPM_RC(const TPMI_DH_CONTEXT& flush_handle,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(EvictControl,
               void(const TPMI_RH_PROVISION& auth,
                    const std::string& auth_name,
                    const TPMI_DH_OBJECT& object_handle,
                    const std::string& object_handle_name,
                    const TPMI_DH_PERSISTENT& persistent_handle,
                    AuthorizationDelegate* authorization_delegate,
                    const EvictControlResponse& callback));
  MOCK_METHOD6(EvictControlSync,
               TPM_RC(const TPMI_RH_PROVISION& auth,
                      const std::string& auth_name,
                      const TPMI_DH_OBJECT& object_handle,
                      const std::string& object_handle_name,
                      const TPMI_DH_PERSISTENT& persistent_handle,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD2(ReadClock,
               void(AuthorizationDelegate* authorization_delegate,
                    const ReadClockResponse& callback));
  MOCK_METHOD2(ReadClockSync,
               TPM_RC(TPMS_TIME_INFO* current_time,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(ClockSet,
               void(const TPMI_RH_PROVISION& auth,
                    const std::string& auth_name,
                    const UINT64& new_time,
                    AuthorizationDelegate* authorization_delegate,
                    const ClockSetResponse& callback));
  MOCK_METHOD4(ClockSetSync,
               TPM_RC(const TPMI_RH_PROVISION& auth,
                      const std::string& auth_name,
                      const UINT64& new_time,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(ClockRateAdjust,
               void(const TPMI_RH_PROVISION& auth,
                    const std::string& auth_name,
                    const TPM_CLOCK_ADJUST& rate_adjust,
                    AuthorizationDelegate* authorization_delegate,
                    const ClockRateAdjustResponse& callback));
  MOCK_METHOD4(ClockRateAdjustSync,
               TPM_RC(const TPMI_RH_PROVISION& auth,
                      const std::string& auth_name,
                      const TPM_CLOCK_ADJUST& rate_adjust,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(GetCapability,
               void(const TPM_CAP& capability,
                    const UINT32& property,
                    const UINT32& property_count,
                    AuthorizationDelegate* authorization_delegate,
                    const GetCapabilityResponse& callback));
  MOCK_METHOD6(GetCapabilitySync,
               TPM_RC(const TPM_CAP& capability,
                      const UINT32& property,
                      const UINT32& property_count,
                      TPMI_YES_NO* more_data,
                      TPMS_CAPABILITY_DATA* capability_data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD3(TestParms,
               void(const TPMT_PUBLIC_PARMS& parameters,
                    AuthorizationDelegate* authorization_delegate,
                    const TestParmsResponse& callback));
  MOCK_METHOD2(TestParmsSync,
               TPM_RC(const TPMT_PUBLIC_PARMS& parameters,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_DefineSpace,
               void(const TPMI_RH_PROVISION& auth_handle,
                    const std::string& auth_handle_name,
                    const TPM2B_AUTH& auth,
                    const TPM2B_NV_PUBLIC& public_info,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_DefineSpaceResponse& callback));
  MOCK_METHOD5(NV_DefineSpaceSync,
               TPM_RC(const TPMI_RH_PROVISION& auth_handle,
                      const std::string& auth_handle_name,
                      const TPM2B_AUTH& auth,
                      const TPM2B_NV_PUBLIC& public_info,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_UndefineSpace,
               void(const TPMI_RH_PROVISION& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_UndefineSpaceResponse& callback));
  MOCK_METHOD5(NV_UndefineSpaceSync,
               TPM_RC(const TPMI_RH_PROVISION& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_UndefineSpaceSpecial,
               void(const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const TPMI_RH_PLATFORM& platform,
                    const std::string& platform_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_UndefineSpaceSpecialResponse& callback));
  MOCK_METHOD5(NV_UndefineSpaceSpecialSync,
               TPM_RC(const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const TPMI_RH_PLATFORM& platform,
                      const std::string& platform_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(NV_ReadPublic,
               void(const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_ReadPublicResponse& callback));
  MOCK_METHOD5(NV_ReadPublicSync,
               TPM_RC(const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      TPM2B_NV_PUBLIC* nv_public,
                      TPM2B_NAME* nv_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(NV_Write,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const TPM2B_MAX_NV_BUFFER& data,
                    const UINT16& offset,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_WriteResponse& callback));
  MOCK_METHOD7(NV_WriteSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const TPM2B_MAX_NV_BUFFER& data,
                      const UINT16& offset,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_Increment,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_IncrementResponse& callback));
  MOCK_METHOD5(NV_IncrementSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(NV_Extend,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const TPM2B_MAX_NV_BUFFER& data,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_ExtendResponse& callback));
  MOCK_METHOD6(NV_ExtendSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const TPM2B_MAX_NV_BUFFER& data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD7(NV_SetBits,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const UINT64& bits,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_SetBitsResponse& callback));
  MOCK_METHOD6(NV_SetBitsSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const UINT64& bits,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_WriteLock,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_WriteLockResponse& callback));
  MOCK_METHOD5(NV_WriteLockSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD4(NV_GlobalWriteLock,
               void(const TPMI_RH_PROVISION& auth_handle,
                    const std::string& auth_handle_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_GlobalWriteLockResponse& callback));
  MOCK_METHOD3(NV_GlobalWriteLockSync,
               TPM_RC(const TPMI_RH_PROVISION& auth_handle,
                      const std::string& auth_handle_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD8(NV_Read,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const UINT16& size,
                    const UINT16& offset,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_ReadResponse& callback));
  MOCK_METHOD8(NV_ReadSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const UINT16& size,
                      const UINT16& offset,
                      TPM2B_MAX_NV_BUFFER* data,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD6(NV_ReadLock,
               void(const TPMI_RH_NV_AUTH& auth_handle,
                    const std::string& auth_handle_name,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_ReadLockResponse& callback));
  MOCK_METHOD5(NV_ReadLockSync,
               TPM_RC(const TPMI_RH_NV_AUTH& auth_handle,
                      const std::string& auth_handle_name,
                      const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      AuthorizationDelegate* authorization_delegate));
  MOCK_METHOD5(NV_ChangeAuth,
               void(const TPMI_RH_NV_INDEX& nv_index,
                    const std::string& nv_index_name,
                    const TPM2B_AUTH& new_auth,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_ChangeAuthResponse& callback));
  MOCK_METHOD4(NV_ChangeAuthSync,
               TPM_RC(const TPMI_RH_NV_INDEX& nv_index,
                      const std::string& nv_index_name,
                      const TPM2B_AUTH& new_auth,
                      AuthorizationDelegate* authorization_delegate));
  // Too many args to mock, forward to *Short version.
  void NV_Certify(const TPMI_DH_OBJECT& sign_handle,
                  const std::string& sign_handle_name,
                  const TPMI_RH_NV_AUTH& auth_handle,
                  const std::string& auth_handle_name,
                  const TPMI_RH_NV_INDEX& nv_index,
                  const std::string& nv_index_name,
                  const TPM2B_DATA& qualifying_data,
                  const TPMT_SIG_SCHEME& in_scheme,
                  const UINT16& size,
                  const UINT16& offset,
                  AuthorizationDelegate* authorization_delegate,
                  const NV_CertifyResponse& callback) override;
  MOCK_METHOD9(NV_CertifyShort,
               void(const TPMI_DH_OBJECT& sign_handle,
                    const TPMI_RH_NV_AUTH& auth_handle,
                    const TPMI_RH_NV_INDEX& nv_index,
                    const TPM2B_DATA& qualifying_data,
                    const TPMT_SIG_SCHEME& in_scheme,
                    const UINT16& size,
                    const UINT16& offset,
                    AuthorizationDelegate* authorization_delegate,
                    const NV_CertifyResponse& callback));
  // Too many args to mock, forward to *Short version.
  TPM_RC NV_CertifySync(const TPMI_DH_OBJECT& sign_handle,
                        const std::string& sign_handle_name,
                        const TPMI_RH_NV_AUTH& auth_handle,
                        const std::string& auth_handle_name,
                        const TPMI_RH_NV_INDEX& nv_index,
                        const std::string& nv_index_name,
                        const TPM2B_DATA& qualifying_data,
                        const TPMT_SIG_SCHEME& in_scheme,
                        const UINT16& size,
                        const UINT16& offset,
                        TPM2B_ATTEST* certify_info,
                        TPMT_SIGNATURE* signature,
                        AuthorizationDelegate* authorization_delegate) override;
  MOCK_METHOD10(NV_CertifySyncShort,
                TPM_RC(const TPMI_DH_OBJECT& sign_handle,
                       const TPMI_RH_NV_AUTH& auth_handle,
                       const TPMI_RH_NV_INDEX& nv_index,
                       const TPM2B_DATA& qualifying_data,
                       const TPMT_SIG_SCHEME& in_scheme,
                       const UINT16& size,
                       const UINT16& offset,
                       TPM2B_ATTEST* certify_info,
                       TPMT_SIGNATURE* signature,
                       AuthorizationDelegate* authorization_delegate));
};

}  // namespace trunks

#endif  // TRUNKS_MOCK_TPM_H_