From e03739147ff0b9426fb3aed6a2358f2ec1c47fd1 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 31 Jul 2024 09:20:56 -0700 Subject: [PATCH] provide patches to support ed25519 Signed-off-by: Arthur Gautier --- Cargo.lock | 98 ++++++++++++++++++++++++++++++++++++++---------------- Cargo.toml | 17 ++++++++-- 2 files changed, 83 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0ff5b9..c3d286b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -299,12 +299,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-oid" version = "0.10.0-rc.0" @@ -366,13 +360,37 @@ dependencies = [ "rand_core", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "git+https://github.com/dalek-cryptography/curve25519-dalek.git?branch=rustcrypto-new-releases#44508ba8652ae3445608ad3c56b63ef528ddfb93" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.11.0-pre.9", + "fiat-crypto", + "rustc_version", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "git+https://github.com/dalek-cryptography/curve25519-dalek.git?branch=rustcrypto-new-releases#44508ba8652ae3445608ad3c56b63ef528ddfb93" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "der" version = "0.8.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d9c07d3bd80cf0935ce478d07edf7e7a5b158446757f988f3e62082227b700" dependencies = [ - "const-oid 0.10.0-rc.0", + "const-oid", "pem-rfc7468", "zeroize", ] @@ -384,7 +402,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.6", "crypto-common 0.1.6", ] @@ -395,7 +412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2e3d6615d99707295a9673e889bf363a04b2a466bd320c65a72536f7577379" dependencies = [ "block-buffer 0.11.0-rc.0", - "const-oid 0.10.0-rc.0", + "const-oid", "crypto-common 0.2.0-rc.0", "subtle", ] @@ -420,6 +437,26 @@ dependencies = [ "spki", ] +[[package]] +name = "ed25519" +version = "2.3.0-pre.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bcc0730fbd27c8619332efad3dfa1de229dc5859a31495ab674e0ac0f9996b" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0-pre" +source = "git+https://github.com/dalek-cryptography/curve25519-dalek.git?branch=rustcrypto-new-releases#44508ba8652ae3445608ad3c56b63ef528ddfb93" +dependencies = [ + "curve25519-dalek", + "ed25519", + "sha2 0.11.0-pre.4", + "subtle", +] + [[package]] name = "elliptic-curve" version = "0.14.0-pre.6" @@ -485,6 +522,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "futures" version = "0.3.30" @@ -663,6 +706,15 @@ dependencies = [ "digest 0.11.0-pre.9", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "humantime" version = "2.1.0" @@ -1176,7 +1228,7 @@ version = "0.10.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57e864e43f5d003321ab452feea6450f9611d7be6726489b4ec051da34774c62" dependencies = [ - "const-oid 0.10.0-rc.0", + "const-oid", "digest 0.11.0-pre.9", "num-bigint-dig", "num-integer", @@ -1184,7 +1236,7 @@ dependencies = [ "pkcs1", "pkcs8", "rand_core", - "sha1 0.11.0-pre.4", + "sha1", "sha2 0.11.0-pre.4", "signature", "spki", @@ -1275,17 +1327,6 @@ dependencies = [ "raunch", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha1" version = "0.11.0-pre.4" @@ -1393,7 +1434,7 @@ dependencies = [ "rstest", "secrecy", "service-binding", - "sha1 0.10.6", + "sha1", "signature", "ssh-encoding", "ssh-key", @@ -1407,8 +1448,7 @@ dependencies = [ [[package]] name = "ssh-cipher" version = "0.3.0-pre.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb72d294fa54bbbce8c75185b5df6c91739a74b7db8a248a095aa00d93f19d0" +source = "git+https://github.com/RustCrypto/SSH.git#e4198f52adf3cc29711c768b5f030d298affc347" dependencies = [ "cipher", "ssh-encoding", @@ -1417,8 +1457,7 @@ dependencies = [ [[package]] name = "ssh-encoding" version = "0.3.0-pre.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8db6c412940e90b3ba0900d6ea997483044cb534649541b681d3bcfb4a13e6" +source = "git+https://github.com/RustCrypto/SSH.git#e4198f52adf3cc29711c768b5f030d298affc347" dependencies = [ "base64ct", "pem-rfc7468", @@ -1428,9 +1467,10 @@ dependencies = [ [[package]] name = "ssh-key" version = "0.7.0-pre.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b74bf76aa566fdddede93c19e6ad286d123151058a6239d865a0dd87d5a4ca0" +source = "git+https://github.com/RustCrypto/SSH.git#e4198f52adf3cc29711c768b5f030d298affc347" dependencies = [ + "ed25519-dalek", + "home", "num-bigint-dig", "p256", "p384", diff --git a/Cargo.toml b/Cargo.toml index 52c4c7a..89ef332 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,8 +26,8 @@ log = { version = "0.4", optional = true } tokio = { version = "1", optional = true, features = ["rt", "net", "time"] } tokio-util = { version = "0.7", optional = true, features = ["codec"] } service-binding = { version = "^3" } -ssh-encoding = { version = "0.3.0-pre.0" } -ssh-key = { version = "0.7.0-pre.0", features = ["crypto", "alloc"] } +ssh-encoding = { version = "0.3.0-pre.0", features = ["alloc"] } +ssh-key = { version = "0.7.0-pre.0", features = ["crypto", "alloc", "rsa"] } thiserror = "1" subtle = { version = "2", default-features = false } signature = { version = "2.3.0-pre.4", features = ["alloc"] } @@ -43,7 +43,7 @@ env_logger = "0.11.3" rand = "0.8.5" rsa = { version = "0.10.0-pre.2", features = ["sha2", "sha1"] } tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] } -sha1 = { version = "0.10.6", default-features = false, features = ["oid"] } +sha1 = { version = "0.11.0-pre.4", default-features = false, features = ["oid"] } testresult = "0.4.0" hex-literal = "0.4.1" ssh-key = { version = "0.7.0-pre.0", features = ["p256", "rsa"] } @@ -57,3 +57,14 @@ secrecy = "0.8.0" retainer = "0.3.0" chrono = "0.4.38" interprocess = "2.2.0" + +[patch.crates-io] +# https://github.com/RustCrypto/SSH/pull/251 +ssh-key = { git = "https://github.com/RustCrypto/SSH.git" } +# needs a patch of ssh-encoding otherwise the ssh-key patch will pull its own +# and we will have two Encode/Decode traits. +ssh-encoding = { git = "https://github.com/RustCrypto/SSH.git" } + +# https://github.com/dalek-cryptography/curve25519-dalek/pull/676 +curve25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek.git", branch = "rustcrypto-new-releases" } +ed25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek.git", branch = "rustcrypto-new-releases" }