From f3cb3edb512bdcab498d825886c3366c341b3f78 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 11 Dec 2016 15:28:38 -0500 Subject: 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. --- src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.cpp | 32 ++++++++++++++++---------------- src/lib/pk_pad/emsa_pkcs1/emsa_pkcs1.h | 20 ++++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/lib/pk_pad/emsa_pkcs1') 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 emsa3_encoding(const secure_vector& msg, +secure_vector emsa3_encoding(const secure_vector& 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 T(output_length); + secure_vector 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 emsa3_encoding(const secure_vector& 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 EMSA_PKCS1v15::raw_data() +secure_vector EMSA_PKCS1v15::raw_data() { return m_hash->final(); } -secure_vector -EMSA_PKCS1v15::encoding_of(const secure_vector& msg, +secure_vector +EMSA_PKCS1v15::encoding_of(const secure_vector& msg, size_t output_bits, RandomNumberGenerator&) { @@ -56,8 +56,8 @@ EMSA_PKCS1v15::encoding_of(const secure_vector& msg, m_hash_id.data(), m_hash_id.size()); } -bool EMSA_PKCS1v15::verify(const secure_vector& coded, - const secure_vector& raw, +bool EMSA_PKCS1v15::verify(const secure_vector& coded, + const secure_vector& 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 EMSA_PKCS1v15_Raw::raw_data() +secure_vector EMSA_PKCS1v15_Raw::raw_data() { - secure_vector ret; + secure_vector ret; std::swap(ret, m_message); return ret; } -secure_vector -EMSA_PKCS1v15_Raw::encoding_of(const secure_vector& msg, +secure_vector +EMSA_PKCS1v15_Raw::encoding_of(const secure_vector& msg, size_t output_bits, RandomNumberGenerator&) { return emsa3_encoding(msg, output_bits, nullptr, 0); } -bool EMSA_PKCS1v15_Raw::verify(const secure_vector& coded, - const secure_vector& raw, +bool EMSA_PKCS1v15_Raw::verify(const secure_vector& coded, + const secure_vector& 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 raw_data() override; + secure_vector raw_data() override; - secure_vector encoding_of(const secure_vector&, size_t, + secure_vector encoding_of(const secure_vector&, size_t, RandomNumberGenerator& rng) override; - bool verify(const secure_vector&, const secure_vector&, + bool verify(const secure_vector&, const secure_vector&, size_t) override; private: std::unique_ptr m_hash; - std::vector m_hash_id; + std::vector 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 raw_data() override; + secure_vector raw_data() override; - secure_vector encoding_of(const secure_vector&, size_t, + secure_vector encoding_of(const secure_vector&, size_t, RandomNumberGenerator& rng) override; - bool verify(const secure_vector&, const secure_vector&, + bool verify(const secure_vector&, const secure_vector&, size_t) override; private: - secure_vector m_message; + secure_vector m_message; }; } -- cgit v1.2.3