mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 11:05:47 +01:00
Improve const correctness of read() functions
This commit is contained in:
parent
082767ff0c
commit
9028c5af9a
@ -185,7 +185,7 @@ static int ecjpake_zkp_read( const mbedtls_md_info_t *md_info,
|
|||||||
const mbedtls_ecp_point *G,
|
const mbedtls_ecp_point *G,
|
||||||
const mbedtls_ecp_point *X,
|
const mbedtls_ecp_point *X,
|
||||||
const char *id,
|
const char *id,
|
||||||
unsigned char **p,
|
const unsigned char **p,
|
||||||
const unsigned char *end )
|
const unsigned char *end )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -207,8 +207,7 @@ static int ecjpake_zkp_read( const mbedtls_md_info_t *md_info,
|
|||||||
if( end < *p )
|
if( end < *p )
|
||||||
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_tls_read_point( grp, &V,
|
MBEDTLS_MPI_CHK( mbedtls_ecp_tls_read_point( grp, &V, p, end - *p ) );
|
||||||
(const unsigned char **) p, end - *p ) );
|
|
||||||
|
|
||||||
if( end < *p || (size_t)( end - *p ) < 1 )
|
if( end < *p || (size_t)( end - *p ) < 1 )
|
||||||
{
|
{
|
||||||
@ -217,6 +216,7 @@ static int ecjpake_zkp_read( const mbedtls_md_info_t *md_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
r_len = *(*p)++;
|
r_len = *(*p)++;
|
||||||
|
|
||||||
if( end < *p || (size_t)( end - *p ) < r_len )
|
if( end < *p || (size_t)( end - *p ) < r_len )
|
||||||
{
|
{
|
||||||
ret = MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
ret = MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
@ -257,7 +257,7 @@ static int ecjpake_kkp_read( const mbedtls_md_info_t *md_info,
|
|||||||
const mbedtls_ecp_point *G,
|
const mbedtls_ecp_point *G,
|
||||||
mbedtls_ecp_point *X,
|
mbedtls_ecp_point *X,
|
||||||
const char *id,
|
const char *id,
|
||||||
unsigned char **p,
|
const unsigned char **p,
|
||||||
const unsigned char *end )
|
const unsigned char *end )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -271,8 +271,7 @@ static int ecjpake_kkp_read( const mbedtls_md_info_t *md_info,
|
|||||||
* ECSchnorrZKP zkp;
|
* ECSchnorrZKP zkp;
|
||||||
* } ECJPAKEKeyKP;
|
* } ECJPAKEKeyKP;
|
||||||
*/
|
*/
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_tls_read_point( grp, X,
|
MBEDTLS_MPI_CHK( mbedtls_ecp_tls_read_point( grp, X, p, end - *p ) );
|
||||||
(const unsigned char **) p, end - *p ) );
|
|
||||||
MBEDTLS_MPI_CHK( ecjpake_zkp_read( md_info, grp, G, X, id, p, end ) );
|
MBEDTLS_MPI_CHK( ecjpake_zkp_read( md_info, grp, G, X, id, p, end ) );
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -329,7 +328,7 @@ static int ecjpake_kkpp_read( const mbedtls_md_info_t *md_info,
|
|||||||
size_t len )
|
size_t len )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char *p = (unsigned char *) buf;
|
const unsigned char *p = buf;
|
||||||
const unsigned char *end = buf + len;
|
const unsigned char *end = buf + len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user