diff options
author | Jack Lloyd <[email protected]> | 2018-12-06 21:13:53 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-06 21:13:53 -0500 |
commit | 81eb78f723f6d80f505d017b57ac409cda85ca44 (patch) | |
tree | dc82d05cdce1654c74f02a873525bccd957e4962 | |
parent | 68c12b19077205c9c4ff2069072fcd986e0e4c30 (diff) |
Better logic in BigInt::bits wrt valgrind const time checks
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index 9fd019d87..dd5ee6ac3 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -284,9 +284,10 @@ size_t BigInt::bits() const return 0; const size_t full_words = words - 1; - const size_t bits = (full_words * BOTAN_MP_WORD_BITS + high_bit(word_at(full_words))); + const word top_word = word_at(full_words); // Need to unpoison due to high_bit not being const time - CT::unpoison(bits); + CT::unpoison(top_word); + const size_t bits = (full_words * BOTAN_MP_WORD_BITS + high_bit(top_word)); return bits; } |