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/pubkey/xmss/xmss_hash.h | |
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/pubkey/xmss/xmss_hash.h')
-rw-r--r-- | src/lib/pubkey/xmss/xmss_hash.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/pubkey/xmss/xmss_hash.h b/src/lib/pubkey/xmss/xmss_hash.h index 2cca26658..29a6ff90e 100644 --- a/src/lib/pubkey/xmss/xmss_hash.h +++ b/src/lib/pubkey/xmss/xmss_hash.h @@ -35,9 +35,9 @@ class XMSS_Hash * @param[in] key An n-byte key value. * @param[in] data A 32-byte XMSS_Address data value **/ - inline void prf(secure_vector<byte>& result, - const secure_vector<byte>& key, - const secure_vector<byte>& data) + inline void prf(secure_vector<uint8_t>& result, + const secure_vector<uint8_t>& key, + const secure_vector<uint8_t>& data) { m_hash->update(m_zero_padding); m_hash->update(m_id_prf); @@ -54,8 +54,8 @@ class XMSS_Hash * @param[in] data A 32-byte XMSS_Address data value * @return result The hash calculated using key and data. **/ - inline secure_vector<byte> prf(const secure_vector<byte>& key, - const secure_vector<byte>& data) + inline secure_vector<uint8_t> prf(const secure_vector<uint8_t>& key, + const secure_vector<uint8_t>& data) { m_hash->update(m_zero_padding); m_hash->update(m_id_prf); @@ -71,9 +71,9 @@ class XMSS_Hash * @param[in] key key of length n bytes. * @param[in] data string of arbitrary length. **/ - void f(secure_vector<byte>& result, - const secure_vector<byte>& key, - const secure_vector<byte>& data) + void f(secure_vector<uint8_t>& result, + const secure_vector<uint8_t>& key, + const secure_vector<uint8_t>& data) { m_hash->update(m_zero_padding); m_hash->update(m_id_f); @@ -90,9 +90,9 @@ class XMSS_Hash * @param[in] key key of length n bytes. * @param[in] data string of 2n bytes length. **/ - void h(secure_vector<byte>& result, - const secure_vector<byte>& key, - const secure_vector<byte>& data); + void h(secure_vector<uint8_t>& result, + const secure_vector<uint8_t>& key, + const secure_vector<uint8_t>& data); /** * Cryptographic hash function h accepting 3n byte keys and data @@ -105,10 +105,10 @@ class XMSS_Hash * * @return hash value of n-bytes length. **/ - secure_vector<byte> h_msg(const secure_vector<byte>& randomness, - const secure_vector<byte>& root, - const secure_vector<byte>& index_bytes, - const secure_vector<byte>& data); + secure_vector<uint8_t> h_msg(const secure_vector<uint8_t>& randomness, + const secure_vector<uint8_t>& root, + const secure_vector<uint8_t>& index_bytes, + const secure_vector<uint8_t>& data); /** * Initializes buffered h_msg computation with prefix data. @@ -117,16 +117,16 @@ class XMSS_Hash * @param root n-byte root node. * @param index_bytes Index value padded with leading zeros. **/ - void h_msg_init(const secure_vector<byte>& randomness, - const secure_vector<byte>& root, - const secure_vector<byte>& index_bytes); + void h_msg_init(const secure_vector<uint8_t>& randomness, + const secure_vector<uint8_t>& root, + const secure_vector<uint8_t>& index_bytes); /** * Adds a message block to buffered h_msg computation. * * @param data A message block **/ - void h_msg_update(const secure_vector<byte>& data); + void h_msg_update(const secure_vector<uint8_t>& data); /** * Adds a message block to buffered h_msg computation. @@ -134,7 +134,7 @@ class XMSS_Hash * @param data A message block * @param size Length of the message block in bytes. **/ - void h_msg_update(const byte data[], size_t size); + void h_msg_update(const uint8_t data[], size_t size); /** * Finalizes buffered h_msg computation and retrieves the result. @@ -142,15 +142,15 @@ class XMSS_Hash * @return Hash calculated using the prefix set by h_msg_init() and * message blocks provided through calls to h_msg_update(). **/ - secure_vector<byte> h_msg_final(); + secure_vector<uint8_t> h_msg_final(); size_t output_length() const { return m_output_length; }; private: - static const byte m_id_f = 0x00; - static const byte m_id_h = 0x01; - static const byte m_id_hmsg = 0x02; - static const byte m_id_prf = 0x03; + static const uint8_t m_id_f = 0x00; + static const uint8_t m_id_h = 0x01; + static const uint8_t m_id_hmsg = 0x02; + static const uint8_t m_id_prf = 0x03; const std::string m_hash_func_name; std::unique_ptr<HashFunction> m_hash; @@ -158,7 +158,7 @@ class XMSS_Hash size_t m_output_length; //32 byte id prefixes prepended to the hash input. - std::vector<byte> m_zero_padding; + std::vector<uint8_t> m_zero_padding; }; } |