Skip to content

Commit 7db3024

Browse files
committed
avoid duplicate definition of crates when pulling from git
This allows to pull a git dependency from outside this workspace without having to also pull all the transitive dependencies from within this workspace. Otherwise, the transitive dependency gets duplicated and you end up with objects not implementing trait error that are hard to debug. For example, if you pull aead = { git = "https://.../traits.git" } you end up with two definitions of crypto-common, one from crates.io and one from git. This causes issues because the objects you then pass to the aead traits do not implements the required traits from the crypto-common crates.
1 parent 1548d2a commit 7db3024

File tree

7 files changed

+32
-14
lines changed

7 files changed

+32
-14
lines changed

Cargo.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ members = [
1616
]
1717

1818
[patch.crates-io]
19-
signature = { path = "signature" }
19+
# Use crates.io patch instead of a `path = "../foo"` in each
20+
# crate of this workspace.
21+
# This allows to pull a git dependency from outside this workspace
22+
# without having to also pull all the transitive dependencies from
23+
# within this workspace.
24+
# Otherwise, the transitive dependency gets duplicated and you end
25+
# up with objects not implementing trait error that are hard to debug.
26+
aead = { path = "./aead" }
27+
async-signature = { path = "./async-signature" }
28+
cipher = { path = "./cipher" }
29+
crypto = { path = "./crypto" }
30+
crypto-common = { path = "./crypto-common" }
31+
digest = { path = "./digest" }
32+
elliptic-curve = { path = "./elliptic-curve" }
33+
kem = { path = "./kem" }
34+
password-hash = { path = "./password-hash" }
35+
signature_derive = { path = "./signature_derive" }
36+
universal-hash = { path = "./universal-hash" }
37+
signature = { path = "./signature" }
2038

2139
sha2 = { git = "https://github.com/RustCrypto/hashes" }
2240
sha3 = { git = "https://github.com/RustCrypto/hashes" }

aead/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ keywords = ["crypto", "encryption"]
1616
categories = ["cryptography", "no-std"]
1717

1818
[dependencies]
19-
crypto-common = { version = "0.2.0-rc.1", path = "../crypto-common" }
19+
crypto-common = { version = "0.2.0-rc.1" }
2020

2121
# optional dependencies
2222
arrayvec = { version = "0.7", optional = true, default-features = false }

cipher/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["crypto", "block-cipher", "stream-cipher", "trait"]
1313
categories = ["cryptography", "no-std"]
1414

1515
[dependencies]
16-
crypto-common = { version = "0.2.0-rc.2", path = "../crypto-common" }
16+
crypto-common = { version = "0.2.0-rc.2" }
1717
inout = "0.2.0-rc.4"
1818

1919
# optional dependencies

crypto/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ edition = "2024"
1313
rust-version = "1.85"
1414

1515
[dependencies]
16-
crypto-common = { version = "0.2.0-rc.1", path = "../crypto-common", default-features = false }
16+
crypto-common = { version = "0.2.0-rc.1", default-features = false }
1717

1818
# optional dependencies
19-
aead = { version = "0.6.0-rc.0", path = "../aead", optional = true }
20-
cipher = { version = "0.5.0-pre.7", path = "../cipher", optional = true }
21-
digest = { version = "0.11.0-pre.9", path = "../digest", optional = true, features = ["mac"] }
22-
elliptic-curve = { version = "0.14.0-rc.1", path = "../elliptic-curve", optional = true }
23-
password-hash = { version = "0.6.0-rc.0", path = "../password-hash", optional = true }
24-
signature = { version = "2.3.0-pre.6", path = "../signature", optional = true, default-features = false }
25-
universal-hash = { version = "0.6.0-rc.0", path = "../universal-hash", optional = true }
19+
aead = { version = "0.6.0-rc.0", optional = true }
20+
cipher = { version = "0.5.0-pre.7", optional = true }
21+
digest = { version = "0.11.0-pre.9", optional = true, features = ["mac"] }
22+
elliptic-curve = { version = "0.14.0-rc.1", optional = true }
23+
password-hash = { version = "0.6.0-rc.0", optional = true }
24+
signature = { version = "2.3.0-pre.6", optional = true, default-features = false }
25+
universal-hash = { version = "0.6.0-rc.0", optional = true }
2626

2727
[features]
2828
std = [

digest/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["digest", "crypto", "hash"]
1313
categories = ["cryptography", "no-std"]
1414

1515
[dependencies]
16-
crypto-common = { version = "0.2.0-rc.2", path = "../crypto-common" }
16+
crypto-common = { version = "0.2.0-rc.2" }
1717

1818
# optional dependencies
1919
block-buffer = { version = "0.11.0-rc.4", optional = true }

signature/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edition = "2024"
1414
rust-version = "1.85"
1515

1616
[dependencies]
17-
derive = { package = "signature_derive", version = "2", optional = true, path = "../signature_derive" }
17+
derive = { package = "signature_derive", version = "2", optional = true }
1818
digest = { version = "=0.11.0-pre.10", optional = true, default-features = false }
1919
rand_core = { version = "0.9", optional = true, default-features = false }
2020

universal-hash/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["crypto", "mac"]
1313
categories = ["cryptography", "no-std"]
1414

1515
[dependencies]
16-
crypto-common = { version = "0.2.0-rc.1", path = "../crypto-common" }
16+
crypto-common = { version = "0.2.0-rc.1" }
1717
subtle = { version = "2.4", default-features = false }
1818

1919
[package.metadata.docs.rs]

0 commit comments

Comments
 (0)