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/kdf/hkdf | |
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/kdf/hkdf')
-rw-r--r-- | src/lib/kdf/hkdf/hkdf.cpp | 34 | ||||
-rw-r--r-- | src/lib/kdf/hkdf/hkdf.h | 24 |
2 files changed, 29 insertions, 29 deletions
diff --git a/src/lib/kdf/hkdf/hkdf.cpp b/src/lib/kdf/hkdf/hkdf.cpp index f44ed81bd..20215125b 100644 --- a/src/lib/kdf/hkdf/hkdf.cpp +++ b/src/lib/kdf/hkdf/hkdf.cpp @@ -10,28 +10,28 @@ namespace Botan { -size_t HKDF::kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte label[], size_t label_len) const +size_t HKDF::kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t label[], size_t label_len) const { HKDF_Extract extract(m_prf->clone()); HKDF_Expand expand(m_prf->clone()); - secure_vector<byte> prk(m_prf->output_length()); + secure_vector<uint8_t> prk(m_prf->output_length()); extract.kdf(prk.data(), prk.size(), secret, secret_len, salt, salt_len, nullptr, 0); return expand.kdf(key, key_len, prk.data(), prk.size(), nullptr, 0, label, label_len); } -size_t HKDF_Extract::kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte[], size_t) const +size_t HKDF_Extract::kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t[], size_t) const { - secure_vector<byte> prk; + secure_vector<uint8_t> prk; if(salt_len == 0) { - m_prf->set_key(std::vector<byte>(m_prf->output_length())); + m_prf->set_key(std::vector<uint8_t>(m_prf->output_length())); } else { @@ -46,15 +46,15 @@ size_t HKDF_Extract::kdf(byte key[], size_t key_len, return written; } -size_t HKDF_Expand::kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte label[], size_t label_len) const +size_t HKDF_Expand::kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t label[], size_t label_len) const { m_prf->set_key(secret, secret_len); - byte counter = 1; - secure_vector<byte> h; + uint8_t counter = 1; + secure_vector<uint8_t> h; size_t offset = 0; while(offset != key_len && counter != 0) diff --git a/src/lib/kdf/hkdf/hkdf.h b/src/lib/kdf/hkdf/hkdf.h index 5ad389aeb..7a07f94e1 100644 --- a/src/lib/kdf/hkdf/hkdf.h +++ b/src/lib/kdf/hkdf/hkdf.h @@ -30,10 +30,10 @@ class BOTAN_DLL HKDF final : public KDF std::string name() const override { return "HKDF(" + m_prf->name() + ")"; } - size_t kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte label[], size_t label_len) const override; + size_t kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t label[], size_t label_len) const override; private: std::unique_ptr<MessageAuthenticationCode> m_prf; @@ -54,10 +54,10 @@ class BOTAN_DLL HKDF_Extract final : public KDF std::string name() const override { return "HKDF-Extract(" + m_prf->name() + ")"; } - size_t kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte label[], size_t label_len) const override; + size_t kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t label[], size_t label_len) const override; private: std::unique_ptr<MessageAuthenticationCode> m_prf; @@ -78,10 +78,10 @@ class BOTAN_DLL HKDF_Expand final : public KDF std::string name() const override { return "HKDF-Expand(" + m_prf->name() + ")"; } - size_t kdf(byte key[], size_t key_len, - const byte secret[], size_t secret_len, - const byte salt[], size_t salt_len, - const byte label[], size_t label_len) const override; + size_t kdf(uint8_t key[], size_t key_len, + const uint8_t secret[], size_t secret_len, + const uint8_t salt[], size_t salt_len, + const uint8_t label[], size_t label_len) const override; private: std::unique_ptr<MessageAuthenticationCode> m_prf; |