sanity check on resulting ecc size

This commit is contained in:
Jacob Barthelmeh
2019-09-03 10:54:11 -06:00
parent ef20276ab5
commit 03967d62f4

View File

@ -3592,7 +3592,7 @@ static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point,
private_key->heap); private_key->heap);
if (err == MP_OKAY) { if (err == MP_OKAY) {
x = mp_unsigned_bin_size(curve->prime); x = mp_unsigned_bin_size(curve->prime);
if (*outlen < x) { if (*outlen < x || (int)x < mp_unsigned_bin_size(result->x)) {
err = BUFFER_E; err = BUFFER_E;
} }
} }