diff options
author | lloyd <[email protected]> | 2010-03-15 17:51:40 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-15 17:51:40 +0000 |
commit | ddf2d1af53b96da47ceee166f5527eaaa16f8928 (patch) | |
tree | bd8c166ab2f41abd10fda4dfe01429d4312f9533 /src/math/numbertheory/curve_gfp.h | |
parent | 65e5a8826f4240fd0b21ad99ab9daa9da862fc29 (diff) |
Cache p.sig_words() in curve object
Avoid using Barett reduction in core operations; seems to help perf.
Diffstat (limited to 'src/math/numbertheory/curve_gfp.h')
-rw-r--r-- | src/math/numbertheory/curve_gfp.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/math/numbertheory/curve_gfp.h b/src/math/numbertheory/curve_gfp.h index a7be8987c..0a91fc52d 100644 --- a/src/math/numbertheory/curve_gfp.h +++ b/src/math/numbertheory/curve_gfp.h @@ -44,6 +44,8 @@ class BOTAN_DLL CurveGFp p_dash = (((r * r_inv) - 1) / p).word_at(0); a_r = reducer_p.multiply(a, r); + + p_words = p.sig_words(); } // CurveGFp(const CurveGFp& other) = default; @@ -87,6 +89,11 @@ class BOTAN_DLL CurveGFp */ word get_p_dash() const { return p_dash; } + /** + * @return p.sig_words() + */ + u32bit get_p_words() const { return p_words; } + const Modular_Reducer& mod_p() const { return reducer_p; } /** @@ -114,6 +121,8 @@ class BOTAN_DLL CurveGFp // Curve parameters BigInt p, a, b; + u32bit p_words; // cache of p.sig_words() + // Montgomery parameters BigInt r, r_inv, a_r; word p_dash; |