RustCrypto / RustCrypto/signatures

`lms` version 0.0.1 failure to compile

Open
#1,039 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
661
Forks
196
Avg merge
1h 45m
Merged PRs (30d)
1

Description

Use of the lms-signature package at the current public version (https://docs.rs/lms-signature/0.0.1/lms_signature/) fails to compile, with the following:

To reproduce:

cd $(mktemp -d /tmp/tmp_XXXXXXXX)
cargo init
echo 'lms-signature = "0.0.1"' >> Cargo.toml  # adds to dependencies
cargo build

This yields the following compilation errors:

    Creating binary (application) package
warning: the name `tmp_NPtfc1D2` is not snake_case or kebab-case which is recommended for package names, consider `tmp_nptfc1d2`
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    Updating crates.io index
     Locking 35 packages to latest Rust 1.87.0 compatible versions
      Adding digest v0.11.0-pre.10 (available: v0.11.0-rc.0)
   Compiling typenum v1.18.0
   Compiling version_check v0.9.5
   Compiling libc v0.2.175
   Compiling zerocopy v0.8.26
   Compiling generic-array v0.14.7
   Compiling cfg-if v1.0.1
   Compiling zeroize v1.8.1
   Compiling cpufeatures v0.2.17
   Compiling rand_core v0.9.3
   Compiling static_assertions v1.1.0
   Compiling getrandom v0.2.16
   Compiling hybrid-array v0.3.1
   Compiling rand_core v0.6.4
   Compiling crypto-common v0.2.0-rc.3
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.9
   Compiling ppv-lite86 v0.2.21
   Compiling rand_chacha v0.3.1
   Compiling rand v0.8.5
   Compiling digest v0.11.0-pre.10
   Compiling signature v2.3.0-pre.7
   Compiling lms-signature v0.0.1
error[E0643]: method `try_sign_with_rng` has incompatible signature for trait
   --> /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lms-signature-0.0.1/src/lms/private.rs:110:19
    |
110 |         rng: &mut impl rand_core::CryptoRngCore,
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected generic parameter, found `impl Trait`
    |
   ::: /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/signature-2.3.0-pre.7/src/signer.rs:143:26
    |
143 |     fn try_sign_with_rng<R: TryCryptoRng + ?Sized>(
    |                          - declaration in trait here

error[E0643]: method `try_sign_with_rng` has incompatible signature for trait
   --> /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lms-signature-0.0.1/src/ots/private.rs:102:19
    |
102 |         rng: &mut impl CryptoRngCore,
    |                   ^^^^^^^^^^^^^^^^^^ expected generic parameter, found `impl Trait`
    |
   ::: /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/signature-2.3.0-pre.7/src/signer.rs:143:26
    |
143 |     fn try_sign_with_rng<R: TryCryptoRng + ?Sized>(
    |                          - declaration in trait here

error[E0277]: the trait bound `impl rand_core::CryptoRngCore: TryCryptoRng` is not satisfied
   --> /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/lms-signature-0.0.1/src/lms/private.rs:119:54
    |
119 |         let ots_sig = ots_priv_key.try_sign_with_rng(rng, msg)?;
    |                                    ----------------- ^^^ the trait `DerefMut` is not implemented for `impl rand_core::CryptoRngCore`
    |                                    |
    |                                    required by a bound introduced by this call
    |
    = note: required for `impl rand_core::CryptoRngCore` to implement `signature::rand_core::CryptoRng`
    = note: required for `impl rand_core::CryptoRngCore` to implement `TryCryptoRng`
note: required by a bound in `signature::RandomizedSignerMut::try_sign_with_rng`
   --> /home/gram/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/signature-2.3.0-pre.7/src/signer.rs:143:29
    |
143 |     fn try_sign_with_rng<R: TryCryptoRng + ?Sized>(
    |                             ^^^^^^^^^^^^ required by this bound in `RandomizedSignerMut::try_sign_with_rng`
help: consider restricting opaque type `impl rand_core::CryptoRngCore` with trait `DerefMut`
    |
110 |         rng: &mut impl rand_core::CryptoRngCore + std::ops::DerefMut,
    |                                                 ++++++++++++++++++++

Some errors have detailed explanations: E0277, E0643.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `lms-signature` (lib) due to 3 previous errors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown temporary Cargo project and cargo build. Inspect src/lms/private.rs and src/ots/private.rs, then compare their try_sign_with_rng methods with the signature trait shown in the compiler output; done means the lms-signature 0.0.1 dependency compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.