Skip to content

Commit fccced4

Browse files
Rust wrapper: verify RSA lengths in verifying_key()
1 parent 3ca90b1 commit fccced4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

wrapper/rust/wolfssl-wolfcrypt/src/rsa_pkcs1v15.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ impl<H: Hash, const N: usize> Keypair for SigningKey<H, N> {
336336
if rc != 0 {
337337
panic!("wc_RsaFlattenPublicKey failed: {rc}");
338338
}
339+
if (n_len as usize) != N || e_len == 0 || (e_len as usize) > MAX_E_LEN {
340+
panic!("wc_RsaFlattenPublicKey failed: e_len: {e_len}, n_len: {n_len}");
341+
}
339342
VerifyingKey {
340343
n,
341344
e,

0 commit comments

Comments
 (0)