0
$\begingroup$

I am using group P-256 on OpenSSL with C++.

My understanding was that, if you have a point $xP$ and then calculate (xP)^(-1) with EC_POINT_invert(group, xP_inv, ctx),

then when I calculate: xP + (xP)^(-1), or

EC_POINT_add(group, result, xP, xP_inv, ctx);

The result should be the identity right? But when I print it, it just looks random. Moreover, should this literally be the same as

EC_POINT_mul(group, result, BN_zero, NULL, NULL, ctx) (i.e. O * P)?

Moreover, if I add P to this value, shouldn't the result be equal to P? It does not.

Obviously I am very confused somewhere. Any help would be appreciated!

$\endgroup$
  • $\begingroup$ What is your point? Are you sure the P is on the curve? $\endgroup$ – kelalaka Jul 22 at 21:35
  • 1
    $\begingroup$ Your comment on the arithmetic is correct, The inverse point for a point $P=(x,y)$ is defined by $P^{-1}=(x,-y)$. And using EC_POINT_mul in this way however one cannot be seen any other error without a code and this is off-topic here. With a working minimal code, this question is better to be suited for Stackoverflow.SE. $\endgroup$ – kelalaka Jul 22 at 21:59
  • $\begingroup$ P is the generator of the group. $\endgroup$ – Joe Jul 22 at 22:17
  • $\begingroup$ I've never seen $P$ used for that I think. $G$ (for Generator) is normally the name. With $P$ you can get confusion with the prime for prime field curves. There is enough naming confusion without $P$/$G$ for Elliptic curves, do try and keep to the names in one of the standards. $\endgroup$ – Maarten Bodewes Jul 23 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.