Skip to content

Commit

Permalink
Merge 6bcb322 into 2b1e0ed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Dec 18, 2019
2 parents 2b1e0ed + 6bcb322 commit 01b1efd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 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
3 changes: 2 additions & 1 deletion build-requirements-2.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ coverage
hypothesis
coveralls
pylint
diff_cover
mock
diff_cover<2.5.0
pytest>=4.6.5
4 changes: 2 additions & 2 deletions build-requirements-3.3.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enum34
coverage
coverage<5.0
hypothesis<3.44
coveralls
pylint
diff_cover
diff_cover<2.5.0
typed-ast<1.3.0
3 changes: 2 additions & 1 deletion tlslite/keyexchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .utils.x25519 import x25519, x448, X25519_G, X448_G, X25519_ORDER_SIZE, \
X448_ORDER_SIZE
from .utils.compat import int_types
from .utils.codec import DecodeError


class KeyExchange(object):
Expand Down Expand Up @@ -907,7 +908,7 @@ def calc_shared_key(self, private, peer_share):
try:
ecdhYc = decodeX962Point(peer_share,
curve)
except AssertionError:
except (AssertionError, DecodeError):
raise TLSIllegalParameterException("Invalid ECC point")

S = ecdhYc * private
Expand Down
4 changes: 3 additions & 1 deletion tlslite/utils/ecc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def decodeX962Point(data, curve=ecdsa.NIST256p):
bytelength = getPointByteSize(curve)
xCoord = bytesToNumber(parser.getFixBytes(bytelength))
yCoord = bytesToNumber(parser.getFixBytes(bytelength))
return ecdsa.ellipticcurve.Point(curve.curve, xCoord, yCoord)
assert xCoord and yCoord
assert curve.curve.contains_point(xCoord, yCoord)
return ecdsa.ellipticcurve.PointJacobi(curve.curve, xCoord, yCoord, 1)

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

0 comments on commit 01b1efd

Please sign in to comment.