From e1a01926bcbc85b40fc057a68d6fb07a0d72ede2 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 13 Apr 2026 15:47:55 -0400 Subject: [PATCH] Rust wrapper: check length returned by Lms.get_kid() in unit test --- wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs index ccc30bd4b1..842c435669 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_lms.rs @@ -387,7 +387,9 @@ fn test_get_kid() { key.make_key(&mut rng).expect("Error with make_key()"); let mut kid = [0u8; Lms::KEY_ID_LEN]; - key.get_kid(&mut kid).expect("Error with get_kid()"); + let kid_len = key.get_kid(&mut kid).expect("Error with get_kid()"); + assert_eq!(kid_len, Lms::KEY_ID_LEN, "get_kid() must write KEY_ID_LEN bytes"); + assert!(kid.iter().any(|&b| b != 0), "get_kid() must populate the output buffer"); let _ = store; }