fix gencode-related issues

This commit is contained in:
Conrado Gouvea 2024-02-06 17:01:21 -03:00 committed by zebra-lucky
parent 00cdfe59ae
commit bdc8fb4cbf
6 changed files with 13 additions and 12 deletions

View File

@ -83,6 +83,7 @@ where
/// [`verify_signature_share`]: https://www.ietf.org/archive/id/draft-irtf-cfrg-frost-14.html#name-signature-share-verificatio
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
#[allow(clippy::too_many_arguments)]
pub(crate) fn verify(
&self,
identifier: Identifier<C>,

View File

@ -1,5 +1,5 @@
An implementation of Schnorr signatures on the secp256k1 curve for both single and threshold numbers
of signers (FROST) with support of Taproot (BIP340/BIP341).
of signers (FROST).
## Example: key generation with trusted dealer and FROST signing

View File

@ -1,7 +1,7 @@
use criterion::{criterion_group, criterion_main, Criterion};
use rand::thread_rng;
use frost_secp256k1::*;
use frost_secp256k1_tr::*;
fn bench_secp256k1_batch_verify(c: &mut Criterion) {
let mut rng = thread_rng();

View File

@ -189,13 +189,13 @@ const CONTEXT_STRING: &str = "FROST-secp256k1-SHA256-TR-v1";
pub struct Secp256K1Sha256;
/// Digest the hasher to a Scalar
pub fn hasher_to_scalar(hasher: Sha256) -> Scalar {
fn hasher_to_scalar(hasher: Sha256) -> Scalar {
let sp = ScalarPrimitive::new(U256::from_be_slice(&hasher.finalize())).unwrap();
Scalar::from(&sp)
}
/// Create a BIP340 compliant tagged hash
pub fn tagged_hash(tag: &str) -> Sha256 {
fn tagged_hash(tag: &str) -> Sha256 {
let mut hasher = Sha256::new();
let mut tag_hasher = Sha256::new();
tag_hasher.update(tag.as_bytes());
@ -206,7 +206,7 @@ pub fn tagged_hash(tag: &str) -> Sha256 {
}
/// Create a BIP341 compliant taproot tweak
pub fn tweak(
fn tweak(
public_key: &<<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element,
merkle_root: &[u8],
) -> Scalar {
@ -217,11 +217,11 @@ pub fn tweak(
}
/// Create a BIP341 compliant tweaked public key
pub fn tweaked_public_key(
fn tweaked_public_key(
public_key: &<<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element,
merkle_root: &[u8],
) -> <<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element {
let mut pk = public_key.clone();
let mut pk = *public_key;
if public_key.to_affine().y_is_odd().into() {
pk = -pk;
}
@ -229,7 +229,7 @@ pub fn tweaked_public_key(
}
/// Creates a real BIP341 tweaked public key by assuming an even y-coordinate.
pub fn real_tweaked_pubkey(
fn real_tweaked_pubkey(
public_key: &<<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element,
merkle_root: &[u8],
) -> <<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element {
@ -240,7 +240,7 @@ pub fn real_tweaked_pubkey(
}
/// Create a BIP341 compliant tweaked secret key
pub fn tweaked_secret_key(
fn tweaked_secret_key(
secret: <<<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Field as Field>::Scalar,
public_key: &<<Secp256K1Sha256 as Ciphersuite>::Group as Group>::Element,
merkle_root: &[u8],

View File

@ -116,7 +116,7 @@ fn check_sign_with_dealer_fails_with_invalid_max_signers() {
/// This is testing that Shamir's secret sharing to compute and arbitrary
/// value is working.
#[test]
fn check_share_generation_secp256k1_sha256() {
fn check_share_generation_secp256k1_tr_sha256() {
let rng = thread_rng();
frost_core::tests::ciphersuite_generic::check_share_generation::<Secp256K1Sha256, _>(rng);
}

View File

@ -298,8 +298,8 @@ fn main() -> ExitCode {
"Secp256K1",
"FROST(secp256k1, SHA-256)",
"FROST-secp256k1-SHA256-TR-v1",
"secp256k1_sha256",
"secp256k1",
"secp256k1_tr_sha256",
"secp256k1_tr",
"<S>",
],
),