Repository navigation
Conversation
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 <class 'str'>
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On modern
fastecdsa(3.x), sensor pairing/initialization fails with:fastecdsa.ecdsa.sign(..., prehashed=True)now requires the prehashedmessage to be
bytesand hexlifies it internally (see_hex_digestinfastecdsa's
ecdsa.py). HoweverTls.make_cert_verify()passes analready hex-encoded
str(hexlify(buf).decode()), which trips the newtype check and aborts the TLS handshake during
validity-sensors-toolsinitialization / pairing.
Fix
Pass the raw digest bytes (
buf) directly. fastecdsa hexlifies itinternally, producing the identical hex digest that was previously
passed by hand, so the resulting signature is unchanged — this is
behavior-preserving on old fastecdsa and fixes it on new fastecdsa.
Testing
Verified end-to-end on a Validity 138a:0090 (VFS7500) sensor: with this
change,
validity-sensors-tools -t initializercompletes factory reset,firmware upload, pairing and calibration successfully, and fprintd
enroll/verify then work via the libfprint vfs0090 TOD driver. Before the
change, initialization died at
make_cert_verifywith the TypeErrorabove.