otrv4/libotr-ng

otrng_serialize_ec_point return value interpreted incorrectly

Closed this issue · 1 comments

osmk commented

Hi, I was looking through the code and happened to notice a minor issue. It doesn't actually have any impact on the function but is semantically incorrect or at least confusing...

if (otrng_failed(otrng_serialize_ec_point(forg_ser, *client->forging_key))) {

otrng_serialize_ec_point() returns an int number of bytes serialised, but here it is interpreted as if it returned an otrng_result. It happens to work in practice because ED448_POINT_BYTES isn't equal to OTRNG_ERROR, but the line should probably read something as follows for correctness

if (otrng_serialize_ec_point(forg_ser, *client->forging_key) != ED448_POINT_BYTES) {

Do you want me to open a PR?

Hey!

Thanks. It should be fixed now ;)

Thanks!