diff options
author | Jack Lloyd <[email protected]> | 2018-12-22 08:31:04 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-22 08:31:04 -0500 |
commit | 108ccfa35f5d24e41c586c5b1184934f6f538d52 (patch) | |
tree | 3d48821506144c9a85f28d7176bf37554db8e575 /src/lib/math/bigint/bigint.cpp | |
parent | 7c92530d47f9c7475f76e3d547480cb62c82a148 (diff) |
Make ctz and high_bit faster and const-time-ish
They get compiled as const-time on x86-64 with GCC but I don't think
this can be totally relied on. But it is anyway an improvement.
And, faster, because we compute it recursively
Diffstat (limited to 'src/lib/math/bigint/bigint.cpp')
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index d8861fe65..75c87e5b6 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -279,12 +279,7 @@ size_t BigInt::top_bits_free() const const size_t words = sig_words(); const word top_word = word_at(words - 1); - - // Need to unpoison due to high_bit not being const time - CT::unpoison(top_word); - const size_t bits_used = high_bit(top_word); - return BOTAN_MP_WORD_BITS - bits_used; } |