From eb86549ab43744103c901d56e4f5ff4d0c6e9b64 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 9 Mar 2016 08:28:08 -0500 Subject: Trivial warning fixes --- src/lib/prov/tpm/tpm.cpp | 10 ++++++---- src/lib/prov/tpm/tpm.h | 30 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src/lib/prov') diff --git a/src/lib/prov/tpm/tpm.cpp b/src/lib/prov/tpm/tpm.cpp index 9a29be395..c0b265b98 100644 --- a/src/lib/prov/tpm/tpm.cpp +++ b/src/lib/prov/tpm/tpm.cpp @@ -56,13 +56,14 @@ TSS_FLAG bit_flag(size_t bits) } } +#if 0 bool is_srk_uuid(const UUID& uuid) { static const byte srk[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; const std::vector& b = uuid.binary_value(); return (b.size() == 16 && same_mem(b.data(), srk, 16)); } - +#endif #define TSPI_CHECK_SUCCESS(expr) do { \ TSS_RESULT res = expr; \ @@ -90,10 +91,11 @@ void set_policy_secret(TSS_HPOLICY policy, const char* secret) { if(secret) { + BYTE* as_b = const_cast(reinterpret_cast(secret)); TSPI_CHECK_SUCCESS(::Tspi_Policy_SetSecret(policy, - TSS_SECRET_MODE_PLAIN, - std::strlen(secret), - (BYTE*)secret)); + TSS_SECRET_MODE_PLAIN, + std::strlen(secret), + as_b)); } else { diff --git a/src/lib/prov/tpm/tpm.h b/src/lib/prov/tpm/tpm.h index 7df232be3..4a9dcd3c6 100644 --- a/src/lib/prov/tpm/tpm.h +++ b/src/lib/prov/tpm/tpm.h @@ -138,32 +138,36 @@ class BOTAN_DLL TPM_PrivateKey : public Private_Key */ std::string register_key(TPM_Storage_Type storage_type); + /** + * Returns a copy of the public key + */ + std::unique_ptr public_key() const; + + std::vector export_blob() const; + + TPM_Context& ctx() const { return m_ctx; } + + TSS_HKEY handle() const { return m_key; } + /* * Returns the list of all keys (in URL format) registered with the system */ static std::vector registered_keys(TPM_Context& ctx); - size_t estimated_strength() const; - - size_t max_input_bits() const; + size_t estimated_strength() const override; - AlgorithmIdentifier algorithm_identifier() const; + size_t max_input_bits() const override; - std::vector x509_subject_public_key() const; + AlgorithmIdentifier algorithm_identifier() const override; - secure_vector pkcs8_private_key() const; // not implemented + std::vector x509_subject_public_key() const override; - std::unique_ptr public_key() const; + secure_vector pkcs8_private_key() const override; bool check_key(RandomNumberGenerator& rng, bool) const override; - std::string algo_name() const { return "RSA"; } // ??? - - std::vector export_blob() const; - - TPM_Context& ctx() const { return m_ctx; } + std::string algo_name() const override { return "RSA"; } // ??? - TSS_HKEY handle() const { return m_key; } private: BigInt get_n() const; BigInt get_e() const; -- cgit v1.2.3