Skip to content

Commit 40003e0

Browse files
committed
dsa: capture error
1 parent 3dff944 commit 40003e0

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsa/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rust-version = "1.85"
1919
digest = "=0.11.0-pre.10"
2020
crypto-bigint = { version = "=0.7.0-pre.1", default-features = false, features = ["alloc", "zeroize"] }
2121
crypto-primes = { version = "=0.7.0-dev", default-features = false }
22-
pkcs8 = { version = "0.11.0-rc.1", default-features = false, features = ["alloc"] }
22+
pkcs8 = { version = "0.11.0-rc.3", default-features = false, features = ["alloc"] }
2323
rfc6979 = { version = "=0.5.0-pre.4" }
2424
sha2 = { version = "=0.11.0-pre.5", default-features = false }
2525
signature = { version = "=3.0.0-pre", default-features = false, features = ["alloc", "digest", "rand_core"] }
@@ -28,7 +28,7 @@ zeroize = { version = "1", default-features = false }
2828
[dev-dependencies]
2929
hex = "0.4.3"
3030
hex-literal = "1"
31-
pkcs8 = { version = "0.11.0-rc.1", default-features = false, features = ["pem"] }
31+
pkcs8 = { version = "0.11.0-rc.3", default-features = false, features = ["pem"] }
3232
proptest = "1"
3333
rand = "0.9"
3434
rand_chacha = "0.9"

dsa/src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,13 @@ impl TryFrom<&[u8]> for Signature {
185185
type Error = signature::Error;
186186

187187
fn try_from(bytes: &[u8]) -> signature::Result<Self> {
188-
// TODO(tarcieri): capture error source when `std` feature enabled
189-
Self::from_der(bytes).map_err(|_| signature::Error::new())
188+
let out = Self::from_der(bytes);
189+
190+
if cfg!(feature = "std") {
191+
out.map_err(signature::Error::from_source)
192+
} else {
193+
out.map_err(|_| signature::Error::new())
194+
}
190195
}
191196
}
192197

0 commit comments

Comments
 (0)