-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for all possible private keys and all possible lengths of message digest? #53
Comments
Actually, "secp192r1 with SHA-256" is not a good counter example, because that is actually "supported" by the current implementation; just discarding everything after the 24th octets will be fine. However, the combinations like "secp256r1 with SHA-1" is not directly supported by micro-ecc now. (in which case the user has to manually prepend 12 zero bytes to the SHA-1 hash) |
Previously, callers would need to manually convert the hash value appropriately if it was not the same length as curve_n. Now, callers just pass in the full hash value and the length; uECC will convert the hash as appropriate.
Now supported on the runtime branch. |
Previously, callers would need to manually convert the hash value appropriately if it was not the same length as curve_n. Now, callers just pass in the full hash value and the length; uECC will convert the hash as appropriate.
Now supported in master |
This was changed in commit 0283b54 Convert hash to int in sign/verify (kmackay#53)
For a complete implementation of ECDSA signature scheme, I think the signing functions can be changed to accept a private_key pointer to a buffer of length
uECC_N_BYTES
(a newly defined macro for the byte length ofcurve_n
) instead ofuECC_BYTES
, because in some cases the bit length ofcurve_n
(for curves like secp160r1, secp224k1, and secp521r1) is not in the set { 80, 96, 112, 128, 192, 256 }. We can not represent all possible private keys if we only useuECC_BYTES
octets. That means, some users of a valid private key cannot even use this C library to generate ECDSA signatures.For a similar reason, I think the functions may accept an additional argument indicating the length of the buffer pointed by
message_hash
. Otherwise, by forcing the message digest to beuECC_BYTES
octets long, users cannot use this library directly to produce an ECDSA signature on secp192r1 curve with SHA-256 in the standard way.This is some sort of a design choice. By not supporting all possible combinations of inputs, the library codebase can be a little bit simpler and easier to maintain.
The text was updated successfully, but these errors were encountered: