summaryrefslogtreecommitdiff
path: root/ecp.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-08-06 03:28:53 -0400
committerJeffrey Walton <noloader@gmail.com>2019-08-06 03:28:53 -0400
commite5ab7919f98326504629264253eb3ad68c0f3515 (patch)
treeaed1c9f9f98e9ee8428bc6307d4b9fc5a136ec73 /ecp.cpp
parent0ded32192e076de0aed888a451fa355f6c851b5c (diff)
downloadcryptopp-git-e5ab7919f98326504629264253eb3ad68c0f3515.tar.gz
Remove unneeded T in ECP Add()
Switch to 'R' variable in AdditionFunction to avoid shadow warnings
Diffstat (limited to 'ecp.cpp')
-rw-r--r--ecp.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/ecp.cpp b/ecp.cpp
index 7b5249b0..f669478d 100644
--- a/ecp.cpp
+++ b/ecp.cpp
@@ -661,7 +661,7 @@ ECP::Point ECP::AdditionFunction::operator()(const Point& P) const
}
else // A_Montgomery
{
- ECP::Point& m_R = m_ecp.m_R;
+ ECP::Point& R = m_ecp.m_R;
const ECP::Field& field = m_ecp.GetField();
const FieldElement& a = m_ecp.m_a;
@@ -672,15 +672,15 @@ ECP::Point ECP::AdditionFunction::operator()(const Point& P) const
t = field.Add(field.Add(field.Double(t), t), a);
t = field.Divide(t, field.Double(P.y));
FieldElement x = field.Subtract(field.Subtract(field.Square(t), P.x), P.x);
- m_R.y = field.Subtract(field.Multiply(t, field.Subtract(P.x, x)), P.y);
- m_R.x.swap(x);
+ R.y = field.Subtract(field.Multiply(t, field.Subtract(P.x, x)), P.y);
+ R.x.swap(x);
// More gyrations
- m_R.x *= IdentityToInteger(!identity);
- m_R.y *= IdentityToInteger(!identity);
- m_R.identity = identity;
+ R.x *= IdentityToInteger(!identity);
+ R.y *= IdentityToInteger(!identity);
+ R.identity = identity;
- return m_R;
+ return R;
}
}
@@ -870,7 +870,7 @@ ECP::Point ECP::AdditionFunction::operator()(const Point& P, const Point& Q) con
{
const ECP::Field& field = m_ecp.GetField();
const FieldElement& a = m_ecp.m_a;
- ECP::Point& R = m_ecp.m_R, S = m_ecp.m_R, T;
+ ECP::Point& R = m_ecp.m_R, S = m_ecp.m_R;
// More gyrations
bool return_Q = P.identity;
@@ -888,8 +888,8 @@ ECP::Point ECP::AdditionFunction::operator()(const Point& P, const Point& Q) con
t = field.Add(field.Add(field.Double(t), t), a);
t = field.Divide(t, field.Double(P.y));
FieldElement x = field.Subtract(field.Subtract(field.Square(t), P.x), P.x);
- T.y = field.Subtract(field.Multiply(t, field.Subtract(P.x, x)), P.y);
- T.x.swap(x);
+ R.y = field.Subtract(field.Multiply(t, field.Subtract(P.x, x)), P.y);
+ R.x.swap(x);
}
else
{
@@ -910,10 +910,8 @@ ECP::Point ECP::AdditionFunction::operator()(const Point& P, const Point& Q) con
return (R = S), Q;
else if (return_P)
return (R = S), P;
- else if (double_P)
- return (T = R), R;
else
- return (T = R), R;
+ return (S = R), R;
}
}