aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-13 06:05:08 -0500
committerJack Lloyd <[email protected]>2018-02-13 06:05:08 -0500
commitffc60894c2b4cb733050f008a8f229bb94de5745 (patch)
tree401924ab7234d10f736fcc2904c3eebda5d484d3
parent3d868667ab5a29c31acde34c22b5b4176619260e (diff)
Tiny optimization in BigInt::const_time_lookup
-rw-r--r--src/lib/math/bigint/bigint.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index 28fe68f00..caa78de45 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -314,8 +314,10 @@ void BigInt::const_time_lookup(secure_vector<word>& output,
BOTAN_ASSERT(vec[i].size() >= words,
"Word size as expected in const_time_lookup");
+ const word mask = CT::is_equal(i, idx);
+
for(size_t w = 0; w != words; ++w)
- output[w] |= CT::select<word>(CT::is_equal(i, idx), vec[i].word_at(w), 0);
+ output[w] |= CT::select<word>(mask, vec[i].word_at(w), 0);
}
CT::unpoison(idx);