From 317cca7aa46f3d1c7c7d91229a952915603021c1 Mon Sep 17 00:00:00 2001 From: gstarovo Date: Wed, 30 Oct 2024 14:16:51 +0100 Subject: [PATCH] fix: decode error wording --- tlslite/keyexchange.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tlslite/keyexchange.py b/tlslite/keyexchange.py index 8b726c1e..7dd60a39 100644 --- a/tlslite/keyexchange.py +++ b/tlslite/keyexchange.py @@ -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.") @@ -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,