Skip to content

kuznyechik not buildable on non-x86 with feature zeroize #374

@alexanderkjall

Description

@alexanderkjall

This crate kuznyechik + feature zeroize can only be built on x86_64, it seems to fail on all other arches: https://qa.debian.org/excuses.php?package=rust-kuznyechik

This is the error that we get:

capitol@tone2i386:~/rust/kuznyechik-0.8.1$ cargo build --features zeroize
   Compiling cipher v0.4.4
   Compiling kuznyechik v0.8.1 (/home/capitol/rust/kuznyechik-0.8.1)
error[E0599]: no method named `zeroize` found for array `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]` in the current scope
  --> src/soft/mod.rs:84:19
   |
84 |         self.keys.zeroize();
   |                   ^^^^^^^ method not found in `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]`

error[E0599]: no method named `zeroize` found for array `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]` in the current scope
   --> src/soft/mod.rs:138:19
    |
138 |         self.keys.zeroize();
    |                   ^^^^^^^ method not found in `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]`

error[E0599]: no method named `zeroize` found for array `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]` in the current scope
   --> src/soft/mod.rs:208:19
    |
208 |         self.keys.zeroize();
    |                   ^^^^^^^ method not found in `[GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>>; 10]`

warning: unused import: `Zeroize`
 --> src/soft/mod.rs:9:23
  |
9 | use cipher::zeroize::{Zeroize, ZeroizeOnDrop};
  |                       ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

For more information about this error, try `rustc --explain E0599`.
warning: `kuznyechik` (lib) generated 1 warning
error: could not compile `kuznyechik` due to 3 previous errors; 1 warning emitted

It can be fixed with this patch:

diff --git a/Cargo.toml b/Cargo.toml
index f8132cb..63dfd0b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,6 +27,8 @@ all-features = true
 rustdoc-args = ["--cfg", "docsrs"]
 [dependencies.cipher]
 version = "0.4.2"
+[dependencies.generic-array]
+version = "0.14"
 [dev-dependencies.cipher]
 version = "0.4.2"
 features = ["dev"]
@@ -35,4 +37,4 @@ features = ["dev"]
 version = "0.3.3"

 [features]
-zeroize = ["cipher/zeroize"]
+zeroize = ["cipher/zeroize", "generic-array/zeroize"]

But I think this isn't the right solution, so I'm not sending it as a PR (but can of course if you want me to).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions