Compute EC_KEY starting from X or Y coordinate only

Luca Di Mauro luca.dimauro at
Fri Oct 25 11:19:33 UTC 2019

Mh, maybe I didn't understand.

If I have an x-point which follows this representation (so it is  
composed by 33 byte and first byte is '0x02') and I use  
'EC_POINT_set_compressed_coordinates_GFp' function, it will be  
considered as compressed-y-0 or compressed-y-1? Or it is correctly  
considered as the x coordinate?


Billy Brumley <bbrumley at> ha scritto:

>> Thank you! I thought they were the same.
>> And given an x-only coordinate, how can I find the y coordinate? I
>> don't find the relative functions on the documentation.
> Well it depends on what you mean. Internally,
> EC_POINT_set_compressed_coordinates_GFp will internally automatically
> compute the y coordinate based on the y_bit argument.
> EC_POINT_set_compressed_coordinates_GFp(group, p, x, 0, ...
> EC_POINT_get_affine_coordinates_GFp(group, p, X0, Y0 ...
> That will get you one of the points in X0, Y0.
> EC_POINT_set_compressed_coordinates_GFp(group, p, x, 1, ...
> EC_POINT_get_affine_coordinates_GFp(group, p, X1, Y1 ...
> That will get you the other point in X1, Y1. (Where X0 = X1 = x.)
> (But you are probably looking to do something cryptographically
> interesting between set/get, which is application specific.)
> Generally, in addition to the man pages which you seem to have found,
> check the "tests" folder if you are looking for examples to get
> started.

More information about the openssl-users mailing list