Upgrade ed25519-dalek (#11183)

This commit is contained in:
Greg Fitzgerald
2020-07-23 17:23:51 -06:00
committed by GitHub
parent 6f7e121b68
commit 8ccce1e543
7 changed files with 82 additions and 34 deletions

View File

@ -52,7 +52,7 @@ serde_derive = "1.0.103"
serde_json = { version = "1.0.56", optional = true }
sha2 = "0.8.2"
thiserror = "1.0"
ed25519-dalek = { version = "=1.0.0-pre.3", optional = true }
ed25519-dalek = { version = "=1.0.0-pre.4", optional = true }
solana-crate-features = { path = "../crate-features", version = "1.3.0", optional = true }
solana-logger = { path = "../logger", version = "1.3.0", optional = true }
solana-sdk-macro = { path = "macro", version = "1.3.0" }

View File

@ -1,12 +1,14 @@
//! The `signature` module provides functionality for public, and private keys.
use crate::{pubkey::Pubkey, transaction::TransactionError};
use ed25519_dalek::Signer as DalekSigner;
use generic_array::{typenum::U64, GenericArray};
use hmac::Hmac;
use itertools::Itertools;
use rand::{rngs::OsRng, CryptoRng, RngCore};
use std::{
borrow::{Borrow, Cow},
convert::TryInto,
error, fmt,
fs::{self, File, OpenOptions},
io::{Read, Write},
@ -16,7 +18,7 @@ use std::{
};
use thiserror::Error;
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct Keypair(ed25519_dalek::Keypair);
impl Keypair {
@ -61,7 +63,7 @@ impl Signature {
pub fn verify(&self, pubkey_bytes: &[u8], message_bytes: &[u8]) -> bool {
let pubkey = ed25519_dalek::PublicKey::from_bytes(pubkey_bytes);
let signature = ed25519_dalek::Signature::from_bytes(self.0.as_slice());
let signature = self.0.as_slice().try_into();
if pubkey.is_err() || signature.is_err() {
return false;
}