Skip to content

Commit 72900fc

Browse files
committed
use PointJacobi for ECDH
this is a crude way to use the new features in python-ecdsa, will need to be reworked later (to use ECDH object)
1 parent 9396ca0 commit 72900fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tlslite/utils/ecc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ def decodeX962Point(data, curve=ecdsa.NIST256p):
2020
yCoord = bytesToNumber(parser.getFixBytes(bytelength))
2121
if parser.getRemainingLength():
2222
raise DecodeError("Invalid length of point encoding for curve")
23-
return ecdsa.ellipticcurve.Point(curve.curve, xCoord, yCoord)
23+
if not xCoord or not yCoord:
24+
raise DecodeError("Zero as key share from peer")
25+
if not curve.curve.contains_point(xCoord, yCoord):
26+
raise DecodeError("Key share from peer is not a valid point on curve")
27+
return ecdsa.ellipticcurve.PointJacobi(curve.curve, xCoord, yCoord, 1)
2428

2529

2630
def encodeX962Point(point):

0 commit comments

Comments
 (0)