diff options
author | Jack Lloyd <[email protected]> | 2020-03-06 07:04:42 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-03-06 07:04:42 -0500 |
commit | 423dcc43daeab24111f5fedffd1cf17255d2d14c (patch) | |
tree | b0f95335a7b55b191170f371bcd4d7497c4f38b5 | |
parent | 06a55af16fbee536cf3aa53370195b22327ca54f (diff) |
Remove commented out non-constant-time code
Quick testing indicates it is not even faster than the CT version anymore.
-rw-r--r-- | src/lib/math/bigint/big_ops2.cpp | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/lib/math/bigint/big_ops2.cpp b/src/lib/math/bigint/big_ops2.cpp index 28147b589..cc85f5e96 100644 --- a/src/lib/math/bigint/big_ops2.cpp +++ b/src/lib/math/bigint/big_ops2.cpp @@ -107,31 +107,12 @@ BigInt& BigInt::mod_sub(const BigInt& s, const BigInt& mod, secure_vector<word>& if(ws.size() < mod_sw) ws.resize(mod_sw); -#if 0 - //Faster but not const time: - - // Compute t - s - word borrow = bigint_sub3(ws.data(), data(), mod_sw, s.data(), mod_sw); - - if(borrow) - { - // If t < s, instead compute p - (s - t) - bigint_sub2_rev(mutable_data(), s.data(), mod_sw); - bigint_sub2_rev(mutable_data(), mod.data(), mod_sw); - } - else - { - // No borrow so we already have the result we need - swap_reg(ws); - } -#else if(mod_sw == 4) bigint_mod_sub_n<4>(mutable_data(), s.data(), mod.data(), ws.data()); else if(mod_sw == 6) bigint_mod_sub_n<6>(mutable_data(), s.data(), mod.data(), ws.data()); else bigint_mod_sub(mutable_data(), s.data(), mod.data(), mod_sw, ws.data()); -#endif return (*this); } |