Commit e821e190 authored by Nikos Mavrogiannopoulos's avatar Nikos Mavrogiannopoulos Committed by Nikos Mavrogiannopoulos

when exporting curve coordinates to X9.63 format, perform additional sanity checks on input

Reported by Sean Burford.
parent 15c20db9
......@@ -53,6 +53,11 @@ _gnutls_ecc_ansi_x963_export(gnutls_ecc_curve_t curve, bigint_t x,
/* pad and store x */
byte_size = (_gnutls_mpi_get_nbits(x) + 7) / 8;
if (numlen < byte_size) {
ret = gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
goto cleanup;
}
size = out->size - (1 + (numlen - byte_size));
ret =
_gnutls_mpi_print(x, &out->data[1 + (numlen - byte_size)],
......@@ -63,6 +68,11 @@ _gnutls_ecc_ansi_x963_export(gnutls_ecc_curve_t curve, bigint_t x,
}
byte_size = (_gnutls_mpi_get_nbits(y) + 7) / 8;
if (numlen < byte_size) {
ret = gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
goto cleanup;
}
size = out->size - (1 + (numlen + numlen - byte_size));
ret =
_gnutls_mpi_print(y,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment