From e8ecdefacf23c5198b8867ffeb2768bfa9b6ab95 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikegami Date: Wed, 15 Jul 2026 19:53:11 +0900 Subject: [PATCH] tls: pass raw digest bytes to prehashed sign() fastecdsa's sign(..., prehashed=True) now requires the prehashed message to be bytes and hexlifies it internally (see fastecdsa ecdsa._hex_digest), raising: TypeError: Prehashed message must be bytes, got make_cert_verify() was passing an already hex-encoded str (hexlify(buf).decode()). Pass the raw digest bytes (buf) instead; fastecdsa produces the identical hex digest internally, so the signature is unchanged. This breaks sensor pairing/initialization on modern fastecdsa (3.x). --- proto9x/tls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto9x/tls.py b/proto9x/tls.py index e1c7759..d672775 100644 --- a/proto9x/tls.py +++ b/proto9x/tls.py @@ -240,7 +240,7 @@ def make_client_kex(self): def make_cert_verify(self): buf=self.handshake_hash.copy().digest() - s=sign(hexlify(buf).decode(), self.priv_key, prehashed=True) + s=sign(buf, self.priv_key, prehashed=True) b=DEREncoder().encode_signature(s[0], s[1]) return self.with_neg_hdr(0x0f, b)