aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/fpe_fe1/fpe_fe1.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/misc/fpe_fe1/fpe_fe1.cpp
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (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/misc/fpe_fe1/fpe_fe1.cpp')
-rw-r--r--src/lib/misc/fpe_fe1/fpe_fe1.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.cpp b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
index c59e41e78..72e154374 100644
--- a/src/lib/misc/fpe_fe1/fpe_fe1.cpp
+++ b/src/lib/misc/fpe_fe1/fpe_fe1.cpp
@@ -80,31 +80,31 @@ class FPE_Encryptor
public:
FPE_Encryptor(const SymmetricKey& key,
const BigInt& n,
- const std::vector<byte>& tweak);
+ const std::vector<uint8_t>& tweak);
BigInt operator()(size_t i, const BigInt& R);
private:
std::unique_ptr<MessageAuthenticationCode> m_mac;
- std::vector<byte> m_mac_n_t;
+ std::vector<uint8_t> m_mac_n_t;
};
FPE_Encryptor::FPE_Encryptor(const SymmetricKey& key,
const BigInt& n,
- const std::vector<byte>& tweak)
+ const std::vector<uint8_t>& tweak)
{
m_mac.reset(new HMAC(new SHA_256));
m_mac->set_key(key);
- std::vector<byte> n_bin = BigInt::encode(n);
+ std::vector<uint8_t> n_bin = BigInt::encode(n);
if(n_bin.size() > MAX_N_BYTES)
throw Exception("N is too large for FPE encryption");
- m_mac->update_be(static_cast<u32bit>(n_bin.size()));
+ m_mac->update_be(static_cast<uint32_t>(n_bin.size()));
m_mac->update(n_bin.data(), n_bin.size());
- m_mac->update_be(static_cast<u32bit>(tweak.size()));
+ m_mac->update_be(static_cast<uint32_t>(tweak.size()));
m_mac->update(tweak.data(), tweak.size());
m_mac_n_t = unlock(m_mac->final());
@@ -112,15 +112,15 @@ FPE_Encryptor::FPE_Encryptor(const SymmetricKey& key,
BigInt FPE_Encryptor::operator()(size_t round_no, const BigInt& R)
{
- secure_vector<byte> r_bin = BigInt::encode_locked(R);
+ secure_vector<uint8_t> r_bin = BigInt::encode_locked(R);
m_mac->update(m_mac_n_t);
- m_mac->update_be(static_cast<u32bit>(round_no));
+ m_mac->update_be(static_cast<uint32_t>(round_no));
- m_mac->update_be(static_cast<u32bit>(r_bin.size()));
+ m_mac->update_be(static_cast<uint32_t>(r_bin.size()));
m_mac->update(r_bin.data(), r_bin.size());
- secure_vector<byte> X = m_mac->final();
+ secure_vector<uint8_t> X = m_mac->final();
return BigInt(X.data(), X.size());
}
@@ -131,7 +131,7 @@ BigInt FPE_Encryptor::operator()(size_t round_no, const BigInt& R)
*/
BigInt fe1_encrypt(const BigInt& n, const BigInt& X0,
const SymmetricKey& key,
- const std::vector<byte>& tweak)
+ const std::vector<uint8_t>& tweak)
{
FPE_Encryptor F(key, n, tweak);
@@ -159,7 +159,7 @@ BigInt fe1_encrypt(const BigInt& n, const BigInt& X0,
*/
BigInt fe1_decrypt(const BigInt& n, const BigInt& X0,
const SymmetricKey& key,
- const std::vector<byte>& tweak)
+ const std::vector<uint8_t>& tweak)
{
FPE_Encryptor F(key, n, tweak);