Skip to content

Commit fafbcaf

Browse files
authored
Merge pull request #326 from tlsfuzzer/remove-extra-adds
Remove unnecessary adds from mul_add
2 parents 5a8ff7f + c3966c8 commit fafbcaf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ecdsa/ellipticcurve.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,8 @@ def mul_add(self, self_mul, other, other_mul):
10081008
# so we need 4 combined points:
10091009
mAmB_X, mAmB_Y, mAmB_Z = _add(X1, -Y1, Z1, X2, -Y2, Z2, p)
10101010
pAmB_X, pAmB_Y, pAmB_Z = _add(X1, Y1, Z1, X2, -Y2, Z2, p)
1011-
mApB_X, mApB_Y, mApB_Z = _add(X1, -Y1, Z1, X2, Y2, Z2, p)
1012-
pApB_X, pApB_Y, pApB_Z = _add(X1, Y1, Z1, X2, Y2, Z2, p)
1011+
mApB_X, mApB_Y, mApB_Z = pAmB_X, -pAmB_Y, pAmB_Z
1012+
pApB_X, pApB_Y, pApB_Z = mAmB_X, -mAmB_Y, mAmB_Z
10131013
# when the self and other sum to infinity, we need to add them
10141014
# one by one to get correct result but as that's very unlikely to
10151015
# happen in regular operation, we don't need to optimise this case

0 commit comments

Comments
 (0)