diff options
author | Jack Lloyd <[email protected]> | 2017-09-26 09:52:47 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-26 09:52:47 -0400 |
commit | 2718c02d429d024b2cd65534f7e54cab1d123348 (patch) | |
tree | 2b80589183ed3ddc29fc656c454d207dba4cd2ba | |
parent | a3c4ec54ba8f611e7ef41867a4ed0fd669ef8057 (diff) |
Add valgrind annotations to check const_time_lookup
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index 126688de9..47ff2482a 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -307,6 +307,8 @@ void BigInt::const_time_lookup(secure_vector<word>& output, clear_mem(output.data(), output.size()); + CT::poison(&idx, sizeof(idx)); + for(size_t i = 0; i != vec.size(); ++i) { BOTAN_ASSERT(vec[i].size() >= words, @@ -315,6 +317,9 @@ void BigInt::const_time_lookup(secure_vector<word>& output, for(size_t w = 0; w != words; ++w) output[w] |= CT::select<word>(CT::is_equal(i, idx), vec[i].word_at(w), 0); } + + CT::unpoison(idx); + CT::unpoison(output.data(), output.size()); } } |