wolfSSL: Fix crypto_ec_point_solve_y_coord()

Provide full uncompressed DER data length to wc_ecc_import_point_der()
even though a compressed form is used here. In addition, use
ECC_POINT_COMP_* defined values to make this more readable.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
This commit is contained in:
Sean Parkinson 2018-03-29 14:55:55 +10:00 committed by Jouni Malinen
parent 187ad3a303
commit e3501ac18f

View file

@ -1586,18 +1586,18 @@ int crypto_ec_point_solve_y_coord(struct crypto_ec *e,
struct crypto_ec_point *p,
const struct crypto_bignum *x, int y_bit)
{
byte buf[MAX_ECC_BYTES + 1];
byte buf[1 + 2 * MAX_ECC_BYTES];
int ret;
int prime_len = crypto_ec_prime_len(e);
if (TEST_FAIL())
return -1;
buf[0] = 0x2 + (byte) y_bit;
buf[0] = y_bit ? ECC_POINT_COMP_ODD : ECC_POINT_COMP_EVEN;
ret = crypto_bignum_to_bin(x, buf + 1, prime_len, prime_len);
if (ret <= 0)
return -1;
ret = wc_ecc_import_point_der(buf, ret + 1, e->key.idx,
ret = wc_ecc_import_point_der(buf, 1 + 2 * ret, e->key.idx,
(ecc_point *) p);
if (ret != 0)
return -1;