diff options
-rw-r--r-- | src/lib/math/bigint/bigint.h | 6 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/point_gfp.cpp | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 0b826c8f5..8c627c584 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -445,6 +445,12 @@ class BOTAN_PUBLIC_API(2,0) BigInt final m_reg[i] = w; } + void set_words(const word w[], size_t len) + { + m_reg.resize(len); + copy_mem(mutable_data(), w, len); + } + /** * Tests if the sign of the integer is negative * @result true, iff the integer has a negative sign diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp index 5bbef15e7..4c048427f 100644 --- a/src/lib/pubkey/ec_group/point_gfp.cpp +++ b/src/lib/pubkey/ec_group/point_gfp.cpp @@ -95,9 +95,8 @@ void PointGFp::add_affine(const word x_words[], size_t x_size, if(is_zero()) { - // FIXME avoid the copy here - m_coord_x = BigInt(x_words, x_size); - m_coord_y = BigInt(y_words, y_size); + m_coord_x.set_words(x_words, x_size); + m_coord_y.set_words(y_words, y_size); m_coord_z = m_curve.get_1_rep(); return; } @@ -178,10 +177,9 @@ void PointGFp::add(const word x_words[], size_t x_size, if(is_zero()) { - // FIXME avoid the copy here - m_coord_x = BigInt(x_words, x_size); - m_coord_y = BigInt(y_words, y_size); - m_coord_z = BigInt(z_words, z_size); + m_coord_x.set_words(x_words, x_size); + m_coord_y.set_words(y_words, y_size); + m_coord_z.set_words(z_words, z_size); return; } |