| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Add const-time annotations to gcd implementation.
|
|
|
|
| |
OSS-Fuzz 21115
|
|\ |
|
| |
| |
| |
| | |
Also make low_zero_bits constant time.
|
|/
|
|
| |
Quick testing indicates it is not even faster than the CT version anymore.
|
|
|
|
| |
Gives a small but measurable speedup (~1-2%) for RSA and ECDSA
|
|
|
|
|
| |
Turns out to be a pessimization - removing improves ECDSA verify
by up to 5% on Skylake.
|
| |
|
|
|
|
| |
Caused an extra allocation for no reason in some cases.
|
|
|
|
| |
Based on profiling RSA key generation
|
|
|
|
|
|
|
|
|
|
| |
Create BOTAN_DEPRECATED_HEADER so we can warn about this consistently.
Shuffle around the filter headers so all of the concrete filters
are defined in filters.h instead of being spread across many headers.
Document which headers are deprecated as well as a list of headers which
will be made internal-only in a future major release.
|
| |
|
| |
|
|
|
|
| |
Deprecate some crufty functions. Optimize binary encoding/decoding.
|
|
|
|
|
| |
Use ct_is_zero instead of more complicated construction, and
avoid duplicated size check/resize - Data::set_word will handle it.
|
|
|
|
|
| |
Previously we unpoisoned the input to high_bit but this is no
longer required. But still the output should be unpoisoned.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
The decoding leaked some information about the delimiter index
due to copying only exactly input_len - delim_idx bytes. I can't
articulate a specific attack that would work here, but it is easy
enough to fix this to run in const time instead, where all bytes
are accessed regardless of the length of the padding.
CT::copy_out is O(n^2) and thus terrible, but in practice it is only
used with RSA decryption, and multiplication is also O(n^2) with the
modulus size, so a few extra cycles here doesn't matter much.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
They would previously leak for example if the requested shift was 0.
However, that should only happen in two situations: very dumb code
explicitly requested a shift of zero (in which case we don't care if
performance is poor, your code is dumb) or a variable shift that just
happens to be zero, in which case the variable may be a secret, for
instance this can be seen in the GCD computation.
|
| | |
|
|\ \
| |/
|/| |
|
| | |
|
|/ |
|
|
|
|
| |
Saves 5% for ECDSA
|
|
|
|
| |
If not negative we don't need to check the size
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This is still leaky, but much less than before.
|
|
|
|
| |
Unfortunately Barrett reductions API allows negative inputs
|
| |
|
|
|
|
| |
This would continually reallocate to larger sizes which is bad news.
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Originally wrote it for div-by-word but that ends up requiring a dword
type which we don't always have. And uint8_t covers the most important
cases of n = 10 and n = 58 (whenever I get around to writing base58).
We could portably support up to div-by-uint32, but I don't think we need it.
Nicely for n = 10, this is actually faster than the variable time division.
|
|/
|
|
| |
This is still leaky, but better than nothing.
|
|
|
|
|
|
|
|
| |
It is stupid and slow (~50-100x slower than variable time version) but
still useful for protecting critical algorithms.
Not currently used, waiting for OSS-Fuzz to test it for a while before
we commit to it.
|
|
|
|
|
|
| |
If reducing a negative number modulo a power of 2, an incorrect
result would be returned. This only affected the versions taking
a single word as the modulo.
|
| |
|
| |
|
|
|
|
|
| |
Addition already has to handle negative numbers so make it do
double duty for subtraction.
|
| |
|
|
|
|
| |
In particular comparisons, calc sig words, and mod_sub are const time now.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid throwing base Botan::Exception type, as it is difficult to
determine what the error is in that case.
Add Exception::error_code and Exception::error_type which allows
(for error code) more information about the error and (for error type)
allows knowing the error type without requiring a sequence of catches.
See GH #1742
|
|/ |
|
|
|
|
| |
Avoid recalculating significant words which slows down reduction
|