rustfmt: Run on crypto/utils.rs

This commit is contained in:
Elias Rohrer 2024-09-16 12:28:41 +02:00
parent f042c999ef
commit 3fea0c2cac
No known key found for this signature in database
GPG key ID: 36153082BDF676FD

View file

@ -1,7 +1,7 @@
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::secp256k1::{Message, Secp256k1, SecretKey, ecdsa::Signature, Signing};
use bitcoin::hashes::{Hash, HashEngine};
use bitcoin::secp256k1::{ecdsa::Signature, Message, Secp256k1, SecretKey, Signing};
use crate::sign::EntropySource;
@ -43,14 +43,16 @@ macro_rules! hkdf_extract_expand {
let k5 = Hmac::from_engine(hmac).to_byte_array();
(k1, k2, k3, k4, k5)
}}
}};
}
pub fn hkdf_extract_expand_twice(salt: &[u8], ikm: &[u8]) -> ([u8; 32], [u8; 32]) {
hkdf_extract_expand!(salt, ikm, 2)
}
pub fn hkdf_extract_expand_5x(salt: &[u8], ikm: &[u8]) -> ([u8; 32], [u8; 32], [u8; 32], [u8; 32], [u8; 32]) {
pub fn hkdf_extract_expand_5x(
salt: &[u8], ikm: &[u8],
) -> ([u8; 32], [u8; 32], [u8; 32], [u8; 32], [u8; 32]) {
hkdf_extract_expand!(salt, ikm, 5)
}
@ -66,8 +68,11 @@ pub fn sign<C: Signing>(ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey) -> Si
#[inline]
#[allow(unused_variables)]
pub fn sign_with_aux_rand<C: Signing, ES: Deref>(
ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey, entropy_source: &ES
) -> Signature where ES::Target: EntropySource {
ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey, entropy_source: &ES,
) -> Signature
where
ES::Target: EntropySource,
{
#[cfg(feature = "grind_signatures")]
let sig = loop {
let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes());