Skip to content

Commit

Permalink
Merge f944131 into 2b1e0ed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Dec 16, 2019
2 parents 2b1e0ed + f944131 commit ee574c1
Show file tree
Hide file tree
Showing 3 changed files with 10 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
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 ee574c1

Please sign in to comment.