Skip to content

Commit ebbeb92

Browse files
committed
chore: revert raw_sign
1 parent 1997a0f commit ebbeb92

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

ed25519-dalek/src/signing.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ impl ExpandedSecretKey {
833833
/// This definition is loose in its parameters so that end-users of the `hazmat` module can
834834
/// change how the `ExpandedSecretKey` is calculated and which hash function to use.
835835
#[allow(non_snake_case)]
836-
#[allow(clippy::unwrap_used)]
837836
#[inline(always)]
838837
pub(crate) fn raw_sign<CtxDigest>(
839838
&self,
@@ -842,48 +841,24 @@ impl ExpandedSecretKey {
842841
) -> Signature
843842
where
844843
CtxDigest: Digest<OutputSize = U64>,
845-
{
846-
// OK unwrap, update can't fail.
847-
self.raw_sign_byupdate(
848-
|h: &mut CtxDigest| {
849-
h.update(message);
850-
Ok(())
851-
},
852-
verifying_key,
853-
)
854-
.unwrap()
855-
}
856-
857-
/// Sign a message provided in parts. The `msg_update` closure
858-
/// will be called twice to hash the message parts.
859-
#[allow(non_snake_case)]
860-
#[inline(always)]
861-
pub(crate) fn raw_sign_byupdate<CtxDigest, F>(
862-
&self,
863-
msg_update: F,
864-
verifying_key: &VerifyingKey,
865-
) -> Result<Signature, SignatureError>
866-
where
867-
CtxDigest: Digest<OutputSize = U64>,
868-
F: Fn(&mut CtxDigest) -> Result<(), SignatureError>,
869844
{
870845
let mut h = CtxDigest::new();
871846

872847
h.update(self.hash_prefix);
873-
msg_update(&mut h)?;
848+
h.update(message);
874849

875850
let r = Scalar::from_hash(h);
876851
let R: CompressedEdwardsY = EdwardsPoint::mul_base(&r).compress();
877852

878853
h = CtxDigest::new();
879854
h.update(R.as_bytes());
880855
h.update(verifying_key.as_bytes());
881-
msg_update(&mut h)?;
856+
h.update(message);
882857

883858
let k = Scalar::from_hash(h);
884859
let s: Scalar = (k * self.scalar) + r;
885860

886-
Ok(InternalSignature { R, s }.into())
861+
InternalSignature { R, s }.into()
887862
}
888863

889864
/// The prehashed signing function for Ed25519 (i.e., Ed25519ph). `CtxDigest` is the digest

0 commit comments

Comments
 (0)