Skip to content

Commit 35cad59

Browse files
committed
Add output buffer length check to Pk::sign_deterministic()
1 parent 3112b84 commit 35cad59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mbedtls/src/pk/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,11 @@ impl Pk {
621621
use crate::rng::RngCallback;
622622

623623
if self.pk_type() == Type::Ecdsa || self.pk_type() == Type::Eckey {
624-
// RFC 6979 signature scheme
624+
if sig.len() < ECDSA_MAX_LEN {
625+
return Err(Error::PkSigLenMismatch);
626+
}
625627

628+
// RFC 6979 signature scheme
626629
let q = EcGroup::new(self.curve()?)?.order()?;
627630
let x = self.ec_private()?;
628631

0 commit comments

Comments
 (0)