dalek-cryptography / ed25519-dalek

Fast and efficient ed25519 signing and verification in Rust.
BSD 3-Clause "New" or "Revised" License
684 stars 227 forks source link

2.0.0-pre.0 fails to compile #292

Closed chanced closed 1 year ago

chanced commented 1 year ago

I'm not sure if I have a conflicting crate dependency but I'm now running into the following issue:

▶ cargo check
    Checking ed25519-dalek v2.0.0-pre.0
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-dalek-2.0.0-pre.0/src/verifying.rs:528:27
    |
528 | impl TryFrom<pkcs8::spki::SubjectPublicKeyInfo<'_>> for VerifyingKey {
    |                           ^^^^^^^^^^^^^^^^^^^^---- help: remove these generics
    |                           |
    |                           expected 0 lifetime arguments
    |
note: struct defined here, with 0 lifetime parameters
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/spki-0.7.0/src/spki.rs:44:12
    |
44  | pub struct SubjectPublicKeyInfo<Params, Key> {
    |            ^^^^^^^^^^^^^^^^^^^^

error[E0107]: this struct takes 2 generic arguments but 0 generic arguments were supplied
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-dalek-2.0.0-pre.0/src/verifying.rs:528:27
    |
528 | impl TryFrom<pkcs8::spki::SubjectPublicKeyInfo<'_>> for VerifyingKey {
    |                           ^^^^^^^^^^^^^^^^^^^^ expected 2 generic arguments
    |
note: struct defined here, with 2 generic parameters: `Params`, `Key`
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/spki-0.7.0/src/spki.rs:44:12
    |
44  | pub struct SubjectPublicKeyInfo<Params, Key> {
    |            ^^^^^^^^^^^^^^^^^^^^ ------  ---
help: add missing generic arguments
    |
528 | impl TryFrom<pkcs8::spki::SubjectPublicKeyInfo<'_, Params, Key>> for VerifyingKey {
    |                                                  +++++++++++++

error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-dalek-2.0.0-pre.0/src/verifying.rs:531:42
    |
531 |     fn try_from(public_key: pkcs8::spki::SubjectPublicKeyInfo<'_>) -> pkcs8::spki::Result<Self> {
    |                                          ^^^^^^^^^^^^^^^^^^^^---- help: remove these generics
    |                                          |
    |                                          expected 0 lifetime arguments
    |
note: struct defined here, with 0 lifetime parameters
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/spki-0.7.0/src/spki.rs:44:12
    |
44  | pub struct SubjectPublicKeyInfo<Params, Key> {
    |            ^^^^^^^^^^^^^^^^^^^^

error[E0107]: this struct takes 2 generic arguments but 0 generic arguments were supplied
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-dalek-2.0.0-pre.0/src/verifying.rs:531:42
    |
531 |     fn try_from(public_key: pkcs8::spki::SubjectPublicKeyInfo<'_>) -> pkcs8::spki::Result<Self> {
    |                                          ^^^^^^^^^^^^^^^^^^^^ expected 2 generic arguments
    |
note: struct defined here, with 2 generic parameters: `Params`, `Key`
   --> /Users/chance/.cargo/registry/src/github.com-1ecc6299db9ec823/spki-0.7.0/src/spki.rs:44:12
    |
44  | pub struct SubjectPublicKeyInfo<Params, Key> {
    |            ^^^^^^^^^^^^^^^^^^^^ ------  ---
help: add missing generic arguments
    |
531 |     fn try_from(public_key: pkcs8::spki::SubjectPublicKeyInfo<'_, Params, Key>) -> pkcs8::spki::Result<Self> {
    |                                                                 +++++++++++++

For more information about this error, try `rustc --explain E0107`.
error: could not compile `ed25519-dalek` due to 4 previous errors

My Cargo.toml dependencies:

# futures
# https://docs.rs/futures/0.3.27/futures/
[dependencies.futures]
version = "0.3"

# pin-project
# https://docs.rs/pin-project/1.0.12/pin_project/
[dependencies.pin-project]
version = "1.0"

# rayon
# https://docs.rs/rayon/1.7.0/rayon/
[dependencies.rayon]
version = "1.6"
optional = true

# serde
# https://serde.rs/ 
# https://docs.rs/serde/1.0.158/serde/
[dependencies.serde]
version = "1.0"
default-features = false
features = ["alloc", "derive", "rc"]

# serde_json
# https://docs.rs/serde_json/1.0.94/serde_json/
# https://serde.rs/ 
[dependencies.serde_json]
version = "1.0"
default-features = false
features = ["alloc", "raw_value"]

# base64
# https://docs.rs/base64/0.21.0/base64/
[dependencies.base64]
version = "0.21"
default-features = false
features = ["alloc"]

# inherent
# https://docs.rs/inherent/1.0.6/inherent/
[dependencies.inherent]
version = "1"

# zeroize
# https://docs.rs/zeroize/1.5.7/zeroize/
[dependencies.zeroize]
version = "1.5"
features = ["alloc", "zeroize_derive", "serde"]

# rand_core
# https://docs.rs/rand_core/0.6.4/rand_core/
[dependencies.rand_core]
version = "0.6"
features = ["getrandom"]

# strum
# https://docs.rs/strum/0.24.1/strum/
[dependencies.strum]
version = "0.24"
default-features = false
features = ["derive", "strum_macros"]

# strum_macros
# https://docs.rs/strum_macros/0.24.3/strum_macros/
[dependencies.strum_macros]
version = "0.24"

# bytes
# https://docs.rs/bytes/1.4.0/bytes/
[dependencies.bytes]
version = "1.4"
optional = true

# ring
# https://docs.rs/ring/0.16.20/ring/
[dependencies.ring]
version = "0.16"
optional = true

# typenum
# https://docs.rs/typenum/1.16.0/typenum/
[dependencies.typenum]
features = ["no_std"]
version = "1.16"

# generic-array
# https://docs.rs/generic-array/0.14.6/generic_array/
[dependencies.generic-array]
version = "0.14.6"

# aes-siv
# https://docs.rs/aes-siv/0.7.0/aes_siv/
[dependencies.aes-siv]
version = "0.7"
optional = true

# crypto-common
# https://docs.rs/crypto-common/0.1.6/crypto_common/
[dependencies.crypto-common]
version = "0.1.6"

# chacha20poly1305
# https://docs.rs/chacha20poly1305/0.10.1/chacha20poly1305/
[dependencies.chacha20poly1305]
version = "0.10"

# hmac
# https://docs.rs/hmac/0.12.1/hmac/
[dependencies.hmac]
version = "0.12"
optional = true
default-features = false
features = ["reset"]

# aead
# https://docs.rs/aead/0.5.1/aead/
[dependencies.rust_crypto_aead]
version = "0.5"
package = "aead"

# aes-gcm
# https://docs.rs/aes-gcm/0.10.1/aes_gcm/
[dependencies.aes-gcm]
version = "0.10"
features = ["zeroize"]

# p256
# https://docs.rs/p256/0.12.0/p256/
[dependencies.p256]
version = "0.12"
optional = true
features = ["ecdsa", "pkcs8", "pem", "hash2curve"]

# p384
# https://docs.rs/p384/0.13.0/p384/
[dependencies.p384]
version = "0.12"
optional = true
features = ["ecdsa", "pkcs8", "pem", "hash2curve"]

# sha2
# https://docs.rs/sha2/0.10.6/sha2/
[dependencies.sha2]
version = "0.10"
optional = true

# sha3
# https://docs.rs/sha3/0.10.6/sha3/
[dependencies.sha3]
version = "0.10"
optional = true
default-features = false

# pkcs8
# https://docs.rs/pkcs8/0.10.1/pkcs8/
[dependencies.pkcs8]
version = "0.10"
default-features = false
features = ["alloc", "pem"]

# cmac
# https://docs.rs/cmac/0.7.2/cmac/
[dependencies.cmac]
version = "0.7"
optional = true
features = ["zeroize"]

# subtle
# https://docs.rs/subtle/2.5.0/subtle/
[dependencies.subtle]
version = "2.4"

# blake3
# https://docs.rs/blake3/1.3.3/blake3/
[dependencies.blake3]
version = "1.3"
optional = true

# hkdf
# https://docs.rs/hkdf/0.12.3/hkdf/
[dependencies.rust_crypto_hkdf]
package = "hkdf"
version = "0.12"

# aes
# https://docs.rs/aes/0.8.2/aes/
[dependencies.aes]
version = "0.8.2"
optional = true
features = ["zeroize"]

# digest
# https://docs.rs/digest/0.10.6/digest/
[dependencies.digest]
version = "0.10"
default-features = false
features = ["alloc"]

# ed25519-dalek
# https://docs.rs/ed25519-dalek/2.0.0-pre.0/ed25519_dalek/index.html
[dependencies.ed25519-dalek]
version = "2.0.0-pre.0"
optional = true
default-features = false
features = ["alloc", "rand_core", "pkcs8", "pem", "zeroize", "serde"]

# sec1
# https://docs.rs/sec1/0.7.1/sec1/
[dependencies.sec1]
version = "0.7.1"

# elliptic-curve
# https://docs.rs/elliptic-curve/0.13.2/elliptic_curve/
[dependencies.elliptic-curve]
version = "0.13"
features = ["sec1"]

https://github.com/chanced/navajo/blob/main/navajo/Cargo.toml

tarcieri commented 1 year ago

You're using pkcs8 v0.10 and pre.0 requires pkcs8 v0.9.

The compile error is because the prerelease didn't constrain ed25119 releases where pkcs8 is a transitive dependency, however that constraint was added in #285 (unreleased).

Things will work if you use ed25519-dalek from git, or otherwise we should probably cut another prerelease /cc @rozbb

chanced commented 1 year ago

you're awesome @tarcieri; thanks!

I'll go ahead and close it as there's an unreleased solution. Feel free to open it back up if it helps with tracking.

Thanks again.