diff options
author | Jack Lloyd <[email protected]> | 2018-03-19 11:00:50 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-20 09:36:40 -0400 |
commit | 737f33c09a18500e044dca3e2ae13bd2c08bafdd (patch) | |
tree | 95b8ae5d2750e1e78dd0e500c33c8c103e8bf42c /src/lib/pubkey/ec_group/curve_gfp.h | |
parent | b08f7beb877569fd94736c5a67b9e28fcdd968b6 (diff) |
Store base point multiplies in a single std::vector
Since the point is public all the values are also, so this reduces
pressure on the mlock allocator and may (slightly) help perf through
cache read-ahead.
Downside is cache based side channels are slightly easier (vs the
data being stored in discontigious vectors). But we shouldn't rely
on that in any case. And having it be in an array makes a masked
table lookup easier to arrange.
Diffstat (limited to 'src/lib/pubkey/ec_group/curve_gfp.h')
-rw-r--r-- | src/lib/pubkey/ec_group/curve_gfp.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/pubkey/ec_group/curve_gfp.h b/src/lib/pubkey/ec_group/curve_gfp.h index 2c2d9e619..076922ceb 100644 --- a/src/lib/pubkey/ec_group/curve_gfp.h +++ b/src/lib/pubkey/ec_group/curve_gfp.h @@ -49,6 +49,12 @@ class BOTAN_UNSTABLE_API CurveGFp_Repr virtual void curve_mul(BigInt& z, const BigInt& x, const BigInt& y, secure_vector<word>& ws) const = 0; + virtual void curve_mul_words(BigInt& z, + const word x_words[], + const size_t x_size, + const BigInt& y, + secure_vector<word>& ws) const = 0; + virtual void curve_sqr(BigInt& z, const BigInt& x, secure_vector<word>& ws) const = 0; }; @@ -135,6 +141,12 @@ class BOTAN_UNSTABLE_API CurveGFp final m_repr->curve_mul(z, x, y, ws); } + void mul(BigInt& z, const word x_w[], size_t x_size, + const BigInt& y, secure_vector<word>& ws) const + { + m_repr->curve_mul_words(z, x_w, x_size, y, ws); + } + void sqr(BigInt& z, const BigInt& x, secure_vector<word>& ws) const { m_repr->curve_sqr(z, x, ws); |