diff --git a/Cargo.lock b/Cargo.lock index c370a39..74e90da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,13 +173,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + [[package]] name = "bs58" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ - "sha2", + "sha2 0.10.9", "tinyvec", ] @@ -211,6 +220,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + [[package]] name = "coins-bip32" version = "0.8.7" @@ -219,11 +234,11 @@ checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" dependencies = [ "bs58", "coins-core 0.8.7", - "digest", - "hmac", + "digest 0.10.7", + "hmac 0.12.1", "k256", "serde", - "sha2", + "sha2 0.10.9", "thiserror 1.0.69", ] @@ -235,13 +250,13 @@ checksum = "c1fc16cf8742cbecd285d3465532affa37e23e8120a0ac813f613923c730cd9b" dependencies = [ "bs58", "coins-core 0.13.1", - "digest", + "digest 0.10.7", "getrandom 0.2.17", "getrandom 0.3.4", - "hmac", + "hmac 0.12.1", "k256", "serde", - "sha2", + "sha2 0.10.9", "thiserror 1.0.69", ] @@ -255,10 +270,10 @@ dependencies = [ "coins-bip32 0.13.1", "getrandom 0.2.17", "getrandom 0.3.4", - "hmac", + "hmac 0.12.1", "pbkdf2", "rand", - "sha2", + "sha2 0.10.9", "thiserror 1.0.69", ] @@ -271,13 +286,13 @@ dependencies = [ "base64 0.21.7", "bech32 0.9.1", "bs58", - "digest", + "digest 0.10.7", "generic-array", "hex", - "ripemd", + "ripemd 0.1.3", "serde", "serde_derive", - "sha2", + "sha2 0.10.9", "sha3", "thiserror 1.0.69", ] @@ -292,11 +307,11 @@ dependencies = [ "bech32 0.9.1", "bs58", "const-hex", - "digest", + "digest 0.10.7", "generic-array", - "ripemd", + "ripemd 0.1.3", "serde", - "sha2", + "sha2 0.10.9", "sha3", "thiserror 1.0.69", ] @@ -308,7 +323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33e2a781ebdf4467d1428dc4593067825fb646f6871475098d8577421af73558" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "proptest", "serde_core", ] @@ -319,6 +334,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -328,6 +349,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -365,6 +395,24 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +dependencies = [ + "cmov", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -372,9 +420,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "curve25519-dalek-derive", - "digest", + "digest 0.10.7", "fiat-crypto", "rustc_version", "subtle", @@ -398,7 +446,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ - "const-oid", + "const-oid 0.9.6", "zeroize", ] @@ -419,12 +467,24 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", "subtle", ] +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid 0.10.2", + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "displaydoc" version = "0.2.7" @@ -443,7 +503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -469,7 +529,7 @@ dependencies = [ "curve25519-dalek", "ed25519", "serde", - "sha2", + "sha2 0.10.9", "subtle", "zeroize", ] @@ -482,7 +542,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -689,7 +749,16 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.3", ] [[package]] @@ -708,6 +777,15 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "hybrid-array" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707114b52a152fa7bdb290cd7cd5912d9467273b6d74e21b8d81aca1f8533f6b" +dependencies = [ + "typenum", +] + [[package]] name = "indexmap" version = "2.14.0" @@ -745,7 +823,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2", + "sha2 0.10.9", "signature", ] @@ -755,7 +833,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -813,8 +891,8 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest", - "hmac", + "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -958,7 +1036,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hmac", + "hmac 0.12.1", "subtle", ] @@ -982,7 +1060,16 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "ripemd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd4211456b4172d7e44261920c25acf07367c4f04bb5f5d54fc21b090d9b159" +dependencies = [ + "digest 0.11.3", ] [[package]] @@ -1146,8 +1233,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.3", ] [[package]] @@ -1156,7 +1254,7 @@ version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] @@ -1172,7 +1270,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core 0.6.4", ] @@ -1363,11 +1461,11 @@ dependencies = [ "coins-bip39", "ed25519-dalek", "hex", - "hmac", - "ripemd", + "hmac 0.13.0", + "ripemd 0.2.0", "serde", "serde_json", - "sha2", + "sha2 0.11.0", "sha3", "thiserror 2.0.20", "tokio", diff --git a/Cargo.toml b/Cargo.toml index b2d177a..88ac52e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,14 @@ bitcoin = { version = "0.32", default-features = false, features = ["std", "secp bech32 = { version = "0.11", optional = true } # RIPEMD-160, the second half of Bitcoin's HASH160. Only needed to turn a # public key into a P2WPKH witness program. -ripemd = { version = "0.1", optional = true } +# +# On 0.2, and not 0.1, because `src/key/btc.rs`'s `hash160` feeds a `Sha256` +# (sha2 0.11) output straight into `Ripemd160::digest`, so the two must sit on +# the same `digest` line. That means a second copy — `coins-core` still pulls +# ripemd 0.1 (digest 0.10) — which is the same unavoidable duplicate the sha2 +# 0.11 bump already adds elsewhere. Settle back to 0.1 when `coins-core` (or +# sha2) moves, and only when the shared `digest` reunifies. +ripemd = { version = "0.2", optional = true } # BIP-32 on secp256k1, backed by the pure-Rust `k256` rather than the # `secp256k1` C library. Deriving a key wrong is silent and unrecoverable, so # this stays delegated to a vetted implementation — see `src/key/bip32.rs`. @@ -80,8 +87,15 @@ async-trait = { version = "0.1", optional = true } # this extraction, so a wallet derived by the old code derives identically here. coins-bip39 = { version = "0.13", optional = true } # HMAC-SHA512, the whole of SLIP-0010's ed25519 derivation. -hmac = { version = "0.12", optional = true } -sha2 = { version = "0.10", optional = true } +# +# On 0.13 because `src/key/slip10.rs` builds `Hmac` and `Sha512` now +# comes from sha2 0.11 (digest 0.11): hmac must sit on the same `digest` line +# or `new_from_slice` refuses to unify. `coins-bip32`/`coins-bip39`/`pbkdf2` +# still pull hmac 0.12 (digest 0.10) into the graph, so 0.13 sits alongside it +# as a second copy — the same price this bump already pays for sha2. Fold back +# to 0.12 when the ecosystem moves to digest 0.11 and the two unify. +hmac = { version = "0.13", optional = true } +sha2 = { version = "0.11", optional = true } # ed25519 signing keys for Solana. ed25519-dalek = { version = "2", default-features = false, features = ["std"], optional = true } # Wipes derived key material on drop rather than leaving it in freed memory. diff --git a/src/key/slip10.rs b/src/key/slip10.rs index 418854d..f1d7d1f 100644 --- a/src/key/slip10.rs +++ b/src/key/slip10.rs @@ -9,7 +9,7 @@ //! Solana wallets standardise on `m/44'/501'/N'/0'`, which is fully hardened, //! so the restriction costs nothing in practice. -use hmac::{Hmac, Mac}; +use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha512; use zeroize::Zeroizing;