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!