| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Quick testing indicates it is not even faster than the CT version anymore.
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This would continually reallocate to larger sizes which is bad news.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
We already assumed the args are < modulus so we can avoid the
call to sig_words. This provides a noticable speedup for ECDSA overall.
|
| |
|
| |
|
|
|
|
| |
Avoids needless allocations for expressions like x - 1 or y <= 4.
|
| |
|
| |
|
| |
|
|
|
|
| |
Use the BOTAN_MP_WORD_BITS consistently
|
|
|
|
| |
Kind of amazing what a difference that made for overall ECDSA perf
|
| |
|
|
|
|
|
|
|
|
|
|
| |
OSS-Fuzz 6570 flagged an issue with slow modular exponentation.
It turned out the problem was not in the library version but the
simple square-and-multiply algorithm. Computing g^x % p with all
three integers being dense (high Hamming weight) numbers took about
1.5 seconds on a fast machine with almost all of the time taken
by the Barrett reductions. With these changes, same testcase
now takes only a tiny fraction of a second.
|
|
|
|
| |
Avoids memory allocation when multiplying by a small constant.
|
|
|
|
|
|
| |
These functions made assumptions about the workspace size available,
which if incorrect would cause memory corruption. Since the length is
always available at the caller, just provide it and avoid problems.
|
|
|
|
| |
Makes 4-6% difference for ECDSA
|
| |
|
|
|
|
|
|
| |
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
|
|
|
|
|
|
| |
- reduced number of parameters in various methods
- introduced structures and renamed variables to improve code
readability.
|
| |
|
|
|
|
|
| |
Update license header line to specify the terms and refer to the file,
neither of which it included before.
|
|
|