brndnmtthws / dryoc

Don't Roll Your Own Crypto: pure-Rust, hard to misuse cryptography library
https://docs.rs/dryoc
MIT License
267 stars 14 forks source link

[Bug]: error[E0599]: the method `zeroize` exists for mutable reference `&mut Option<EphemeralPublicKey>`, but its trait bounds were not satisfied #43

Closed degaart closed 1 year ago

degaart commented 1 year ago

What happened?

Creating a blank project with dryoc as dependency:

cargo new test1
cd test1
cargo add dryoc
cargo build

Gives the following errors:

error[E0599]: the method `zeroize` exists for mutable reference `&mut Option<EphemeralPublicKey>`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/dryocbox.rs:198:43
    |
198 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Option<EphemeralPublicKey>` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `&mut Option<EphemeralPublicKey>: DefaultIsZeroes`
            which is required by `&mut Option<EphemeralPublicKey>: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Mac`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/dryocbox.rs:198:43
    |
198 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Mac` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Mac: DefaultIsZeroes`
            which is required by `Mac: Zeroize`
            `&mut Mac: DefaultIsZeroes`
            which is required by `&mut Mac: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Data`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/dryocbox.rs:198:43
    |
198 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Data` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Data: DefaultIsZeroes`
            which is required by `Data: Zeroize`
            `&mut Data: DefaultIsZeroes`
            which is required by `&mut Data: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Mac`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/dryocsecretbox.rs:132:43
    |
132 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Mac` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Mac: DefaultIsZeroes`
            which is required by `Mac: Zeroize`
            `&mut Mac: DefaultIsZeroes`
            which is required by `&mut Mac: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Data`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/dryocsecretbox.rs:132:43
    |
132 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Data` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Data: DefaultIsZeroes`
            which is required by `Data: Zeroize`
            `&mut Data: DefaultIsZeroes`
            which is required by `&mut Data: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Key`, but its trait bounds were not satisfied
  --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/kdf.rs:51:43
   |
51 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
   |                                           ^^^^^^^ method cannot be called on `&mut Key` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `Key: DefaultIsZeroes`
           which is required by `Key: Zeroize`
           `&mut Key: DefaultIsZeroes`
           which is required by `&mut Key: Zeroize`
   = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Context`, but its trait bounds were not satisfied
  --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/kdf.rs:51:43
   |
51 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
   |                                           ^^^^^^^ method cannot be called on `&mut Context` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `Context: DefaultIsZeroes`
           which is required by `Context: Zeroize`
           `&mut Context: DefaultIsZeroes`
           which is required by `&mut Context: Zeroize`
   = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut PublicKey`, but its trait bounds were not satisfied
  --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/keypair.rs:32:43
   |
32 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Debug, Clone))]
   |                                           ^^^^^^^ method cannot be called on `&mut PublicKey` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `PublicKey: DefaultIsZeroes`
           which is required by `PublicKey: Zeroize`
           `&mut PublicKey: DefaultIsZeroes`
           which is required by `&mut PublicKey: Zeroize`
   = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut SecretKey`, but its trait bounds were not satisfied
  --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/keypair.rs:32:43
   |
32 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Debug, Clone))]
   |                                           ^^^^^^^ method cannot be called on `&mut SecretKey` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `SecretKey: DefaultIsZeroes`
           which is required by `SecretKey: Zeroize`
           `&mut SecretKey: DefaultIsZeroes`
           which is required by `&mut SecretKey: Zeroize`
   = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut SessionKey`, but its trait bounds were not satisfied
  --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/kx.rs:72:43
   |
72 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
   |                                           ^^^^^^^ method cannot be called on `&mut SessionKey` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `SessionKey: DefaultIsZeroes`
           which is required by `SessionKey: Zeroize`
           `&mut SessionKey: DefaultIsZeroes`
           which is required by `&mut SessionKey: Zeroize`
   = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Hash`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/pwhash.rs:209:43
    |
209 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Hash` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Hash: DefaultIsZeroes`
            which is required by `Hash: Zeroize`
            `&mut Hash: DefaultIsZeroes`
            which is required by `&mut Hash: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Salt`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/pwhash.rs:209:43
    |
209 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Salt` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Salt: DefaultIsZeroes`
            which is required by `Salt: Zeroize`
            `&mut Salt: DefaultIsZeroes`
            which is required by `&mut Salt: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut PublicKey`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/sign.rs:106:43
    |
106 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Debug, Clone))]
    |                                           ^^^^^^^ method cannot be called on `&mut PublicKey` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `PublicKey: DefaultIsZeroes`
            which is required by `PublicKey: Zeroize`
            `&mut PublicKey: DefaultIsZeroes`
            which is required by `&mut PublicKey: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut SecretKey`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/sign.rs:106:43
    |
106 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Debug, Clone))]
    |                                           ^^^^^^^ method cannot be called on `&mut SecretKey` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `SecretKey: DefaultIsZeroes`
            which is required by `SecretKey: Zeroize`
            `&mut SecretKey: DefaultIsZeroes`
            which is required by `&mut SecretKey: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Signature`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/sign.rs:305:43
    |
305 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Signature` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Signature: DefaultIsZeroes`
            which is required by `Signature: Zeroize`
            `&mut Signature: DefaultIsZeroes`
            which is required by `&mut Signature: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: the method `zeroize` exists for mutable reference `&mut Message`, but its trait bounds were not satisfied
   --> /Users/${CENSORED}/.cargo/registry/src/github.com-1ecc6299db9ec823/dryoc-0.4.3/src/sign.rs:305:43
    |
305 | #[cfg_attr(not(feature = "serde"), derive(Zeroize, Clone, Debug))]
    |                                           ^^^^^^^ method cannot be called on `&mut Message` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `Message: DefaultIsZeroes`
            which is required by `Message: Zeroize`
            `&mut Message: DefaultIsZeroes`
            which is required by `&mut Message: Zeroize`
    = note: this error originates in the derive macro `Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0599`.
error: could not compile `dryoc` due to 16 previous errors

rust version: 1.68.2

Version

0.4.3

Which OS are you seeing the problem on?

macOS

Test code

fn main() {}
brndnmtthws commented 1 year ago

Oof, that's odd. Let me take a look.

SimenB commented 1 year ago

@brndnmtthws any plans to do a release? πŸ™‚

brndnmtthws commented 1 year ago

@brndnmtthws any plans to do a release? πŸ™‚

I was hoping to add some other stuff first, but I probably won't finish it anytime soon, so I'll just cut this now :)

SimenB commented 1 year ago

Sweet, thanks!