Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to k256 0.14 pre-release to allow high-S in recover pubkey #2015

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 88 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ default = []
bench = false

[dependencies]
k256 = { version = "0.13.3", features = ["ecdsa"] }
k256 = { git = "https://github.com/RustCrypto/elliptic-curves.git", features = ["ecdsa"] }
ed25519-zebra = "3"
digest = "0.10"
digest = "0.11.0-pre.8"
rand_core = { version = "0.6", features = ["getrandom"] }
thiserror = "1.0.38"

Expand Down
3 changes: 1 addition & 2 deletions packages/crypto/benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use hex_literal::hex;
use serde::Deserialize;

// Crypto stuff
use digest::Digest;
use k256::ecdsa::SigningKey; // type alias
use sha2::Sha256;
use sha2::{Digest, Sha256};

use cosmwasm_crypto::{
ed25519_batch_verify, ed25519_verify, secp256k1_recover_pubkey, secp256k1_verify,
Expand Down
9 changes: 4 additions & 5 deletions packages/crypto/src/identity_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
//!
//! Adapted from `sha2` [sha256.rs](https://github.com/RustCrypto/hashes/blob/master/sha2/src/sha256.rs)
use digest::consts::U32;
use digest::generic_array::GenericArray;
use digest::{FixedOutput, HashMarker, Output, OutputSizeUser, Reset, Update};

/// The 256-bits identity container
#[derive(Clone, Default)]
pub struct Identity256 {
array: GenericArray<u8, U32>,
array: [u8; 32],
}

impl Update for Identity256 {
fn update(&mut self, hash: &[u8]) {
assert_eq!(hash.as_ref().len(), 32);
self.array = *GenericArray::from_slice(hash);
// copy_from_slice panicks if input is not 32 bytes long
self.array.copy_from_slice(hash);
}
}

Expand All @@ -26,7 +25,7 @@ impl OutputSizeUser for Identity256 {

impl FixedOutput for Identity256 {
fn finalize_into(self, out: &mut Output<Self>) {
*out = self.array;
*out = self.array.into();
}
}

Expand Down
Loading
Loading