aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/prov')
-rw-r--r--src/lib/prov/openssl/openssl_block.cpp10
-rw-r--r--src/lib/prov/openssl/openssl_ec.cpp26
-rw-r--r--src/lib/prov/openssl/openssl_hash.cpp4
-rw-r--r--src/lib/prov/openssl/openssl_rc4.cpp10
-rw-r--r--src/lib/prov/openssl/openssl_rsa.cpp40
-rw-r--r--src/lib/prov/pkcs11/p11.h52
-rw-r--r--src/lib/prov/pkcs11/p11_ecc_key.cpp22
-rw-r--r--src/lib/prov/pkcs11/p11_ecc_key.h26
-rw-r--r--src/lib/prov/pkcs11/p11_ecdh.cpp8
-rw-r--r--src/lib/prov/pkcs11/p11_ecdh.h6
-rw-r--r--src/lib/prov/pkcs11/p11_ecdsa.cpp20
-rw-r--r--src/lib/prov/pkcs11/p11_ecdsa.h4
-rw-r--r--src/lib/prov/pkcs11/p11_mechanism.h8
-rw-r--r--src/lib/prov/pkcs11/p11_object.cpp28
-rw-r--r--src/lib/prov/pkcs11/p11_object.h50
-rw-r--r--src/lib/prov/pkcs11/p11_randomgenerator.cpp6
-rw-r--r--src/lib/prov/pkcs11/p11_randomgenerator.h4
-rw-r--r--src/lib/prov/pkcs11/p11_rsa.cpp32
-rw-r--r--src/lib/prov/pkcs11/p11_rsa.h2
-rw-r--r--src/lib/prov/pkcs11/p11_x509.cpp2
-rw-r--r--src/lib/prov/pkcs11/p11_x509.h20
-rw-r--r--src/lib/prov/tpm/tpm.cpp12
-rw-r--r--src/lib/prov/tpm/tpm.h8
23 files changed, 200 insertions, 200 deletions
diff --git a/src/lib/prov/openssl/openssl_block.cpp b/src/lib/prov/openssl/openssl_block.cpp
index cb98be70d..842730af7 100644
--- a/src/lib/prov/openssl/openssl_block.cpp
+++ b/src/lib/prov/openssl/openssl_block.cpp
@@ -34,19 +34,19 @@ class OpenSSL_BlockCipher : public BlockCipher
Key_Length_Specification key_spec() const override { return m_cipher_key_spec; }
- void encrypt_n(const byte in[], byte out[], size_t blocks) const override
+ void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
{
int out_len = 0;
EVP_EncryptUpdate(&m_encrypt, out, &out_len, in, blocks * m_block_sz);
}
- void decrypt_n(const byte in[], byte out[], size_t blocks) const override
+ void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override
{
int out_len = 0;
EVP_DecryptUpdate(&m_decrypt, out, &out_len, in, blocks * m_block_sz);
}
- void key_schedule(const byte key[], size_t key_len) override;
+ void key_schedule(const uint8_t key[], size_t key_len) override;
size_t m_block_sz;
Key_Length_Specification m_cipher_key_spec;
@@ -104,9 +104,9 @@ OpenSSL_BlockCipher::~OpenSSL_BlockCipher()
/*
* Set the key
*/
-void OpenSSL_BlockCipher::key_schedule(const byte key[], size_t length)
+void OpenSSL_BlockCipher::key_schedule(const uint8_t key[], size_t length)
{
- secure_vector<byte> full_key(key, key + length);
+ secure_vector<uint8_t> full_key(key, key + length);
if(m_cipher_name == "TripleDES" && length == 16)
{
diff --git a/src/lib/prov/openssl/openssl_ec.cpp b/src/lib/prov/openssl/openssl_ec.cpp
index 5fe7865a1..84f3a1ca0 100644
--- a/src/lib/prov/openssl/openssl_ec.cpp
+++ b/src/lib/prov/openssl/openssl_ec.cpp
@@ -43,7 +43,7 @@ namespace Botan {
namespace {
-secure_vector<byte> PKCS8_for_openssl(const EC_PrivateKey& ec)
+secure_vector<uint8_t> PKCS8_for_openssl(const EC_PrivateKey& ec)
{
const PointGFp& pub_key = ec.public_point();
const BigInt& priv_key = ec.private_value();
@@ -123,8 +123,8 @@ class OpenSSL_ECDSA_Verification_Operation : public PK_Ops::Verification_with_EM
::EC_KEY_set_group(m_ossl_ec.get(), grp.get());
- const secure_vector<byte> enc = EC2OSP(ecdsa.public_point(), PointGFp::UNCOMPRESSED);
- const byte* enc_ptr = enc.data();
+ const secure_vector<uint8_t> enc = EC2OSP(ecdsa.public_point(), PointGFp::UNCOMPRESSED);
+ const uint8_t* enc_ptr = enc.data();
EC_KEY* key_ptr = m_ossl_ec.get();
if(!::o2i_ECPublicKey(&key_ptr, &enc_ptr, enc.size()))
throw OpenSSL_Error("o2i_ECPublicKey");
@@ -137,8 +137,8 @@ class OpenSSL_ECDSA_Verification_Operation : public PK_Ops::Verification_with_EM
bool with_recovery() const override { return false; }
- bool verify(const byte msg[], size_t msg_len,
- const byte sig_bytes[], size_t sig_len) override
+ bool verify(const uint8_t msg[], size_t msg_len,
+ const uint8_t sig_bytes[], size_t sig_len) override
{
const size_t order_bytes = (m_order_bits + 7) / 8;
if(sig_len != 2 * order_bytes)
@@ -168,8 +168,8 @@ class OpenSSL_ECDSA_Signing_Operation : public PK_Ops::Signature_with_EMSA
PK_Ops::Signature_with_EMSA(emsa),
m_ossl_ec(nullptr, ::EC_KEY_free)
{
- const secure_vector<byte> der = PKCS8_for_openssl(ecdsa);
- const byte* der_ptr = der.data();
+ const secure_vector<uint8_t> der = PKCS8_for_openssl(ecdsa);
+ const uint8_t* der_ptr = der.data();
m_ossl_ec.reset(d2i_ECPrivateKey(nullptr, &der_ptr, der.size()));
if(!m_ossl_ec)
throw OpenSSL_Error("d2i_ECPrivateKey");
@@ -178,7 +178,7 @@ class OpenSSL_ECDSA_Signing_Operation : public PK_Ops::Signature_with_EMSA
m_order_bits = ::EC_GROUP_get_degree(group);
}
- secure_vector<byte> raw_sign(const byte msg[], size_t msg_len,
+ secure_vector<uint8_t> raw_sign(const uint8_t msg[], size_t msg_len,
RandomNumberGenerator&) override
{
std::unique_ptr<ECDSA_SIG, std::function<void (ECDSA_SIG*)>> sig(nullptr, ECDSA_SIG_free);
@@ -190,7 +190,7 @@ class OpenSSL_ECDSA_Signing_Operation : public PK_Ops::Signature_with_EMSA
const size_t order_bytes = (m_order_bits + 7) / 8;
const size_t r_bytes = BN_num_bytes(sig->r);
const size_t s_bytes = BN_num_bytes(sig->s);
- secure_vector<byte> sigval(2*order_bytes);
+ secure_vector<uint8_t> sigval(2*order_bytes);
BN_bn2bin(sig->r, &sigval[order_bytes - r_bytes]);
BN_bn2bin(sig->s, &sigval[2*order_bytes - s_bytes]);
return sigval;
@@ -240,18 +240,18 @@ class OpenSSL_ECDH_KA_Operation : public PK_Ops::Key_Agreement_with_KDF
OpenSSL_ECDH_KA_Operation(const ECDH_PrivateKey& ecdh, const std::string& kdf) :
PK_Ops::Key_Agreement_with_KDF(kdf), m_ossl_ec(::EC_KEY_new(), ::EC_KEY_free)
{
- const secure_vector<byte> der = PKCS8_for_openssl(ecdh);
- const byte* der_ptr = der.data();
+ const secure_vector<uint8_t> der = PKCS8_for_openssl(ecdh);
+ const uint8_t* der_ptr = der.data();
m_ossl_ec.reset(d2i_ECPrivateKey(nullptr, &der_ptr, der.size()));
if(!m_ossl_ec)
throw OpenSSL_Error("d2i_ECPrivateKey");
}
- secure_vector<byte> raw_agree(const byte w[], size_t w_len) override
+ secure_vector<uint8_t> raw_agree(const uint8_t w[], size_t w_len) override
{
const EC_GROUP* group = ::EC_KEY_get0_group(m_ossl_ec.get());
const size_t out_len = (::EC_GROUP_get_degree(group) + 7) / 8;
- secure_vector<byte> out(out_len);
+ secure_vector<uint8_t> out(out_len);
EC_POINT* pub_key = ::EC_POINT_new(group);
if(!pub_key)
diff --git a/src/lib/prov/openssl/openssl_hash.cpp b/src/lib/prov/openssl/openssl_hash.cpp
index 8e36866a1..19a12d938 100644
--- a/src/lib/prov/openssl/openssl_hash.cpp
+++ b/src/lib/prov/openssl/openssl_hash.cpp
@@ -54,12 +54,12 @@ class OpenSSL_HashFunction : public HashFunction
}
private:
- void add_data(const byte input[], size_t length) override
+ void add_data(const uint8_t input[], size_t length) override
{
EVP_DigestUpdate(&m_md, input, length);
}
- void final_result(byte output[]) override
+ void final_result(uint8_t output[]) override
{
EVP_DigestFinal_ex(&m_md, output, nullptr);
const EVP_MD* algo = EVP_MD_CTX_md(&m_md);
diff --git a/src/lib/prov/openssl/openssl_rc4.cpp b/src/lib/prov/openssl/openssl_rc4.cpp
index c8ba32235..9cca7fdd1 100644
--- a/src/lib/prov/openssl/openssl_rc4.cpp
+++ b/src/lib/prov/openssl/openssl_rc4.cpp
@@ -48,26 +48,26 @@ class OpenSSL_RC4 : public StreamCipher
explicit OpenSSL_RC4(size_t skip = 0) : m_skip(skip) { clear(); }
~OpenSSL_RC4() { clear(); }
- void set_iv(const byte*, size_t len) override
+ void set_iv(const uint8_t*, size_t len) override
{
if(len > 0)
throw Exception("RC4 does not support an IV");
}
- void seek(u64bit) override
+ void seek(uint64_t) override
{
throw Exception("RC4 does not support seeking");
}
private:
- void cipher(const byte in[], byte out[], size_t length) override
+ void cipher(const uint8_t in[], uint8_t out[], size_t length) override
{
::RC4(&m_rc4, length, in, out);
}
- void key_schedule(const byte key[], size_t length) override
+ void key_schedule(const uint8_t key[], size_t length) override
{
::RC4_set_key(&m_rc4, length, key);
- byte d = 0;
+ uint8_t d = 0;
for(size_t i = 0; i != m_skip; ++i)
::RC4(&m_rc4, 1, &d, &d);
}
diff --git a/src/lib/prov/openssl/openssl_rsa.cpp b/src/lib/prov/openssl/openssl_rsa.cpp
index aef9c95d8..e7a562cf5 100644
--- a/src/lib/prov/openssl/openssl_rsa.cpp
+++ b/src/lib/prov/openssl/openssl_rsa.cpp
@@ -44,8 +44,8 @@ class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
OpenSSL_RSA_Encryption_Operation(const RSA_PublicKey& rsa, int pad, size_t pad_overhead) :
m_openssl_rsa(nullptr, ::RSA_free), m_padding(pad)
{
- const std::vector<byte> der = rsa.public_key_bits();
- const byte* der_ptr = der.data();
+ const std::vector<uint8_t> der = rsa.public_key_bits();
+ const uint8_t* der_ptr = der.data();
m_openssl_rsa.reset(::d2i_RSAPublicKey(nullptr, &der_ptr, der.size()));
if(!m_openssl_rsa)
throw OpenSSL_Error("d2i_RSAPublicKey");
@@ -55,7 +55,7 @@ class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
size_t max_input_bits() const override { return m_bits; };
- secure_vector<byte> encrypt(const byte msg[], size_t msg_len,
+ secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len,
RandomNumberGenerator&) override
{
const size_t mod_sz = n_size();
@@ -63,9 +63,9 @@ class OpenSSL_RSA_Encryption_Operation : public PK_Ops::Encryption
if(msg_len > mod_sz)
throw Invalid_Argument("Input too large for RSA key");
- secure_vector<byte> outbuf(mod_sz);
+ secure_vector<uint8_t> outbuf(mod_sz);
- secure_vector<byte> inbuf;
+ secure_vector<uint8_t> inbuf;
if(m_padding == RSA_NO_PADDING)
{
@@ -99,17 +99,17 @@ class OpenSSL_RSA_Decryption_Operation : public PK_Ops::Decryption
OpenSSL_RSA_Decryption_Operation(const RSA_PrivateKey& rsa, int pad) :
m_openssl_rsa(nullptr, ::RSA_free), m_padding(pad)
{
- const secure_vector<byte> der = rsa.private_key_bits();
- const byte* der_ptr = der.data();
+ const secure_vector<uint8_t> der = rsa.private_key_bits();
+ const uint8_t* der_ptr = der.data();
m_openssl_rsa.reset(d2i_RSAPrivateKey(nullptr, &der_ptr, der.size()));
if(!m_openssl_rsa)
throw OpenSSL_Error("d2i_RSAPrivateKey");
}
- secure_vector<byte> decrypt(byte& valid_mask,
- const byte msg[], size_t msg_len) override
+ secure_vector<uint8_t> decrypt(uint8_t& valid_mask,
+ const uint8_t msg[], size_t msg_len) override
{
- secure_vector<byte> buf(::RSA_size(m_openssl_rsa.get()));
+ secure_vector<uint8_t> buf(::RSA_size(m_openssl_rsa.get()));
int rc = ::RSA_private_decrypt(msg_len, msg, buf.data(), m_openssl_rsa.get(), m_padding);
if(rc < 0 || static_cast<size_t>(rc) > buf.size())
{
@@ -143,8 +143,8 @@ class OpenSSL_RSA_Verification_Operation : public PK_Ops::Verification_with_EMSA
PK_Ops::Verification_with_EMSA(emsa),
m_openssl_rsa(nullptr, ::RSA_free)
{
- const std::vector<byte> der = rsa.public_key_bits();
- const byte* der_ptr = der.data();
+ const std::vector<uint8_t> der = rsa.public_key_bits();
+ const uint8_t* der_ptr = der.data();
m_openssl_rsa.reset(::d2i_RSAPublicKey(nullptr, &der_ptr, der.size()));
}
@@ -152,17 +152,17 @@ class OpenSSL_RSA_Verification_Operation : public PK_Ops::Verification_with_EMSA
bool with_recovery() const override { return true; }
- secure_vector<byte> verify_mr(const byte msg[], size_t msg_len) override
+ secure_vector<uint8_t> verify_mr(const uint8_t msg[], size_t msg_len) override
{
const size_t mod_sz = ::RSA_size(m_openssl_rsa.get());
if(msg_len > mod_sz)
throw Invalid_Argument("OpenSSL RSA verify input too large");
- secure_vector<byte> inbuf(mod_sz);
+ secure_vector<uint8_t> inbuf(mod_sz);
copy_mem(&inbuf[mod_sz - msg_len], msg, msg_len);
- secure_vector<byte> outbuf(mod_sz);
+ secure_vector<uint8_t> outbuf(mod_sz);
int rc = ::RSA_public_decrypt(inbuf.size(), inbuf.data(), outbuf.data(),
m_openssl_rsa.get(), RSA_NO_PADDING);
@@ -183,14 +183,14 @@ class OpenSSL_RSA_Signing_Operation : public PK_Ops::Signature_with_EMSA
PK_Ops::Signature_with_EMSA(emsa),
m_openssl_rsa(nullptr, ::RSA_free)
{
- const secure_vector<byte> der = rsa.private_key_bits();
- const byte* der_ptr = der.data();
+ const secure_vector<uint8_t> der = rsa.private_key_bits();
+ const uint8_t* der_ptr = der.data();
m_openssl_rsa.reset(d2i_RSAPrivateKey(nullptr, &der_ptr, der.size()));
if(!m_openssl_rsa)
throw OpenSSL_Error("d2i_RSAPrivateKey");
}
- secure_vector<byte> raw_sign(const byte msg[], size_t msg_len,
+ secure_vector<uint8_t> raw_sign(const uint8_t msg[], size_t msg_len,
RandomNumberGenerator&) override
{
const size_t mod_sz = ::RSA_size(m_openssl_rsa.get());
@@ -198,10 +198,10 @@ class OpenSSL_RSA_Signing_Operation : public PK_Ops::Signature_with_EMSA
if(msg_len > mod_sz)
throw Invalid_Argument("OpenSSL RSA sign input too large");
- secure_vector<byte> inbuf(mod_sz);
+ secure_vector<uint8_t> inbuf(mod_sz);
copy_mem(&inbuf[mod_sz - msg_len], msg, msg_len);
- secure_vector<byte> outbuf(mod_sz);
+ secure_vector<uint8_t> outbuf(mod_sz);
int rc = ::RSA_private_encrypt(inbuf.size(), inbuf.data(), outbuf.data(),
m_openssl_rsa.get(), RSA_NO_PADDING);
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h
index 72abcd611..efc887e11 100644
--- a/src/lib/prov/pkcs11/p11.h
+++ b/src/lib/prov/pkcs11/p11.h
@@ -58,7 +58,7 @@ static_assert(CRYPTOKI_VERSION_MAJOR == 2 && CRYPTOKI_VERSION_MINOR == 40,
namespace Botan {
namespace PKCS11 {
-using secure_string = secure_vector<byte>;
+using secure_string = secure_vector<uint8_t>;
enum class AttributeType : CK_ATTRIBUTE_TYPE
{
@@ -1149,7 +1149,7 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_InitToken(SlotId slot_id,
- const std::vector<byte, TAlloc>& so_pin,
+ const std::vector<uint8_t, TAlloc>& so_pin,
const std::string& label,
ReturnValue* return_value = ThrowException) const
{
@@ -1159,7 +1159,7 @@ class BOTAN_DLL LowLevel
padded_label.insert(padded_label.end(), 32 - label.size(), ' ');
}
- return C_InitToken(slot_id, reinterpret_cast< Utf8Char* >(const_cast< byte* >(so_pin.data())),
+ return C_InitToken(slot_id, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(so_pin.data())),
so_pin.size(), reinterpret_cast< Utf8Char* >(const_cast< char* >(padded_label.c_str())), return_value);
}
@@ -1201,10 +1201,10 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_InitPIN(SessionHandle session,
- const std::vector<byte, TAlloc>& pin,
+ const std::vector<uint8_t, TAlloc>& pin,
ReturnValue* return_value = ThrowException) const
{
- return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< byte* >(pin.data())), pin.size(), return_value);
+ return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(), return_value);
}
/**
@@ -1250,13 +1250,13 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_SetPIN(SessionHandle session,
- const std::vector<byte, TAlloc>& old_pin,
- const std::vector<byte, TAlloc>& new_pin,
+ const std::vector<uint8_t, TAlloc>& old_pin,
+ const std::vector<uint8_t, TAlloc>& new_pin,
ReturnValue* return_value = ThrowException) const
{
return C_SetPIN(session,
- reinterpret_cast< Utf8Char* >(const_cast< byte* >(old_pin.data())), old_pin.size(),
- reinterpret_cast< Utf8Char* >(const_cast< byte* >(new_pin.data())), new_pin.size(),
+ reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(old_pin.data())), old_pin.size(),
+ reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(new_pin.data())), new_pin.size(),
return_value);
}
@@ -1423,10 +1423,10 @@ class BOTAN_DLL LowLevel
template<typename TAlloc>
bool C_Login(SessionHandle session,
UserType user_type,
- const std::vector<byte, TAlloc>& pin,
+ const std::vector<uint8_t, TAlloc>& pin,
ReturnValue* return_value = ThrowException) const
{
- return C_Login(session, user_type, reinterpret_cast< Utf8Char* >(const_cast< byte* >(pin.data())), pin.size(),
+ return C_Login(session, user_type, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(),
return_value);
}
@@ -1576,7 +1576,7 @@ class BOTAN_DLL LowLevel
template<typename TAlloc>
bool C_GetAttributeValue(SessionHandle session,
ObjectHandle object,
- std::map<AttributeType, std::vector<byte, TAlloc>>& attribute_values,
+ std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
ReturnValue* return_value = ThrowException) const
{
std::vector<Attribute> getter_template;
@@ -1599,7 +1599,7 @@ class BOTAN_DLL LowLevel
{
entry.second.clear();
entry.second.resize(getter_template.at(i).ulValueLen);
- getter_template.at(i).pValue = const_cast< byte* >(entry.second.data());
+ getter_template.at(i).pValue = const_cast< uint8_t* >(entry.second.data());
i++;
}
@@ -1651,7 +1651,7 @@ class BOTAN_DLL LowLevel
template<typename TAlloc>
bool C_SetAttributeValue(SessionHandle session,
ObjectHandle object,
- std::map<AttributeType, std::vector<byte, TAlloc>>& attribute_values,
+ std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values,
ReturnValue* return_value = ThrowException) const
{
std::vector<Attribute> setter_template;
@@ -1788,8 +1788,8 @@ class BOTAN_DLL LowLevel
*/
template<typename TAllocA, typename TAllocB>
bool C_Encrypt(SessionHandle session,
- const std::vector<byte, TAllocA>& plaintext_data,
- std::vector<byte, TAllocB>& encrypted_data,
+ const std::vector<uint8_t, TAllocA>& plaintext_data,
+ std::vector<uint8_t, TAllocB>& encrypted_data,
ReturnValue* return_value = ThrowException) const
{
Ulong encrypted_size = 0;
@@ -1915,8 +1915,8 @@ class BOTAN_DLL LowLevel
*/
template<typename TAllocA, typename TAllocB>
bool C_Decrypt(SessionHandle session,
- const std::vector<byte, TAllocA>& encrypted_data,
- std::vector<byte, TAllocB>& decrypted_data,
+ const std::vector<uint8_t, TAllocA>& encrypted_data,
+ std::vector<uint8_t, TAllocB>& decrypted_data,
ReturnValue* return_value = ThrowException) const
{
Ulong decrypted_size = 0;
@@ -2064,7 +2064,7 @@ class BOTAN_DLL LowLevel
* C_DigestFinal finishes a multiple-part message-digesting operation.
* @param session the session's handle
* @param digest_ptr gets the message digest
- * @param digest_len_ptr gets byte count of digest
+ * @param digest_len_ptr gets uint8_t count of digest
* @param return_value default value (`ThrowException`): throw exception on error.
* if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown.
* At least the following PKCS#11 return values may be returned:
@@ -2147,8 +2147,8 @@ class BOTAN_DLL LowLevel
*/
template<typename TAllocA, typename TAllocB>
bool C_Sign(SessionHandle session,
- const std::vector<byte, TAllocA>& data,
- std::vector<byte, TAllocB>& signature,
+ const std::vector<uint8_t, TAllocA>& data,
+ std::vector<uint8_t, TAllocB>& signature,
ReturnValue* return_value = ThrowException) const
{
Ulong signature_size = 0;
@@ -2197,7 +2197,7 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_SignUpdate(SessionHandle session,
- const std::vector<byte, TAlloc>& part,
+ const std::vector<uint8_t, TAlloc>& part,
ReturnValue* return_value = ThrowException) const
{
return C_SignUpdate(session, const_cast<Byte*>(part.data()), part.size(), return_value);
@@ -2241,7 +2241,7 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_SignFinal(SessionHandle session,
- std::vector<byte, TAlloc>& signature,
+ std::vector<uint8_t, TAlloc>& signature,
ReturnValue* return_value = ThrowException) const
{
Ulong signature_size = 0;
@@ -2368,8 +2368,8 @@ class BOTAN_DLL LowLevel
*/
template<typename TAllocA, typename TAllocB>
bool C_Verify(SessionHandle session,
- const std::vector<byte, TAllocA>& data,
- std::vector<byte, TAllocB>& signature,
+ const std::vector<uint8_t, TAllocA>& data,
+ std::vector<uint8_t, TAllocB>& signature,
ReturnValue* return_value = ThrowException) const
{
return C_Verify(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), signature.size(), return_value);
@@ -2411,7 +2411,7 @@ class BOTAN_DLL LowLevel
*/
template<typename TAlloc>
bool C_VerifyUpdate(SessionHandle session,
- std::vector<byte, TAlloc> part,
+ std::vector<uint8_t, TAlloc> part,
ReturnValue* return_value = ThrowException) const
{
return C_VerifyUpdate(session, part.data(), part.size(), return_value);
diff --git a/src/lib/prov/pkcs11/p11_ecc_key.cpp b/src/lib/prov/pkcs11/p11_ecc_key.cpp
index 527daceaf..9366594a6 100644
--- a/src/lib/prov/pkcs11/p11_ecc_key.cpp
+++ b/src/lib/prov/pkcs11/p11_ecc_key.cpp
@@ -17,22 +17,22 @@ namespace Botan {
namespace PKCS11 {
namespace {
/// Converts a DER-encoded ANSI X9.62 ECPoint to PointGFp
-PointGFp decode_public_point(const secure_vector<byte>& ec_point_data, const CurveGFp& curve)
+PointGFp decode_public_point(const secure_vector<uint8_t>& ec_point_data, const CurveGFp& curve)
{
- secure_vector<byte> ec_point;
+ secure_vector<uint8_t> ec_point;
BER_Decoder(ec_point_data).decode(ec_point, OCTET_STRING);
return OS2ECP(ec_point, curve);
}
}
-EC_PublicKeyGenerationProperties::EC_PublicKeyGenerationProperties(const std::vector<byte>& ec_params)
+EC_PublicKeyGenerationProperties::EC_PublicKeyGenerationProperties(const std::vector<uint8_t>& ec_params)
: PublicKeyProperties(KeyType::Ec), m_ec_params(ec_params)
{
add_binary(AttributeType::EcParams, m_ec_params);
}
-EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<byte>& ec_params,
- const std::vector<byte>& ec_point)
+EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<uint8_t>& ec_params,
+ const std::vector<uint8_t>& ec_point)
: PublicKeyProperties(KeyType::Ec), m_ec_params(ec_params), m_ec_point(ec_point)
{
add_binary(AttributeType::EcParams, m_ec_params);
@@ -42,7 +42,7 @@ EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<byt
PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, ObjectHandle handle)
: Object(session, handle)
{
- secure_vector<byte> ec_parameters = get_attribute_value(AttributeType::EcParams);
+ secure_vector<uint8_t> ec_parameters = get_attribute_value(AttributeType::EcParams);
m_domain_params = EC_Group(unlock(ec_parameters));
m_public_key = decode_public_point(get_attribute_value(AttributeType::EcPoint), m_domain_params.get_curve());
m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
@@ -53,13 +53,13 @@ PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, const EC_PublicKeyImp
{
m_domain_params = EC_Group(props.ec_params());
- secure_vector<byte> ec_point;
+ secure_vector<uint8_t> ec_point;
BER_Decoder(props.ec_point()).decode(ec_point, OCTET_STRING);
m_public_key = OS2ECP(ec_point, m_domain_params.get_curve());
m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
}
-EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<byte>& ec_params, const BigInt& value)
+EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<uint8_t>& ec_params, const BigInt& value)
: PrivateKeyProperties(KeyType::Ec), m_ec_params(ec_params), m_value(value)
{
add_binary(AttributeType::EcParams, m_ec_params);
@@ -69,7 +69,7 @@ EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<b
PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, ObjectHandle handle)
: Object(session, handle), m_domain_params(), m_public_key()
{
- secure_vector<byte> ec_parameters = get_attribute_value(AttributeType::EcParams);
+ secure_vector<uint8_t> ec_parameters = get_attribute_value(AttributeType::EcParams);
m_domain_params = EC_Group(unlock(ec_parameters));
}
@@ -79,7 +79,7 @@ PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const EC_PrivateKey
m_domain_params = EC_Group(props.ec_params());
}
-PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<byte>& ec_params,
+PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params,
const EC_PrivateKeyGenerationProperties& props)
: Object(session)
{
@@ -106,7 +106,7 @@ size_t PKCS11_EC_PrivateKey::key_length() const
return m_domain_params.get_order().bits();
}
-std::vector<byte> PKCS11_EC_PrivateKey::public_key_bits() const
+std::vector<uint8_t> PKCS11_EC_PrivateKey::public_key_bits() const
{
return unlock(EC2OSP(public_point(), PointGFp::COMPRESSED));
}
diff --git a/src/lib/prov/pkcs11/p11_ecc_key.h b/src/lib/prov/pkcs11/p11_ecc_key.h
index 69e612c33..6762d448e 100644
--- a/src/lib/prov/pkcs11/p11_ecc_key.h
+++ b/src/lib/prov/pkcs11/p11_ecc_key.h
@@ -30,16 +30,16 @@ class BOTAN_DLL EC_PublicKeyGenerationProperties final : public PublicKeyPropert
{
public:
/// @param ec_params DER-encoding of an ANSI X9.62 Parameters value
- EC_PublicKeyGenerationProperties(const std::vector<byte>& ec_params);
+ EC_PublicKeyGenerationProperties(const std::vector<uint8_t>& ec_params);
/// @return the DER-encoding of the ec parameters according to ANSI X9.62
- inline const std::vector<byte>& ec_params() const
+ inline const std::vector<uint8_t>& ec_params() const
{
return m_ec_params;
}
private:
- const std::vector<byte> m_ec_params;
+ const std::vector<uint8_t> m_ec_params;
};
/// Properties for importing a PKCS#11 EC public key
@@ -50,23 +50,23 @@ class BOTAN_DLL EC_PublicKeyImportProperties final : public PublicKeyProperties
* @param ec_params DER-encoding of an ANSI X9.62 Parameters value
* @param ec_point DER-encoding of ANSI X9.62 ECPoint value Q
*/
- EC_PublicKeyImportProperties(const std::vector<byte>& ec_params, const std::vector<byte>& ec_point);
+ EC_PublicKeyImportProperties(const std::vector<uint8_t>& ec_params, const std::vector<uint8_t>& ec_point);
/// @return the DER-encoding of the ec parameters according to ANSI X9.62
- inline const std::vector<byte>& ec_params() const
+ inline const std::vector<uint8_t>& ec_params() const
{
return m_ec_params;
}
/// @return the DER-encoding of the ec public point according to ANSI X9.62
- inline const std::vector<byte>& ec_point() const
+ inline const std::vector<uint8_t>& ec_point() const
{
return m_ec_point;
}
private:
- const std::vector<byte> m_ec_params;
- const std::vector<byte> m_ec_point;
+ const std::vector<uint8_t> m_ec_params;
+ const std::vector<uint8_t> m_ec_point;
};
/// Represents a PKCS#11 EC public key
@@ -108,10 +108,10 @@ class BOTAN_DLL EC_PrivateKeyImportProperties final : public PrivateKeyPropertie
* @param ec_params DER-encoding of an ANSI X9.62 Parameters value
* @param value ANSI X9.62 private value d
*/
- EC_PrivateKeyImportProperties(const std::vector<byte>& ec_params, const BigInt& value);
+ EC_PrivateKeyImportProperties(const std::vector<uint8_t>& ec_params, const BigInt& value);
/// @return the DER-encoding of the ec parameters according to ANSI X9.62
- inline const std::vector<byte>& ec_params() const
+ inline const std::vector<uint8_t>& ec_params() const
{
return m_ec_params;
}
@@ -123,7 +123,7 @@ class BOTAN_DLL EC_PrivateKeyImportProperties final : public PrivateKeyPropertie
}
private:
- const std::vector<byte> m_ec_params;
+ const std::vector<uint8_t> m_ec_params;
const BigInt m_value;
};
@@ -157,7 +157,7 @@ class BOTAN_DLL PKCS11_EC_PrivateKey : public virtual Private_Key,
* @param props the attributes of the private key
* @note no persistent public key object will be created
*/
- PKCS11_EC_PrivateKey(Session& session, const std::vector<byte>& ec_params,
+ PKCS11_EC_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params,
const EC_PrivateKeyGenerationProperties& props);
/// @returns the domain of the EC private key
@@ -201,7 +201,7 @@ class BOTAN_DLL PKCS11_EC_PrivateKey : public virtual Private_Key,
// Private_Key methods
- std::vector<byte> public_key_bits() const override;
+ std::vector<uint8_t> public_key_bits() const override;
std::size_t key_length() const override;
diff --git a/src/lib/prov/pkcs11/p11_ecdh.cpp b/src/lib/prov/pkcs11/p11_ecdh.cpp
index 50aa964d5..088b93894 100644
--- a/src/lib/prov/pkcs11/p11_ecdh.cpp
+++ b/src/lib/prov/pkcs11/p11_ecdh.cpp
@@ -33,7 +33,7 @@ ECDH_PrivateKey PKCS11_ECDH_PrivateKey::export_key() const
return ECDH_PrivateKey(rng, domain(), BigInt::decode(priv_key));
}
-secure_vector<byte> PKCS11_ECDH_PrivateKey::private_key_bits() const
+secure_vector<uint8_t> PKCS11_ECDH_PrivateKey::private_key_bits() const
{
return export_key().private_key_bits();
}
@@ -49,10 +49,10 @@ class PKCS11_ECDH_KA_Operation : public PK_Ops::Key_Agreement
/// The encoding in V2.20 was not specified and resulted in different implementations choosing different encodings.
/// Applications relying only on a V2.20 encoding (e.g. the DER variant) other than the one specified now (raw) may not work with all V2.30 compliant tokens.
- secure_vector<byte> agree(size_t key_len, const byte other_key[], size_t other_key_len, const byte salt[],
+ secure_vector<uint8_t> agree(size_t key_len, const uint8_t other_key[], size_t other_key_len, const uint8_t salt[],
size_t salt_len) override
{
- std::vector<byte> der_encoded_other_key;
+ std::vector<uint8_t> der_encoded_other_key;
if(m_key.point_encoding() == PublicPointEncoding::Der)
{
der_encoded_other_key = DER_Encoder().encode(other_key, other_key_len, OCTET_STRING).get_contents_unlocked();
@@ -79,7 +79,7 @@ class PKCS11_ECDH_KA_Operation : public PK_Ops::Key_Agreement
attributes.count(), &secret_handle);
Object secret_object(m_key.session(), secret_handle);
- secure_vector<byte> secret = secret_object.get_attribute_value(AttributeType::Value);
+ secure_vector<uint8_t> secret = secret_object.get_attribute_value(AttributeType::Value);
if(secret.size() < key_len)
{
throw PKCS11_Error("ECDH key derivation secret length is too short");
diff --git a/src/lib/prov/pkcs11/p11_ecdh.h b/src/lib/prov/pkcs11/p11_ecdh.h
index 7fc21ad46..c8e4017ba 100644
--- a/src/lib/prov/pkcs11/p11_ecdh.h
+++ b/src/lib/prov/pkcs11/p11_ecdh.h
@@ -83,7 +83,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK
* @param props the attributes of the private key
* @note no persistent public key object will be created
*/
- PKCS11_ECDH_PrivateKey(Session& session, const std::vector<byte>& ec_params,
+ PKCS11_ECDH_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params,
const EC_PrivateKeyGenerationProperties& props)
: PKCS11_EC_PrivateKey(session, ec_params, props)
{}
@@ -93,7 +93,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK
return "ECDH";
}
- inline std::vector<byte> public_value() const override
+ inline std::vector<uint8_t> public_value() const override
{
return unlock(EC2OSP(public_point(), PointGFp::UNCOMPRESSED));
}
@@ -101,7 +101,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK
/// @return the exported ECDH private key
ECDH_PrivateKey export_key() const;
- secure_vector<byte> private_key_bits() const override;
+ secure_vector<uint8_t> private_key_bits() const override;
std::unique_ptr<PK_Ops::Key_Agreement>
create_key_agreement_op(RandomNumberGenerator& rng,
diff --git a/src/lib/prov/pkcs11/p11_ecdsa.cpp b/src/lib/prov/pkcs11/p11_ecdsa.cpp
index cbdd4d007..5be66caaf 100644
--- a/src/lib/prov/pkcs11/p11_ecdsa.cpp
+++ b/src/lib/prov/pkcs11/p11_ecdsa.cpp
@@ -47,7 +47,7 @@ ECDSA_PrivateKey PKCS11_ECDSA_PrivateKey::export_key() const
return ECDSA_PrivateKey(rng, domain(), BigInt::decode(priv_key));
}
-secure_vector<byte> PKCS11_ECDSA_PrivateKey::private_key_bits() const
+secure_vector<uint8_t> PKCS11_ECDSA_PrivateKey::private_key_bits() const
{
return export_key().private_key_bits();
}
@@ -61,14 +61,14 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature
: PK_Ops::Signature(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa))
{}
- void update(const byte msg[], size_t msg_len) override
+ void update(const uint8_t msg[], size_t msg_len) override
{
if(!m_initialized)
{
// first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed
m_key.module()->C_SignInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
m_initialized = true;
- m_first_message = secure_vector<byte>(msg, msg + msg_len);
+ m_first_message = secure_vector<uint8_t>(msg, msg + msg_len);
return;
}
@@ -82,9 +82,9 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature
m_key.module()->C_SignUpdate(m_key.session().handle(), const_cast<Byte*>(msg), msg_len);
}
- secure_vector<byte> sign(RandomNumberGenerator&) override
+ secure_vector<uint8_t> sign(RandomNumberGenerator&) override
{
- secure_vector<byte> signature;
+ secure_vector<uint8_t> signature;
if(!m_first_message.empty())
{
// single call to update: perform single-part operation
@@ -104,7 +104,7 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature
const PKCS11_EC_PrivateKey& m_key;
const BigInt& m_order;
MechanismWrapper m_mechanism;
- secure_vector<byte> m_first_message;
+ secure_vector<uint8_t> m_first_message;
bool m_initialized = false;
};
@@ -116,14 +116,14 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification
: PK_Ops::Verification(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa))
{}
- void update(const byte msg[], size_t msg_len) override
+ void update(const uint8_t msg[], size_t msg_len) override
{
if(!m_initialized)
{
// first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed
m_key.module()->C_VerifyInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
m_initialized = true;
- m_first_message = secure_vector<byte>(msg, msg + msg_len);
+ m_first_message = secure_vector<uint8_t>(msg, msg + msg_len);
return;
}
@@ -137,7 +137,7 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification
m_key.module()->C_VerifyUpdate(m_key.session().handle(), const_cast<Byte*>(msg), msg_len);
}
- bool is_valid_signature(const byte sig[], size_t sig_len) override
+ bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
{
ReturnValue return_value = ReturnValue::SignatureInvalid;
if(!m_first_message.empty())
@@ -164,7 +164,7 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification
const PKCS11_EC_PublicKey& m_key;
const BigInt& m_order;
MechanismWrapper m_mechanism;
- secure_vector<byte> m_first_message;
+ secure_vector<uint8_t> m_first_message;
bool m_initialized = false;
};
diff --git a/src/lib/prov/pkcs11/p11_ecdsa.h b/src/lib/prov/pkcs11/p11_ecdsa.h
index 73ee900db..c1ac0d557 100644
--- a/src/lib/prov/pkcs11/p11_ecdsa.h
+++ b/src/lib/prov/pkcs11/p11_ecdsa.h
@@ -85,7 +85,7 @@ class BOTAN_DLL PKCS11_ECDSA_PrivateKey final : public PKCS11_EC_PrivateKey
* @param props the attributes of the private key
* @note no persistent public key object will be created
*/
- PKCS11_ECDSA_PrivateKey(Session& session, const std::vector<byte>& ec_params,
+ PKCS11_ECDSA_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params,
const EC_PrivateKeyGenerationProperties& props)
: PKCS11_EC_PrivateKey(session, ec_params, props)
{}
@@ -98,7 +98,7 @@ class BOTAN_DLL PKCS11_ECDSA_PrivateKey final : public PKCS11_EC_PrivateKey
/// @return the exported ECDSA private key
ECDSA_PrivateKey export_key() const;
- secure_vector<byte> private_key_bits() const override;
+ secure_vector<uint8_t> private_key_bits() const override;
bool check_key(RandomNumberGenerator&, bool) const override;
diff --git a/src/lib/prov/pkcs11/p11_mechanism.h b/src/lib/prov/pkcs11/p11_mechanism.h
index dde5e5b07..be48c9a14 100644
--- a/src/lib/prov/pkcs11/p11_mechanism.h
+++ b/src/lib/prov/pkcs11/p11_mechanism.h
@@ -63,9 +63,9 @@ class MechanismWrapper final
* @param salt the salt
* @param salt_len size of the salt in bytes
*/
- inline void set_ecdh_salt(const byte salt[], size_t salt_len)
+ inline void set_ecdh_salt(const uint8_t salt[], size_t salt_len)
{
- m_parameters->ecdh_params.pSharedData = const_cast<byte*>(salt);
+ m_parameters->ecdh_params.pSharedData = const_cast<uint8_t*>(salt);
m_parameters->ecdh_params.ulSharedDataLen = salt_len;
}
@@ -74,9 +74,9 @@ class MechanismWrapper final
* @param other_key key of the other party
* @param other_key_len size of the key of the other party in bytes
*/
- inline void set_ecdh_other_key(const byte other_key[], size_t other_key_len)
+ inline void set_ecdh_other_key(const uint8_t other_key[], size_t other_key_len)
{
- m_parameters->ecdh_params.pPublicData = const_cast<byte*>(other_key);
+ m_parameters->ecdh_params.pPublicData = const_cast<uint8_t*>(other_key);
m_parameters->ecdh_params.ulPublicDataLen = other_key_len;
}
diff --git a/src/lib/prov/pkcs11/p11_object.cpp b/src/lib/prov/pkcs11/p11_object.cpp
index ef7477284..872fdf8b7 100644
--- a/src/lib/prov/pkcs11/p11_object.cpp
+++ b/src/lib/prov/pkcs11/p11_object.cpp
@@ -22,28 +22,28 @@ AttributeContainer::AttributeContainer(ObjectClass object_class)
void AttributeContainer::add_class(ObjectClass object_class)
{
m_numerics.push_back(static_cast< uint64_t >(object_class));
- add_attribute(AttributeType::Class, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(ObjectClass));
+ add_attribute(AttributeType::Class, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(ObjectClass));
}
void AttributeContainer::add_string(AttributeType attribute, const std::string& value)
{
m_strings.push_back(value);
- add_attribute(attribute, reinterpret_cast< const byte* >(m_strings.back().data()), value.size());
+ add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_strings.back().data()), value.size());
}
-void AttributeContainer::add_binary(AttributeType attribute, const byte* value, size_t length)
+void AttributeContainer::add_binary(AttributeType attribute, const uint8_t* value, size_t length)
{
- m_vectors.push_back(secure_vector<byte>(value, value + length));
- add_attribute(attribute, reinterpret_cast< const byte* >(m_vectors.back().data()), length);
+ m_vectors.push_back(secure_vector<uint8_t>(value, value + length));
+ add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_vectors.back().data()), length);
}
void AttributeContainer::add_bool(AttributeType attribute, bool value)
{
m_numerics.push_back(value ? True : False);
- add_attribute(attribute, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(Bbool));
+ add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(Bbool));
}
-void AttributeContainer::add_attribute(AttributeType attribute, const byte* value, uint32_t size)
+void AttributeContainer::add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size)
{
bool exists = false;
// check if the attribute has been added already
@@ -63,12 +63,12 @@ void AttributeContainer::add_attribute(AttributeType attribute, const byte* valu
}), m_numerics.end());
m_vectors.erase(std::remove_if(m_vectors.begin(),
- m_vectors.end(), [ &existing_attribute ](const secure_vector<byte>& data)
+ m_vectors.end(), [ &existing_attribute ](const secure_vector<uint8_t>& data)
{
return data.data() == existing_attribute.pValue;
}), m_vectors.end());
- existing_attribute.pValue = const_cast< byte* >(value);
+ existing_attribute.pValue = const_cast< uint8_t* >(value);
existing_attribute.ulValueLen = size;
exists = true;
break;
@@ -77,7 +77,7 @@ void AttributeContainer::add_attribute(AttributeType attribute, const byte* valu
if(!exists)
{
- m_attributes.push_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(attribute), const_cast< byte* >(value), size });
+ m_attributes.push_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(attribute), const_cast< uint8_t* >(value), size });
}
}
@@ -188,16 +188,16 @@ Object::Object(Session& session, const ObjectProperties& obj_props)
m_session.get().module()->C_CreateObject(m_session.get().handle(), obj_props.data(), obj_props.count(), &m_handle);
}
-secure_vector<byte> Object::get_attribute_value(AttributeType attribute) const
+secure_vector<uint8_t> Object::get_attribute_value(AttributeType attribute) const
{
- std::map<AttributeType, secure_vector<byte>> attribute_map = { { attribute, secure_vector<byte>() } };
+ std::map<AttributeType, secure_vector<uint8_t>> attribute_map = { { attribute, secure_vector<uint8_t>() } };
module()->C_GetAttributeValue(m_session.get().handle(), m_handle, attribute_map);
return attribute_map.at(attribute);
}
-void Object::set_attribute_value(AttributeType attribute, const secure_vector<byte>& value) const
+void Object::set_attribute_value(AttributeType attribute, const secure_vector<uint8_t>& value) const
{
- std::map<AttributeType, secure_vector<byte>> attribute_map = { { attribute, value } };
+ std::map<AttributeType, secure_vector<uint8_t>> attribute_map = { { attribute, value } };
module()->C_SetAttributeValue(m_session.get().handle(), m_handle, attribute_map);
}
diff --git a/src/lib/prov/pkcs11/p11_object.h b/src/lib/prov/pkcs11/p11_object.h
index cae1969a2..e7ab05f0d 100644
--- a/src/lib/prov/pkcs11/p11_object.h
+++ b/src/lib/prov/pkcs11/p11_object.h
@@ -83,7 +83,7 @@ class BOTAN_DLL AttributeContainer
* @param value binary attribute value to add
* @param length size of the binary attribute value in bytes
*/
- void add_binary(AttributeType attribute, const byte* value, size_t length);
+ void add_binary(AttributeType attribute, const uint8_t* value, size_t length);
/**
* Add a binary attribute (e.g. CKA_ID / AttributeType::Id).
@@ -91,7 +91,7 @@ class BOTAN_DLL AttributeContainer
* @param binary binary attribute value to add
*/
template<typename TAlloc>
- void add_binary(AttributeType attribute, const std::vector<byte, TAlloc>& binary)
+ void add_binary(AttributeType attribute, const std::vector<uint8_t, TAlloc>& binary)
{
add_binary(attribute, binary.data(), binary.size());
}
@@ -113,18 +113,18 @@ class BOTAN_DLL AttributeContainer
{
static_assert(std::is_integral<T>::value, "Numeric value required.");
m_numerics.push_back(static_cast< uint64_t >(value));
- add_attribute(attribute, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(T));
+ add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(T));
}
protected:
/// Add an attribute with the given value and size to the attribute collection `m_attributes`
- void add_attribute(AttributeType attribute, const byte* value, uint32_t size);
+ void add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size);
private:
std::vector<Attribute> m_attributes;
std::list<uint64_t> m_numerics;
std::list<std::string> m_strings;
- std::list<secure_vector<byte>> m_vectors;
+ std::list<secure_vector<uint8_t>> m_vectors;
};
/// Manages calls to C_FindObjects* functions (C_FindObjectsInit -> C_FindObjects -> C_FindObjectsFinal)
@@ -249,13 +249,13 @@ class BOTAN_DLL DataObjectProperties : public StorageObjectProperties
}
/// @param object_id DER-encoding of the object identifier indicating the data object type
- inline void set_object_id(const std::vector<byte>& object_id)
+ inline void set_object_id(const std::vector<uint8_t>& object_id)
{
add_binary(AttributeType::ObjectId, object_id);
}
/// @param value value of the object
- inline void set_value(const secure_vector<byte>& value)
+ inline void set_value(const secure_vector<uint8_t>& value)
{
add_binary(AttributeType::Value, value);
}
@@ -284,7 +284,7 @@ class BOTAN_DLL CertificateProperties : public StorageObjectProperties
* @param checksum the value of this attribute is derived from the certificate by taking the
* first three bytes of the SHA - 1 hash of the certificate object's `CKA_VALUE` attribute
*/
- inline void set_check_value(const std::vector<byte>& checksum)
+ inline void set_check_value(const std::vector<uint8_t>& checksum)
{
add_binary(AttributeType::CheckValue, checksum);
}
@@ -292,17 +292,17 @@ class BOTAN_DLL CertificateProperties : public StorageObjectProperties
/// @param date start date for the certificate
inline void set_start_date(Date date)
{
- add_binary(AttributeType::StartDate, reinterpret_cast<byte*>(&date), sizeof(Date));
+ add_binary(AttributeType::StartDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date));
}
/// @param date end date for the certificate
inline void set_end_date(Date date)
{
- add_binary(AttributeType::EndDate, reinterpret_cast<byte*>(&date), sizeof(Date));
+ add_binary(AttributeType::EndDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date));
}
/// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for the public key contained in this certificate
- inline void set_public_key_info(const std::vector<byte>& pubkey_info)
+ inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info)
{
add_binary(AttributeType::PublicKeyInfo, pubkey_info);
}
@@ -328,7 +328,7 @@ class BOTAN_DLL KeyProperties : public StorageObjectProperties
KeyProperties(ObjectClass object_class, KeyType key_type);
/// @param id key identifier for key
- inline void set_id(const std::vector<byte>& id)
+ inline void set_id(const std::vector<uint8_t>& id)
{
add_binary(AttributeType::Id, id);
}
@@ -336,13 +336,13 @@ class BOTAN_DLL KeyProperties : public StorageObjectProperties
/// @param date start date for the key
inline void set_start_date(Date date)
{
- add_binary(AttributeType::StartDate, reinterpret_cast<byte*>(&date), sizeof(Date));
+ add_binary(AttributeType::StartDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date));
}
/// @param date end date for the key
inline void set_end_date(Date date)
{
- add_binary(AttributeType::EndDate, reinterpret_cast<byte*>(&date), sizeof(Date));
+ add_binary(AttributeType::EndDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date));
}
/// @param value true if key supports key derivation (i.e., if other keys can be derived from this one)
@@ -378,7 +378,7 @@ class BOTAN_DLL PublicKeyProperties : public KeyProperties
PublicKeyProperties(KeyType key_type);
/// @param subject DER-encoding of the key subject name
- inline void set_subject(const std::vector<byte>& subject)
+ inline void set_subject(const std::vector<uint8_t>& subject)
{
add_binary(AttributeType::Subject, subject);
}
@@ -428,7 +428,7 @@ class BOTAN_DLL PublicKeyProperties : public KeyProperties
}
/// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for this public key
- inline void set_public_key_info(const std::vector<byte>& pubkey_info)
+ inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info)
{
add_binary(AttributeType::PublicKeyInfo, pubkey_info);
}
@@ -442,7 +442,7 @@ class BOTAN_DLL PrivateKeyProperties : public KeyProperties
PrivateKeyProperties(KeyType key_type);
/// @param subject DER-encoding of the key subject name
- inline void set_subject(const std::vector<byte>& subject)
+ inline void set_subject(const std::vector<uint8_t>& subject)
{
add_binary(AttributeType::Subject, subject);
}
@@ -507,7 +507,7 @@ class BOTAN_DLL PrivateKeyProperties : public KeyProperties
}
/// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for this public key
- inline void set_public_key_info(const std::vector<byte>& pubkey_info)
+ inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info)
{
add_binary(AttributeType::PublicKeyInfo, pubkey_info);
}
@@ -590,7 +590,7 @@ class BOTAN_DLL SecretKeyProperties : public KeyProperties
}
/// @param checksum the key check value of this key
- inline void set_check_value(const std::vector<byte>& checksum)
+ inline void set_check_value(const std::vector<uint8_t>& checksum)
{
add_binary(AttributeType::CheckValue, checksum);
}
@@ -668,21 +668,21 @@ class BOTAN_DLL Object
/// Searches for all objects of the given type using the id (`CKA_ID`)
template<typename T>
- static std::vector<T> search(Session& session, const std::vector<byte>& id);
+ static std::vector<T> search(Session& session, const std::vector<uint8_t>& id);
/// Searches for all objects of the given type using the label (`CKA_LABEL`) and id (`CKA_ID`)
template<typename T>
- static std::vector<T> search(Session& session, const std::string& label, const std::vector<byte>& id);
+ static std::vector<T> search(Session& session, const std::string& label, const std::vector<uint8_t>& id);
/// Searches for all objects of the given type
template<typename T>
static std::vector<T> search(Session& session);
/// @returns the value of the given attribute (using `C_GetAttributeValue`)
- secure_vector<byte> get_attribute_value(AttributeType attribute) const;
+ secure_vector<uint8_t> get_attribute_value(AttributeType attribute) const;
/// Sets the given value for the attribute (using `C_SetAttributeValue`)
- void set_attribute_value(AttributeType attribute, const secure_vector<byte>& value) const;
+ void set_attribute_value(AttributeType attribute, const secure_vector<uint8_t>& value) const;
/// Destroys the object
void destroy() const;
@@ -742,7 +742,7 @@ std::vector<T> Object::search(Session& session, const std::string& label)
}
template<typename T>
-std::vector<T> Object::search(Session& session, const std::vector<byte>& id)
+std::vector<T> Object::search(Session& session, const std::vector<uint8_t>& id)
{
AttributeContainer search_template(T::Class);
search_template.add_binary(AttributeType::Id, id);
@@ -750,7 +750,7 @@ std::vector<T> Object::search(Session& session, const std::vector<byte>& id)
}
template<typename T>
-std::vector<T> Object::search(Session& session, const std::string& label, const std::vector<byte>& id)
+std::vector<T> Object::search(Session& session, const std::string& label, const std::vector<uint8_t>& id)
{
AttributeContainer search_template(T::Class);
search_template.add_string(AttributeType::Label, label);
diff --git a/src/lib/prov/pkcs11/p11_randomgenerator.cpp b/src/lib/prov/pkcs11/p11_randomgenerator.cpp
index eaf9933c6..957a33cae 100644
--- a/src/lib/prov/pkcs11/p11_randomgenerator.cpp
+++ b/src/lib/prov/pkcs11/p11_randomgenerator.cpp
@@ -16,14 +16,14 @@ PKCS11_RNG::PKCS11_RNG(Session& session)
: m_session(session)
{}
-void PKCS11_RNG::randomize(Botan::byte output[], std::size_t length)
+void PKCS11_RNG::randomize(uint8_t output[], std::size_t length)
{
module()->C_GenerateRandom(m_session.get().handle(), output, length);
}
-void PKCS11_RNG::add_entropy(const Botan::byte in[], std::size_t length)
+void PKCS11_RNG::add_entropy(const uint8_t in[], std::size_t length)
{
- module()->C_SeedRandom(m_session.get().handle(), const_cast<Botan::byte*>(in), length);
+ module()->C_SeedRandom(m_session.get().handle(), const_cast<uint8_t*>(in), length);
}
}
diff --git a/src/lib/prov/pkcs11/p11_randomgenerator.h b/src/lib/prov/pkcs11/p11_randomgenerator.h
index a291c89f3..6a29f8040 100644
--- a/src/lib/prov/pkcs11/p11_randomgenerator.h
+++ b/src/lib/prov/pkcs11/p11_randomgenerator.h
@@ -55,10 +55,10 @@ class BOTAN_DLL PKCS11_RNG final : public Hardware_RNG
}
/// Calls `C_GenerateRandom` to generate random data
- void randomize(Botan::byte output[], std::size_t length) override;
+ void randomize(uint8_t output[], std::size_t length) override;
/// Calls `C_SeedRandom` to add entropy to the random generation function of the token/middleware
- void add_entropy(const Botan::byte in[], std::size_t length) override;
+ void add_entropy(const uint8_t in[], std::size_t length) override;
private:
const std::reference_wrapper<Session> m_session;
diff --git a/src/lib/prov/pkcs11/p11_rsa.cpp b/src/lib/prov/pkcs11/p11_rsa.cpp
index 1edbde83b..3bb7b7534 100644
--- a/src/lib/prov/pkcs11/p11_rsa.cpp
+++ b/src/lib/prov/pkcs11/p11_rsa.cpp
@@ -101,7 +101,7 @@ RSA_PrivateKey PKCS11_RSA_PrivateKey::export_key() const
, BigInt::decode(n));
}
-secure_vector<byte> PKCS11_RSA_PrivateKey::private_key_bits() const
+secure_vector<uint8_t> PKCS11_RSA_PrivateKey::private_key_bits() const
{
return export_key().private_key_bits();
}
@@ -127,12 +127,12 @@ class PKCS11_RSA_Decryption_Operation final : public PK_Ops::Decryption
m_bits = m_key.get_n().bits() - 1;
}
- secure_vector<byte> decrypt(byte& valid_mask, const byte ciphertext[], size_t ciphertext_len) override
+ secure_vector<uint8_t> decrypt(uint8_t& valid_mask, const uint8_t ciphertext[], size_t ciphertext_len) override
{
valid_mask = 0;
m_key.module()->C_DecryptInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
- std::vector<byte> encrypted_data(ciphertext, ciphertext + ciphertext_len);
+ std::vector<uint8_t> encrypted_data(ciphertext, ciphertext + ciphertext_len);
// blind for RSA/RAW decryption
if(! m_mechanism.padding_size())
@@ -140,7 +140,7 @@ class PKCS11_RSA_Decryption_Operation final : public PK_Ops::Decryption
encrypted_data = BigInt::encode(m_blinder.blind(BigInt::decode(encrypted_data)));
}
- secure_vector<byte> decrypted_data;
+ secure_vector<uint8_t> decrypted_data;
m_key.module()->C_Decrypt(m_key.session().handle(), encrypted_data, decrypted_data);
// Unblind for RSA/RAW decryption
@@ -178,12 +178,12 @@ class PKCS11_RSA_Encryption_Operation : public PK_Ops::Encryption
return m_bits;
}
- secure_vector<byte> encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator&) override
+ secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator&) override
{
m_key.module()->C_EncryptInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
- secure_vector<byte> encrytped_data;
- m_key.module()->C_Encrypt(m_key.session().handle(), secure_vector<byte>(msg, msg + msg_len), encrytped_data);
+ secure_vector<uint8_t> encrytped_data;
+ m_key.module()->C_Encrypt(m_key.session().handle(), secure_vector<uint8_t>(msg, msg + msg_len), encrytped_data);
return encrytped_data;
}
@@ -202,14 +202,14 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature
: m_key(key), m_mechanism(MechanismWrapper::create_rsa_sign_mechanism(padding))
{}
- void update(const byte msg[], size_t msg_len) override
+ void update(const uint8_t msg[], size_t msg_len) override
{
if(!m_initialized)
{
// first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed
m_key.module()->C_SignInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
m_initialized = true;
- m_first_message = secure_vector<byte>(msg, msg + msg_len);
+ m_first_message = secure_vector<uint8_t>(msg, msg + msg_len);
return;
}
@@ -223,9 +223,9 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature
m_key.module()->C_SignUpdate(m_key.session().handle(), const_cast< Byte* >(msg), msg_len);
}
- secure_vector<byte> sign(RandomNumberGenerator&) override
+ secure_vector<uint8_t> sign(RandomNumberGenerator&) override
{
- secure_vector<byte> signature;
+ secure_vector<uint8_t> signature;
if(!m_first_message.empty())
{
// single call to update: perform single-part operation
@@ -244,7 +244,7 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature
private:
const PKCS11_RSA_PrivateKey& m_key;
bool m_initialized = false;
- secure_vector<byte> m_first_message;
+ secure_vector<uint8_t> m_first_message;
MechanismWrapper m_mechanism;
};
@@ -257,14 +257,14 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification
: m_key(key), m_mechanism(MechanismWrapper::create_rsa_sign_mechanism(padding))
{}
- void update(const byte msg[], size_t msg_len) override
+ void update(const uint8_t msg[], size_t msg_len) override
{
if(!m_initialized)
{
// first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed
m_key.module()->C_VerifyInit(m_key.session().handle(), m_mechanism.data(), m_key.handle());
m_initialized = true;
- m_first_message = secure_vector<byte>(msg, msg + msg_len);
+ m_first_message = secure_vector<uint8_t>(msg, msg + msg_len);
return;
}
@@ -278,7 +278,7 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification
m_key.module()->C_VerifyUpdate(m_key.session().handle(), const_cast< Byte* >(msg), msg_len);
}
- bool is_valid_signature(const byte sig[], size_t sig_len) override
+ bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
{
ReturnValue return_value = ReturnValue::SignatureInvalid;
if(!m_first_message.empty())
@@ -304,7 +304,7 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification
private:
const PKCS11_RSA_PublicKey& m_key;
bool m_initialized = false;
- secure_vector<byte> m_first_message;
+ secure_vector<uint8_t> m_first_message;
MechanismWrapper m_mechanism;
};
diff --git a/src/lib/prov/pkcs11/p11_rsa.h b/src/lib/prov/pkcs11/p11_rsa.h
index 13b9d9dc1..1a6fd4890 100644
--- a/src/lib/prov/pkcs11/p11_rsa.h
+++ b/src/lib/prov/pkcs11/p11_rsa.h
@@ -200,7 +200,7 @@ class BOTAN_DLL PKCS11_RSA_PrivateKey final : public Private_Key,
/// @return the exported RSA private key
RSA_PrivateKey export_key() const;
- secure_vector<byte> private_key_bits() const override;
+ secure_vector<uint8_t> private_key_bits() const override;
std::unique_ptr<PK_Ops::Decryption>
create_decryption_op(RandomNumberGenerator& rng,
diff --git a/src/lib/prov/pkcs11/p11_x509.cpp b/src/lib/prov/pkcs11/p11_x509.cpp
index 76b120368..5c6accdf0 100644
--- a/src/lib/prov/pkcs11/p11_x509.cpp
+++ b/src/lib/prov/pkcs11/p11_x509.cpp
@@ -13,7 +13,7 @@
namespace Botan {
namespace PKCS11 {
-X509_CertificateProperties::X509_CertificateProperties(const std::vector<byte>& subject, const std::vector<byte>& value)
+X509_CertificateProperties::X509_CertificateProperties(const std::vector<uint8_t>& subject, const std::vector<uint8_t>& value)
: CertificateProperties(CertificateType::X509), m_subject(subject), m_value(value)
{
add_binary(AttributeType::Subject, m_subject);
diff --git a/src/lib/prov/pkcs11/p11_x509.h b/src/lib/prov/pkcs11/p11_x509.h
index f0e025ff4..db83286cc 100644
--- a/src/lib/prov/pkcs11/p11_x509.h
+++ b/src/lib/prov/pkcs11/p11_x509.h
@@ -31,34 +31,34 @@ class BOTAN_DLL X509_CertificateProperties final : public CertificateProperties
* @param subject DER-encoding of the certificate subject name
* @param value BER-encoding of the certificate
*/
- X509_CertificateProperties(const std::vector<byte>& subject, const std::vector<byte>& value);
+ X509_CertificateProperties(const std::vector<uint8_t>& subject, const std::vector<uint8_t>& value);
/// @param id key identifier for public/private key pair
- inline void set_id(const std::vector<byte>& id)
+ inline void set_id(const std::vector<uint8_t>& id)
{
add_binary(AttributeType::Id, id);
}
/// @param issuer DER-encoding of the certificate issuer name
- inline void set_issuer(const std::vector<byte>& issuer)
+ inline void set_issuer(const std::vector<uint8_t>& issuer)
{
add_binary(AttributeType::Issuer, issuer);
}
/// @param serial DER-encoding of the certificate serial number
- inline void set_serial(const std::vector<byte>& serial)
+ inline void set_serial(const std::vector<uint8_t>& serial)
{
add_binary(AttributeType::SerialNumber, serial);
}
/// @param hash hash value of the subject public key
- inline void set_subject_pubkey_hash(const std::vector<byte>& hash)
+ inline void set_subject_pubkey_hash(const std::vector<uint8_t>& hash)
{
add_binary(AttributeType::HashOfSubjectPublicKey, hash);
}
/// @param hash hash value of the issuer public key
- inline void set_issuer_pubkey_hash(const std::vector<byte>& hash)
+ inline void set_issuer_pubkey_hash(const std::vector<uint8_t>& hash)
{
add_binary(AttributeType::HashOfIssuerPublicKey, hash);
}
@@ -70,20 +70,20 @@ class BOTAN_DLL X509_CertificateProperties final : public CertificateProperties
}
/// @return the subject
- inline const std::vector<byte>& subject() const
+ inline const std::vector<uint8_t>& subject() const
{
return m_subject;
}
/// @return the BER-encoding of the certificate
- inline const std::vector<byte>& value() const
+ inline const std::vector<uint8_t>& value() const
{
return m_value;
}
private:
- const std::vector<byte> m_subject;
- const std::vector<byte> m_value;
+ const std::vector<uint8_t> m_subject;
+ const std::vector<uint8_t> m_value;
};
/// Represents a PKCS#11 X509 certificate
diff --git a/src/lib/prov/tpm/tpm.cpp b/src/lib/prov/tpm/tpm.cpp
index e1f214952..8e3fce968 100644
--- a/src/lib/prov/tpm/tpm.cpp
+++ b/src/lib/prov/tpm/tpm.cpp
@@ -59,7 +59,7 @@ 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 };
+ static const uint8_t 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));
}
@@ -349,7 +349,7 @@ AlgorithmIdentifier TPM_PrivateKey::algorithm_identifier() const
AlgorithmIdentifier::USE_NULL_PARAM);
}
-std::vector<byte> TPM_PrivateKey::public_key_bits() const
+std::vector<uint8_t> TPM_PrivateKey::public_key_bits() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
@@ -359,7 +359,7 @@ std::vector<byte> TPM_PrivateKey::public_key_bits() const
.get_contents_unlocked();
}
-secure_vector<byte> TPM_PrivateKey::private_key_bits() const
+secure_vector<uint8_t> TPM_PrivateKey::private_key_bits() const
{
throw TPM_Error("Private key export not supported for TPM keys");
}
@@ -394,12 +394,12 @@ class TPM_Signing_Operation : public PK_Ops::Signature
{
}
- void update(const byte msg[], size_t msg_len) override
+ void update(const uint8_t msg[], size_t msg_len) override
{
m_hash->update(msg, msg_len);
}
- secure_vector<byte> sign(RandomNumberGenerator&) override
+ secure_vector<uint8_t> sign(RandomNumberGenerator&) override
{
/*
* v1.2 TPMs will only sign with PKCS #1 v1.5 padding. SHA-1 is built
@@ -408,7 +408,7 @@ class TPM_Signing_Operation : public PK_Ops::Signature
* 01FFFF... prefix. Even when using SHA-1 we compute the hash locally
* since it is going to be much faster than pushing data over the LPC bus.
*/
- secure_vector<byte> msg_hash = m_hash->final();
+ secure_vector<uint8_t> msg_hash = m_hash->final();
std::vector<uint8_t> id_and_msg;
id_and_msg.reserve(m_hash_id.size() + msg_hash.size());
diff --git a/src/lib/prov/tpm/tpm.h b/src/lib/prov/tpm/tpm.h
index de0fa364f..178206b8f 100644
--- a/src/lib/prov/tpm/tpm.h
+++ b/src/lib/prov/tpm/tpm.h
@@ -77,12 +77,12 @@ class BOTAN_DLL TPM_RNG : public Hardware_RNG
public:
TPM_RNG(TPM_Context& ctx) : m_ctx(ctx) {}
- void add_entropy(const byte in[], size_t in_len) override
+ void add_entropy(const uint8_t in[], size_t in_len) override
{
m_ctx.stir_random(in, in_len);
}
- void randomize(byte out[], size_t out_len) override
+ void randomize(uint8_t out[], size_t out_len) override
{
m_ctx.gen_random(out, out_len);
}
@@ -154,9 +154,9 @@ class BOTAN_DLL TPM_PrivateKey : public Private_Key
AlgorithmIdentifier algorithm_identifier() const override;
- std::vector<byte> public_key_bits() const override;
+ std::vector<uint8_t> public_key_bits() const override;
- secure_vector<byte> private_key_bits() const override;
+ secure_vector<uint8_t> private_key_bits() const override;
bool check_key(RandomNumberGenerator& rng, bool) const override;