Skip to content

Commit

Permalink
upgrade rust to 1.75.0 nightly - 2023-11-09
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreat committed Dec 10, 2024
1 parent da3b753 commit 17ee669
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions crypto/keys/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
//! This module implements the common keys traits for the Ed25519 digital
//! signature scheme.
// skipping clippy check here because we're mapping errors.
// Not sure if moving to 'from' will raise the kind of errors that we want.
#![allow(clippy::unnecessary_fallible_conversions)]

use crate::{
DigestSigner, DigestVerifier, DistinguishedEncoding, KeyError, PrivateKey, PublicKey,
SignatureEncoding, SignatureError, Signer, Verifier,
Expand Down Expand Up @@ -213,8 +209,7 @@ impl DistinguishedEncoding for Ed25519Public {

impl<D: Digest<OutputSize = U64>> DigestVerifier<D, Ed25519Signature> for Ed25519Public {
fn verify_digest(&self, digest: D, signature: &Ed25519Signature) -> Result<(), SignatureError> {
let sig =
DalekSignature::try_from(&signature.to_bytes()).map_err(|_e| SignatureError::new())?;
let sig = DalekSignature::from(&signature.to_bytes());
self.0
.verify_prehashed(digest, None, &sig)
.map_err(|_e| SignatureError::new())
Expand All @@ -232,8 +227,7 @@ impl PublicKey for Ed25519Public {}

impl Verifier<Ed25519Signature> for Ed25519Public {
fn verify(&self, message: &[u8], signature: &Ed25519Signature) -> Result<(), SignatureError> {
let sig =
DalekSignature::try_from(&signature.to_bytes()).map_err(|_e| SignatureError::new())?;
let sig = DalekSignature::from(&signature.to_bytes());
self.0
.verify_strict(message, &sig)
.map_err(|_e| SignatureError::new())
Expand Down Expand Up @@ -363,8 +357,7 @@ impl<D: Digest<OutputSize = U64>> DigestSigner<D, Ed25519Signature> for Ed25519P

impl<D: Digest<OutputSize = U64>> DigestVerifier<D, Ed25519Signature> for Ed25519Pair {
fn verify_digest(&self, digest: D, signature: &Ed25519Signature) -> Result<(), SignatureError> {
let sig =
DalekSignature::try_from(&signature.to_bytes()).map_err(|_e| SignatureError::new())?;
let sig = DalekSignature::from(&signature.to_bytes());
self.0
.verify_prehashed(digest, None, &sig)
.map_err(|_e| SignatureError::new())
Expand Down Expand Up @@ -415,8 +408,7 @@ impl TryFrom<Vec<u8>> for Ed25519Pair {

impl Verifier<Ed25519Signature> for Ed25519Pair {
fn verify(&self, message: &[u8], signature: &Ed25519Signature) -> Result<(), SignatureError> {
let sig =
DalekSignature::try_from(&signature.to_bytes()).map_err(|_e| SignatureError::new())?;
let sig = DalekSignature::from(&signature.to_bytes());
self.0
.verifying_key()
.verify_strict(message, &sig)
Expand Down

0 comments on commit 17ee669

Please sign in to comment.