aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-09 04:55:48 -0500
committerJack Lloyd <[email protected]>2018-03-09 04:55:48 -0500
commitb16a5c460d785a41137f5c758f3e1fa5a4bc7cbd (patch)
tree8732066ea0a8f1885fd268e8515b99d4685a4df2 /src/lib/pubkey
parent87085b1c844555c1516dd8a930847aa3972b134e (diff)
Cleanup comments
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/ec_group/point_gfp.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp
index 1f8dc3147..c71a6cffe 100644
--- a/src/lib/pubkey/ec_group/point_gfp.cpp
+++ b/src/lib/pubkey/ec_group/point_gfp.cpp
@@ -78,11 +78,6 @@ void PointGFp::add_affine(const PointGFp& rhs, std::vector<BigInt>& ws_bn)
//BOTAN_ASSERT(rhs.is_affine(), "PointGFp::add_affine requires arg be affine point");
- /*
- https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-1998-cmo-2
- simplified with Z2 = 1
- */
-
const BigInt& p = m_curve.get_p();
const size_t cap_size = 2*m_curve.get_p_words() + 2;
@@ -102,6 +97,7 @@ void PointGFp::add_affine(const PointGFp& rhs, std::vector<BigInt>& ws_bn)
/*
https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-1998-cmo-2
+ simplified with Z2 = 1
*/
m_curve.sqr(T3, m_coord_z, ws); // z1^2
@@ -272,10 +268,6 @@ void PointGFp::mult2(std::vector<BigInt>& ws_bn)
return;
}
- /*
- https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-1986-cc
- */
-
const size_t cap_size = 2*m_curve.get_p_words() + 2;
BOTAN_ASSERT(ws_bn.size() >= WORKSPACE_SIZE, "Expected size for PointGFp::add workspace");
@@ -291,6 +283,10 @@ void PointGFp::mult2(std::vector<BigInt>& ws_bn)
BigInt& T3 = ws_bn[4];
BigInt& T4 = ws_bn[5];
+ /*
+ https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-1986-cc
+ */
+
m_curve.sqr(T0, m_coord_y, ws);
m_curve.mul(T1, m_coord_x, T0, ws);
@@ -311,7 +307,6 @@ void PointGFp::mult2(std::vector<BigInt>& ws_bn)
T2 -= T1;
while(T2.is_negative())
T2 += p;
- m_coord_x = T2;
m_curve.sqr(T3, T0, ws);
T3 <<= 3;
@@ -326,6 +321,8 @@ void PointGFp::mult2(std::vector<BigInt>& ws_bn)
if(T0.is_negative())
T0 += p;
+ m_coord_x = T2;
+
m_curve.mul(T2, m_coord_y, m_coord_z, ws);
T2 <<= 1;
T2.reduce_below(p, T3.get_word_vector());