diff options
author | Jack Lloyd <[email protected]> | 2018-06-21 10:58:00 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-06-21 10:58:00 -0400 |
commit | 656f08f67b1c69316121d27d446270e8eb8b16f2 (patch) | |
tree | dbaf83ef4017a6f7bc7bcd7129d02f54d6d705af | |
parent | ee4813b2ce873c6965391c0543bf4dfc25fa2338 (diff) |
Fix a header comment and inline PointGFp::add/add_affine
-rw-r--r-- | src/lib/pubkey/ec_group/point_gfp.cpp | 22 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/point_gfp.h | 27 |
2 files changed, 23 insertions, 26 deletions
diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp index 26b2ec371..5bbef15e7 100644 --- a/src/lib/pubkey/ec_group/point_gfp.cpp +++ b/src/lib/pubkey/ec_group/point_gfp.cpp @@ -86,17 +86,6 @@ inline bool all_zeros(const word x[], size_t len) } -void PointGFp::add_affine(const PointGFp& rhs, std::vector<BigInt>& workspace) - { - BOTAN_ASSERT_NOMSG(m_curve == rhs.m_curve); - BOTAN_DEBUG_ASSERT(rhs.is_affine()); - - const size_t p_words = m_curve.get_p_words(); - add_affine(rhs.m_coord_x.data(), std::min(p_words, rhs.m_coord_x.size()), - rhs.m_coord_y.data(), std::min(p_words, rhs.m_coord_y.size()), - workspace); - } - void PointGFp::add_affine(const word x_words[], size_t x_size, const word y_words[], size_t y_size, std::vector<BigInt>& ws_bn) @@ -179,17 +168,6 @@ void PointGFp::add_affine(const word x_words[], size_t x_size, m_coord_z = T3; } -void PointGFp::add(const PointGFp& rhs, std::vector<BigInt>& workspace) - { - BOTAN_ASSERT_NOMSG(m_curve == rhs.m_curve); - - const size_t p_words = m_curve.get_p_words(); - add(rhs.m_coord_x.data(), std::min(p_words, rhs.m_coord_x.size()), - rhs.m_coord_y.data(), std::min(p_words, rhs.m_coord_y.size()), - rhs.m_coord_z.data(), std::min(p_words, rhs.m_coord_z.size()), - workspace); - } - void PointGFp::add(const word x_words[], size_t x_size, const word y_words[], size_t y_size, const word z_words[], size_t z_size, diff --git a/src/lib/pubkey/ec_group/point_gfp.h b/src/lib/pubkey/ec_group/point_gfp.h index bc8a8571f..fa447bf87 100644 --- a/src/lib/pubkey/ec_group/point_gfp.h +++ b/src/lib/pubkey/ec_group/point_gfp.h @@ -215,7 +215,17 @@ class BOTAN_PUBLIC_API(2,0) PointGFp final * @param other the point to add to *this * @param workspace temp space, at least WORKSPACE_SIZE elements */ - void add(const PointGFp& other, std::vector<BigInt>& workspace); + void add(const PointGFp& other, std::vector<BigInt>& workspace) + { + BOTAN_ASSERT_NOMSG(m_curve == other.m_curve); + + const size_t p_words = m_curve.get_p_words(); + + add(other.m_coord_x.data(), std::min(p_words, other.m_coord_x.size()), + other.m_coord_y.data(), std::min(p_words, other.m_coord_y.size()), + other.m_coord_z.data(), std::min(p_words, other.m_coord_z.size()), + workspace); + } /** * Point addition. Array version. @@ -224,8 +234,8 @@ class BOTAN_PUBLIC_API(2,0) PointGFp final * @param x_size size of x_words * @param y_words the words of the y coordinate of the other point * @param y_size size of y_words - * @param z_words the words of the y coordinate of the other point - * @param z_size size of y_words + * @param z_words the words of the z coordinate of the other point + * @param z_size size of z_words * @param workspace temp space, at least WORKSPACE_SIZE elements */ void add(const word x_words[], size_t x_size, @@ -238,7 +248,16 @@ class BOTAN_PUBLIC_API(2,0) PointGFp final * @param other affine point to add - assumed to be affine! * @param workspace temp space, at least WORKSPACE_SIZE elements */ - void add_affine(const PointGFp& other, std::vector<BigInt>& workspace); + void add_affine(const PointGFp& other, std::vector<BigInt>& workspace) + { + BOTAN_ASSERT_NOMSG(m_curve == other.m_curve); + BOTAN_DEBUG_ASSERT(other.is_affine()); + + const size_t p_words = m_curve.get_p_words(); + add_affine(other.m_coord_x.data(), std::min(p_words, other.m_coord_x.size()), + other.m_coord_y.data(), std::min(p_words, other.m_coord_y.size()), + workspace); + } /** * Point addition - mixed J+A. Array version. |