From d5354c1c3ee0067dd35ca253d4b8914f870cea75 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 18 Jan 2014 23:00:53 +0000 Subject: More unique_ptr, and pull all the way up to types.h --- src/lib/constructs/fpe_fe1/fpe_fe1.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/lib/constructs/fpe_fe1/fpe_fe1.cpp') diff --git a/src/lib/constructs/fpe_fe1/fpe_fe1.cpp b/src/lib/constructs/fpe_fe1/fpe_fe1.cpp index b22d3a8df..da0ef1081 100644 --- a/src/lib/constructs/fpe_fe1/fpe_fe1.cpp +++ b/src/lib/constructs/fpe_fe1/fpe_fe1.cpp @@ -1,8 +1,5 @@ /* -* Format Preserving Encryption using the scheme FE1 from the paper -* "Format-Preserving Encryption" by Bellare, Rogaway, et al -* (http://eprint.iacr.org/2009/251) -* +* Format Preserving Encryption (FE1 scheme) * (C) 2009 Jack Lloyd * * Distributed under the terms of the Botan license @@ -13,6 +10,7 @@ #include #include #include +#include namespace Botan { @@ -86,12 +84,10 @@ class FPE_Encryptor const BigInt& n, const std::vector& tweak); - ~FPE_Encryptor() { delete mac; } - BigInt operator()(size_t i, const BigInt& R); private: - MessageAuthenticationCode* mac; + std::unique_ptr mac; std::vector mac_n_t; }; @@ -99,7 +95,7 @@ FPE_Encryptor::FPE_Encryptor(const SymmetricKey& key, const BigInt& n, const std::vector& tweak) { - mac = new HMAC(new SHA_256); + mac.reset(new HMAC(new SHA_256)); mac->set_key(key); std::vector n_bin = BigInt::encode(n); -- cgit v1.2.3