2022-12-12 14:04:10 -08:00
|
|
|
use frost_core::{Ciphersuite, Group, GroupError};
|
2022-07-01 07:16:22 -07:00
|
|
|
use frost_p256::*;
|
|
|
|
use rand::thread_rng;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn check_sign_with_dealer() {
|
2022-09-05 13:34:28 -07:00
|
|
|
let rng = thread_rng();
|
2022-07-01 07:16:22 -07:00
|
|
|
|
2022-09-05 13:34:28 -07:00
|
|
|
frost_core::tests::check_sign_with_dealer::<P256Sha256, _>(rng);
|
2022-07-01 07:16:22 -07:00
|
|
|
}
|
2022-09-30 13:11:57 -07:00
|
|
|
|
2022-10-18 15:11:05 -07:00
|
|
|
#[test]
|
|
|
|
fn check_sign_with_dkg() {
|
|
|
|
let rng = thread_rng();
|
|
|
|
|
|
|
|
frost_core::tests::check_sign_with_dkg::<P256Sha256, _>(rng);
|
|
|
|
}
|
|
|
|
|
2022-10-26 21:34:57 -07:00
|
|
|
#[test]
|
2022-09-30 13:11:57 -07:00
|
|
|
fn check_batch_verify() {
|
|
|
|
let rng = thread_rng();
|
|
|
|
|
|
|
|
frost_core::tests::batch::batch_verify::<P256Sha256, _>(rng);
|
|
|
|
}
|
|
|
|
|
2022-10-26 21:34:57 -07:00
|
|
|
#[test]
|
2022-09-30 13:11:57 -07:00
|
|
|
fn check_bad_batch_verify() {
|
|
|
|
let rng = thread_rng();
|
|
|
|
|
|
|
|
frost_core::tests::batch::bad_batch_verify::<P256Sha256, _>(rng);
|
|
|
|
}
|
2022-10-04 12:05:58 -07:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn check_deserialize_identity() {
|
|
|
|
// The identity is actually encoded as a single byte; but the API does not
|
|
|
|
// allow us to change that. Try to send something similar.
|
|
|
|
let encoded_identity = [0u8; 33];
|
|
|
|
|
|
|
|
let r = <<P256Sha256 as Ciphersuite>::Group as Group>::deserialize(&encoded_identity);
|
2022-12-12 14:04:10 -08:00
|
|
|
assert_eq!(r, Err(GroupError::MalformedElement));
|
2022-10-04 12:05:58 -07:00
|
|
|
}
|