mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
rustfmt
: Run on crypto/utils.rs
This commit is contained in:
parent
f042c999ef
commit
3fea0c2cac
1 changed files with 11 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
use bitcoin::hashes::{Hash, HashEngine};
|
|
||||||
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
|
use bitcoin::hashes::hmac::{Hmac, HmacEngine};
|
||||||
use bitcoin::hashes::sha256::Hash as Sha256;
|
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;
|
use crate::sign::EntropySource;
|
||||||
|
|
||||||
|
@ -43,14 +43,16 @@ macro_rules! hkdf_extract_expand {
|
||||||
let k5 = Hmac::from_engine(hmac).to_byte_array();
|
let k5 = Hmac::from_engine(hmac).to_byte_array();
|
||||||
|
|
||||||
(k1, k2, k3, k4, k5)
|
(k1, k2, k3, k4, k5)
|
||||||
}}
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hkdf_extract_expand_twice(salt: &[u8], ikm: &[u8]) -> ([u8; 32], [u8; 32]) {
|
pub fn hkdf_extract_expand_twice(salt: &[u8], ikm: &[u8]) -> ([u8; 32], [u8; 32]) {
|
||||||
hkdf_extract_expand!(salt, ikm, 2)
|
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)
|
hkdf_extract_expand!(salt, ikm, 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +68,11 @@ pub fn sign<C: Signing>(ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey) -> Si
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn sign_with_aux_rand<C: Signing, ES: Deref>(
|
pub fn sign_with_aux_rand<C: Signing, ES: Deref>(
|
||||||
ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey, entropy_source: &ES
|
ctx: &Secp256k1<C>, msg: &Message, sk: &SecretKey, entropy_source: &ES,
|
||||||
) -> Signature where ES::Target: EntropySource {
|
) -> Signature
|
||||||
|
where
|
||||||
|
ES::Target: EntropySource,
|
||||||
|
{
|
||||||
#[cfg(feature = "grind_signatures")]
|
#[cfg(feature = "grind_signatures")]
|
||||||
let sig = loop {
|
let sig = loop {
|
||||||
let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes());
|
let sig = ctx.sign_ecdsa_with_noncedata(msg, sk, &entropy_source.get_secure_random_bytes());
|
||||||
|
|
Loading…
Add table
Reference in a new issue