mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 16:48:29 +00:00
Make ecdsa_verify() return value more explicit
This commit is contained in:
parent
9cc6f5c61b
commit
db77175e99
2 changed files with 5 additions and 4 deletions
|
@ -34,8 +34,9 @@
|
|||
*/
|
||||
#define POLARSSL_ERR_ECP_BAD_INPUT_DATA -0x4F80 /**< Bad input parameters to function. */
|
||||
#define POLARSSL_ERR_ECP_BUFFER_TOO_SMALL -0x4F00 /**< The buffer is too small to write to. */
|
||||
#define POLARSSL_ERR_ECP_GENERIC -0x4E80 /**< Generic ECP error */
|
||||
#define POLARSSL_ERR_ECP_GENERIC -0x4E80 /**< Generic ECP error. */
|
||||
#define POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE -0x4E00 /**< Requested curve not available. */
|
||||
#define POLARSSL_ERR_ECP_VERIFY_FAILED -0x4E00 /**< The signature is not valid. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -134,7 +134,7 @@ int ecdsa_verify( const ecp_group *grp,
|
|||
if( mpi_cmp_int( r, 1 ) < 0 || mpi_cmp_mpi( r, &grp->N ) >= 0 ||
|
||||
mpi_cmp_int( s, 1 ) < 0 || mpi_cmp_mpi( s, &grp->N ) >= 0 )
|
||||
{
|
||||
ret = POLARSSL_ERR_ECP_BAD_INPUT_DATA;
|
||||
ret = POLARSSL_ERR_ECP_VERIFY_FAILED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ int ecdsa_verify( const ecp_group *grp,
|
|||
|
||||
if( ecp_is_zero( &R ) )
|
||||
{
|
||||
ret = POLARSSL_ERR_ECP_BAD_INPUT_DATA;
|
||||
ret = POLARSSL_ERR_ECP_VERIFY_FAILED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ int ecdsa_verify( const ecp_group *grp,
|
|||
*/
|
||||
if( mpi_cmp_mpi( &R.X, r ) != 0 )
|
||||
{
|
||||
ret = POLARSSL_ERR_ECP_BAD_INPUT_DATA;
|
||||
ret = POLARSSL_ERR_ECP_VERIFY_FAILED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue