Skip to content

Commit

Permalink
fix: decode error wording
Browse files Browse the repository at this point in the history
  • Loading branch information
gstarovo committed Oct 30, 2024
1 parent aeb79a3 commit 317cca7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tlslite/keyexchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,9 @@ def makeServerKeyExchange(self, sigHash=None):
ext_c = self.clientHello.getExtension(ExtensionType.ec_point_formats)
ext_s = self.serverHello.getExtension(ExtensionType.ec_point_formats)
if ext_c:
if ECPointFormat.uncompressed not in ext_c.formats:
if ext_c.formats == []:
raise TLSDecodeError("The compression list is empty.")
elif ECPointFormat.uncompressed not in ext_c.formats:
raise TLSIllegalParameterException(
"The client does not advertise "
"the uncompressed point format extension.")
Expand Down Expand Up @@ -1133,7 +1135,7 @@ def calc_shared_key(self, private, peer_share,
except AssertionError:
raise TLSIllegalParameterException("Invalid ECC point")
except DecodeError:
raise TLSDecodeError("Unexpected error")
raise TLSDecodeError("Empty point format extension")
if isinstance(private, ecdsa.keys.SigningKey):
ecdh = ecdsa.ecdh.ECDH(curve=curve, private_key=private)
ecdh.load_received_public_key_bytes(peer_share,
Expand Down

0 comments on commit 317cca7

Please sign in to comment.