I've pushed a few more changes to that repository; decompression now works for P-192 and P-224 as well.
I think this is done --- Niels, can you consider this a pull/review request, or would you rather I send a patch (or git-bundle) to the list?
The tests have almost but not quite 100% branch coverage. The few uncovered branches are either cases which I think are allowed by other functions' specification but not by their current implementation, or things that I think are mathematically impossible but can't trivially prove.
On Wed, May 29, 2019 at 01:25:08AM -0700, Wim Lewis wrote:
I've pushed some work-in-progress to a git repository here: https://git.lysator.liu.se/wiml/nettle
There's more to be done, but I would appreciate any comments or feedback people might have. This is all the time I have available to put into it right now, but I hope to return to it before too long.
The changes add two new public functions:
- ecc_point_set_compact() which is like ecc_point_set but accepts a point
in compact form (X and Y's parity/sign rather than X and Y)
- ecc_point_set_from_octets() which interprets a point converted to an
octet string by the rules set out in X9.62 and SEC.1, including compressed, uncompressed, and hybrid points
I'm not terribly happy with the name ecc_point_set_compact(); does anyone have a suggestion for a better name?
Internals:
Decompression works for P-256, P-384, and P-521, but it still needs sqrt implementations for P-192 and P-224. P-224 will be much more complex than the others (the c^((p-3)/4) shortcut doesn't apply), but there's a paper by djb on computing square roots in it.
I added a second slot to the `ecc_modulo` struct to contain a sqrt(u) implementation (as opposed to the existing sqrt(u/v) implementation). The slot, and the typedef that describes functions in that slot, need better names.