mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Add special return code for ecdsa length mismatch
This commit is contained in:
parent
1cfc45835f
commit
35e95ddca4
5 changed files with 14 additions and 6 deletions
|
|
@ -422,11 +422,14 @@ int ecdsa_read_signature( ecdsa_context *ctx,
|
|||
( ret = asn1_get_mpi( &p, end, &ctx->s ) ) != 0 )
|
||||
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA + ret );
|
||||
|
||||
if( p != end )
|
||||
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA +
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
if( ( ret = ecdsa_verify( &ctx->grp, hash, hlen,
|
||||
&ctx->Q, &ctx->r, &ctx->s ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
return( ecdsa_verify( &ctx->grp, hash, hlen, &ctx->Q, &ctx->r, &ctx->s ) );
|
||||
if( p != end )
|
||||
return( POLARSSL_ERR_ECP_SIG_LEN_MISMATCH );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue