mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Make ecdsa_verify() return value more explicit
This commit is contained in:
parent
9cc6f5c61b
commit
db77175e99
@ -34,8 +34,9 @@
|
|||||||
*/
|
*/
|
||||||
#define POLARSSL_ERR_ECP_BAD_INPUT_DATA -0x4F80 /**< Bad input parameters to function. */
|
#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_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_FEATURE_UNAVAILABLE -0x4E00 /**< Requested curve not available. */
|
||||||
|
#define POLARSSL_ERR_ECP_VERIFY_FAILED -0x4E00 /**< The signature is not valid. */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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 ||
|
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 )
|
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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ int ecdsa_verify( const ecp_group *grp,
|
|||||||
|
|
||||||
if( ecp_is_zero( &R ) )
|
if( ecp_is_zero( &R ) )
|
||||||
{
|
{
|
||||||
ret = POLARSSL_ERR_ECP_BAD_INPUT_DATA;
|
ret = POLARSSL_ERR_ECP_VERIFY_FAILED;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ int ecdsa_verify( const ecp_group *grp,
|
|||||||
*/
|
*/
|
||||||
if( mpi_cmp_mpi( &R.X, r ) != 0 )
|
if( mpi_cmp_mpi( &R.X, r ) != 0 )
|
||||||
{
|
{
|
||||||
ret = POLARSSL_ERR_ECP_BAD_INPUT_DATA;
|
ret = POLARSSL_ERR_ECP_VERIFY_FAILED;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user