aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/pkcs11/p11_rsa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/prov/pkcs11/p11_rsa.cpp')
-rw-r--r--src/lib/prov/pkcs11/p11_rsa.cpp32
1 files changed, 16 insertions, 16 deletions
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;
};