mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-22 16:25:32 +00:00
Add a test for issue #43.
Regardless of threshold, all polynomials are lines due to small syntactic error
This commit is contained in:
committed by
Romain Ruetschi
parent
7f9289eb1a
commit
3e89d1b1ca
@ -1,6 +1,6 @@
|
|||||||
extern crate rusty_secrets;
|
extern crate rusty_secrets;
|
||||||
|
|
||||||
use rusty_secrets::sss::recover_secret;
|
use rusty_secrets::sss::{recover_secret, split_secret};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "EmptyShares")]
|
#[should_panic(expected = "EmptyShares")]
|
||||||
@ -87,3 +87,25 @@ fn test_recover_too_few_shares() {
|
|||||||
|
|
||||||
recover_secret(&shares, false).unwrap();
|
recover_secret(&shares, false).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://github.com/SpinResearch/RustySecrets/issues/43
|
||||||
|
#[test]
|
||||||
|
fn test_recover_too_few_shares_bug() {
|
||||||
|
let original = b"Test for issue #43".to_vec();
|
||||||
|
let shares = split_secret(4, 5, &original, false).unwrap();
|
||||||
|
let mut share_1 = shares[0].clone().into_bytes();
|
||||||
|
let mut share_2 = shares[3].clone().into_bytes();
|
||||||
|
|
||||||
|
share_1[0] = '2' as u8;
|
||||||
|
share_2[0] = '2' as u8;
|
||||||
|
|
||||||
|
let sub_shares = vec![
|
||||||
|
String::from_utf8_lossy(&share_1).into_owned(),
|
||||||
|
String::from_utf8_lossy(&share_2).into_owned(),
|
||||||
|
];
|
||||||
|
|
||||||
|
match recover_secret(&sub_shares, false) {
|
||||||
|
Err(_) => assert!(true),
|
||||||
|
Ok(recovered) => assert_ne!(original, recovered),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user