Skip to content

Commit e1a0192

Browse files
Rust wrapper: check length returned by Lms.get_kid() in unit test
1 parent 15ac071 commit e1a0192

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ fn test_get_kid() {
387387
key.make_key(&mut rng).expect("Error with make_key()");
388388

389389
let mut kid = [0u8; Lms::KEY_ID_LEN];
390-
key.get_kid(&mut kid).expect("Error with get_kid()");
390+
let kid_len = key.get_kid(&mut kid).expect("Error with get_kid()");
391+
assert_eq!(kid_len, Lms::KEY_ID_LEN, "get_kid() must write KEY_ID_LEN bytes");
392+
assert!(kid.iter().any(|&b| b != 0), "get_kid() must populate the output buffer");
391393

392394
let _ = store;
393395
}

0 commit comments

Comments
 (0)