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/misc/fpe_fe1/fpe_fe1.cpp | 24 ++++++++++++------------ src/lib/misc/fpe_fe1/fpe_fe1.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/lib/misc/fpe_fe1') 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& tweak); + const std::vector& tweak); BigInt operator()(size_t i, const BigInt& R); private: std::unique_ptr m_mac; - std::vector m_mac_n_t; + std::vector m_mac_n_t; }; FPE_Encryptor::FPE_Encryptor(const SymmetricKey& key, const BigInt& n, - const std::vector& tweak) + const std::vector& tweak) { m_mac.reset(new HMAC(new SHA_256)); m_mac->set_key(key); - std::vector n_bin = BigInt::encode(n); + std::vector 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(n_bin.size())); + m_mac->update_be(static_cast(n_bin.size())); m_mac->update(n_bin.data(), n_bin.size()); - m_mac->update_be(static_cast(tweak.size())); + m_mac->update_be(static_cast(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 r_bin = BigInt::encode_locked(R); + secure_vector r_bin = BigInt::encode_locked(R); m_mac->update(m_mac_n_t); - m_mac->update_be(static_cast(round_no)); + m_mac->update_be(static_cast(round_no)); - m_mac->update_be(static_cast(r_bin.size())); + m_mac->update_be(static_cast(r_bin.size())); m_mac->update(r_bin.data(), r_bin.size()); - secure_vector X = m_mac->final(); + secure_vector 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& tweak) + const std::vector& 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& tweak) + const std::vector& tweak) { FPE_Encryptor F(key, n, tweak); diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.h b/src/lib/misc/fpe_fe1/fpe_fe1.h index a1cae9917..fe86f0718 100644 --- a/src/lib/misc/fpe_fe1/fpe_fe1.h +++ b/src/lib/misc/fpe_fe1/fpe_fe1.h @@ -28,7 +28,7 @@ namespace FPE { */ BigInt BOTAN_DLL fe1_encrypt(const BigInt& n, const BigInt& X, const SymmetricKey& key, - const std::vector& tweak); + const std::vector& tweak); /** * Decrypt X from and onto the group Z_n using key and tweak @@ -39,7 +39,7 @@ BigInt BOTAN_DLL fe1_encrypt(const BigInt& n, const BigInt& X, */ BigInt BOTAN_DLL fe1_decrypt(const BigInt& n, const BigInt& X, const SymmetricKey& key, - const std::vector& tweak); + const std::vector& tweak); } -- cgit v1.2.3