Skip to content

Commit

Permalink
Merge 44a7281 into 9396ca0
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Jan 20, 2020
2 parents 9396ca0 + 44a7281 commit 040fb73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ before_install:
- git fetch origin master:refs/remotes/origin/master
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- pushd "$(mktemp -d)"
- git clone https://github.com/tomato42/python-ecdsa.git
- cd python-ecdsa
- python setup.py install
- popd

install:
- if [[ -e build-requirements-${TRAVIS_PYTHON_VERSION}.txt ]]; then travis_retry pip install -r build-requirements-${TRAVIS_PYTHON_VERSION}.txt; else travis_retry pip install -r build-requirements.txt; fi
Expand Down
9 changes: 7 additions & 2 deletions tlslite/utils/ecc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ def decodeX962Point(data, curve=ecdsa.NIST256p):
yCoord = bytesToNumber(parser.getFixBytes(bytelength))
if parser.getRemainingLength():
raise DecodeError("Invalid length of point encoding for curve")
return ecdsa.ellipticcurve.Point(curve.curve, xCoord, yCoord)

if not xCoord or not yCoord:
raise DecodeError("Zero as key share from peer")
if not curve.curve.contains_point(xCoord, yCoord):
raise DecodeError("Key share from peer is not a valid point on curve")
# pylint: disable=c-extension-no-member
return ecdsa.ellipticcurve.PointJacobi(curve.curve, xCoord, yCoord, 1)
# pylint: enable=c-extension-no-member

def encodeX962Point(point):
"""Encode a point in X9.62 format"""
Expand Down

0 comments on commit 040fb73

Please sign in to comment.