diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/pk_pad/emsa_pkcs1 | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/pk_pad/emsa_pkcs1')
-rw-r--r-- | src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp | 32 | ||||
-rw-r--r-- | src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h | 20 |
2 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp index b3f74930b..c4cdc6f35 100644 --- a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp +++ b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp @@ -12,16 +12,16 @@ namespace Botan { namespace { -secure_vector<byte> emsa3_encoding(const secure_vector<byte>& msg, +secure_vector<uint8_t> emsa3_encoding(const secure_vector<uint8_t>& msg, size_t output_bits, - const byte hash_id[], + const uint8_t hash_id[], size_t hash_id_length) { size_t output_length = output_bits / 8; if(output_length < hash_id_length + msg.size() + 10) throw Encoding_Error("emsa3_encoding: Output length is too small"); - secure_vector<byte> T(output_length); + secure_vector<uint8_t> T(output_length); const size_t P_LENGTH = output_length - msg.size() - hash_id_length - 2; T[0] = 0x01; @@ -34,18 +34,18 @@ secure_vector<byte> emsa3_encoding(const secure_vector<byte>& msg, } -void EMSA_PKCS1v15::update(const byte input[], size_t length) +void EMSA_PKCS1v15::update(const uint8_t input[], size_t length) { m_hash->update(input, length); } -secure_vector<byte> EMSA_PKCS1v15::raw_data() +secure_vector<uint8_t> EMSA_PKCS1v15::raw_data() { return m_hash->final(); } -secure_vector<byte> -EMSA_PKCS1v15::encoding_of(const secure_vector<byte>& msg, +secure_vector<uint8_t> +EMSA_PKCS1v15::encoding_of(const secure_vector<uint8_t>& msg, size_t output_bits, RandomNumberGenerator&) { @@ -56,8 +56,8 @@ EMSA_PKCS1v15::encoding_of(const secure_vector<byte>& msg, m_hash_id.data(), m_hash_id.size()); } -bool EMSA_PKCS1v15::verify(const secure_vector<byte>& coded, - const secure_vector<byte>& raw, +bool EMSA_PKCS1v15::verify(const secure_vector<uint8_t>& coded, + const secure_vector<uint8_t>& raw, size_t key_bits) { if(raw.size() != m_hash->output_length()) @@ -79,28 +79,28 @@ EMSA_PKCS1v15::EMSA_PKCS1v15(HashFunction* hash) : m_hash(hash) m_hash_id = pkcs_hash_id(m_hash->name()); } -void EMSA_PKCS1v15_Raw::update(const byte input[], size_t length) +void EMSA_PKCS1v15_Raw::update(const uint8_t input[], size_t length) { m_message += std::make_pair(input, length); } -secure_vector<byte> EMSA_PKCS1v15_Raw::raw_data() +secure_vector<uint8_t> EMSA_PKCS1v15_Raw::raw_data() { - secure_vector<byte> ret; + secure_vector<uint8_t> ret; std::swap(ret, m_message); return ret; } -secure_vector<byte> -EMSA_PKCS1v15_Raw::encoding_of(const secure_vector<byte>& msg, +secure_vector<uint8_t> +EMSA_PKCS1v15_Raw::encoding_of(const secure_vector<uint8_t>& msg, size_t output_bits, RandomNumberGenerator&) { return emsa3_encoding(msg, output_bits, nullptr, 0); } -bool EMSA_PKCS1v15_Raw::verify(const secure_vector<byte>& coded, - const secure_vector<byte>& raw, +bool EMSA_PKCS1v15_Raw::verify(const secure_vector<uint8_t>& coded, + const secure_vector<uint8_t>& raw, size_t key_bits) { try diff --git a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h index 65daaf7ce..95ccafa4d 100644 --- a/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h +++ b/src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h @@ -28,18 +28,18 @@ class BOTAN_DLL EMSA_PKCS1v15 final : public EMSA EMSA* clone() override { return new EMSA_PKCS1v15(m_hash->clone()); } - void update(const byte[], size_t) override; + void update(const uint8_t[], size_t) override; - secure_vector<byte> raw_data() override; + secure_vector<uint8_t> raw_data() override; - secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t, + secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t, RandomNumberGenerator& rng) override; - bool verify(const secure_vector<byte>&, const secure_vector<byte>&, + bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&, size_t) override; private: std::unique_ptr<HashFunction> m_hash; - std::vector<byte> m_hash_id; + std::vector<uint8_t> m_hash_id; }; /** @@ -52,18 +52,18 @@ class BOTAN_DLL EMSA_PKCS1v15_Raw final : public EMSA public: EMSA* clone() override { return new EMSA_PKCS1v15_Raw(); } - void update(const byte[], size_t) override; + void update(const uint8_t[], size_t) override; - secure_vector<byte> raw_data() override; + secure_vector<uint8_t> raw_data() override; - secure_vector<byte> encoding_of(const secure_vector<byte>&, size_t, + secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t, RandomNumberGenerator& rng) override; - bool verify(const secure_vector<byte>&, const secure_vector<byte>&, + bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&, size_t) override; private: - secure_vector<byte> m_message; + secure_vector<uint8_t> m_message; }; } |