The hash length check wasn't strict enough,
as pointed out by Ernst G Giessmann
This commit is contained in:
parent
10f0c85cfc
commit
da989402f2
@ -251,8 +251,16 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
|
|||||||
ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_EC_LIB);
|
ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_EC_LIB);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (dgst_len > BN_num_bytes(order))
|
if (8 * dgst_len > BN_num_bits(order))
|
||||||
{
|
{
|
||||||
|
/* XXX
|
||||||
|
*
|
||||||
|
* Should provide for optional hash truncation:
|
||||||
|
* Keep the BN_num_bits(order) leftmost bits of dgst
|
||||||
|
* (see March 2006 FIPS 186-3 draft, which has a few
|
||||||
|
* confusing errors in this part though)
|
||||||
|
*/
|
||||||
|
|
||||||
ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,
|
ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,
|
||||||
ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
|
ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user