aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/tpm
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/prov/tpm')
-rw-r--r--src/lib/prov/tpm/tpm.cpp10
-rw-r--r--src/lib/prov/tpm/tpm.h30
2 files changed, 23 insertions, 17 deletions
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<uint8_t>& 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<BYTE*>(reinterpret_cast<const BYTE*>(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> public_key() const;
+
+ std::vector<uint8_t> 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<std::string> 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<byte> x509_subject_public_key() const;
+ AlgorithmIdentifier algorithm_identifier() const override;
- secure_vector<byte> pkcs8_private_key() const; // not implemented
+ std::vector<byte> x509_subject_public_key() const override;
- std::unique_ptr<Public_Key> public_key() const;
+ secure_vector<byte> pkcs8_private_key() const override;
bool check_key(RandomNumberGenerator& rng, bool) const override;
- std::string algo_name() const { return "RSA"; } // ???
-
- std::vector<uint8_t> 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;