From 6c3eef4013e7da971ae884fd4dcb8318fbfcc05b Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 3 Dec 2018 06:20:55 -0500 Subject: Use ct_modulo in format preserving encryption --- src/lib/misc/fpe_fe1/fpe_fe1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/misc/fpe_fe1/fpe_fe1.cpp b/src/lib/misc/fpe_fe1/fpe_fe1.cpp index 3bd01ce34..98ada495a 100644 --- a/src/lib/misc/fpe_fe1/fpe_fe1.cpp +++ b/src/lib/misc/fpe_fe1/fpe_fe1.cpp @@ -151,7 +151,7 @@ BigInt FPE_FE1::encrypt(const BigInt& input, const uint8_t tweak[], size_t tweak BigInt L, R, Fi; for(size_t i = 0; i != m_rounds; ++i) { - divide(X, m_b, L, R); + ct_divide(X, m_b, L, R); Fi = F(R, i, tweak_mac, tmp); X = m_a * R + mod_a->reduce(L + Fi); } @@ -169,7 +169,7 @@ BigInt FPE_FE1::decrypt(const BigInt& input, const uint8_t tweak[], size_t tweak BigInt W, R, Fi; for(size_t i = 0; i != m_rounds; ++i) { - divide(X, m_a, R, W); + ct_divide(X, m_a, R, W); Fi = F(R, m_rounds-i-1, tweak_mac, tmp); X = m_b * mod_a->reduce(W - Fi) + R; -- cgit v1.2.3