Skip to content

Commit

Permalink
Add support for POINT_CONVERSION_HYBRID (#1936)
Browse files Browse the repository at this point in the history
This is the first time it has come up, but Ruby depends on the
`POINT_CONVERSION_HYBRID` format in its tests and expects the underlying
libcrypto to support it. There's not too much a difference between
`POINT_CONVERSION_HYBRID` and
`POINT_CONVERSION_UNCOMPRESSED` except that the first bit contains
information about the quadratic equation y is at. We have the building
blocks to support and can get this working with some tweaking around.
Most of this change is working with the first byte
`POINT_CONVERSION_HYBRID` does differently and point the encoding to
the right places for parsing.

### Testing:
* Testing parsing from and back with `POINT_CONVERSION_HYBRID`. What
we're parsing to and from hybrid doesn't really matter here, they're
already covered by other code paths.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
  • Loading branch information
samuel40791765 authored Oct 31, 2024
1 parent 39520e5 commit 97a6706
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 259 deletions.
6 changes: 0 additions & 6 deletions crypto/fipsmodule/ec/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,12 +1152,6 @@ int EC_METHOD_get_field_type(const EC_METHOD *meth) {

void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
point_conversion_form_t form) {
/* NO-OP. However, abort if consumer attempts to set a representation that is
* not supported. */
if (form != POINT_CONVERSION_UNCOMPRESSED &&
form != POINT_CONVERSION_COMPRESSED) {
abort();
}
// |conv_form| can only be set with OpenSSL compatible dynamically allocated
// groups.
if (group->mutable_ec_group) {
Expand Down
Loading

0 comments on commit 97a6706

Please sign in to comment.