Skip to content

Commit

Permalink
Update libsecp256k1 dep to 0.3.0 (#1258)
Browse files Browse the repository at this point in the history
* Update libsecp256k1 dep to 0.3.0

* Sign now cannot fail
  • Loading branch information
sorpaas authored and tomaka committed Oct 1, 2019
1 parent cf585d5 commit 8be73c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protobuf = "2.3"
quick-error = "1.2"
rand = "0.6"
rw-stream-sink = { version = "0.1.1", path = "../misc/rw-stream-sink" }
libsecp256k1 = { version = "0.2.2", optional = true }
libsecp256k1 = { version = "0.3.0", optional = true }
sha2 = "0.8.0"
smallvec = "0.6"
tokio-executor = "0.1.4"
Expand Down Expand Up @@ -56,4 +56,3 @@ tokio-mock-task = "0.1"
[features]
default = ["secp256k1"]
secp256k1 = ["libsecp256k1"]

5 changes: 1 addition & 4 deletions core/src/identity/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ impl SecretKey {
pub fn sign_hash(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError> {
let m = Message::parse_slice(msg)
.map_err(|_| SigningError::new("failed to parse secp256k1 digest"))?;
secp256k1::sign(&m, &self.0)
.map(|s| s.0.serialize_der().as_ref().into())
.map_err(|_| SigningError::new("failed to create secp256k1 signature"))
Ok(secp256k1::sign(&m, &self.0).0.serialize_der().as_ref().into())
}
}

Expand Down Expand Up @@ -190,4 +188,3 @@ mod tests {
assert_eq!(sk_bytes, [0; 32]);
}
}

0 comments on commit 8be73c2

Please sign in to comment.