diff --git a/.github/workflows/chacha20.yml b/.github/workflows/chacha20.yml index f3d97556..04de890b 100644 --- a/.github/workflows/chacha20.yml +++ b/.github/workflows/chacha20.yml @@ -41,6 +41,7 @@ jobs: - run: cargo build --target ${{ matrix.target }} --features zeroize minimal-versions: + if: false # TODO: temp disabled due to unpublished prerelease dependencies uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: working-directory: ${{ github.workflow }} diff --git a/.github/workflows/hc-256.yml b/.github/workflows/hc-256.yml index d30ed036..ae8598a6 100644 --- a/.github/workflows/hc-256.yml +++ b/.github/workflows/hc-256.yml @@ -39,6 +39,7 @@ jobs: - run: cargo build --target ${{ matrix.target }} --features zeroize minimal-versions: + if: false # TODO: temp disabled due to unpublished prerelease dependencies uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: working-directory: ${{ github.workflow }} diff --git a/.github/workflows/rabbit.yml b/.github/workflows/rabbit.yml index 5e0ed4c9..30c5cdd5 100644 --- a/.github/workflows/rabbit.yml +++ b/.github/workflows/rabbit.yml @@ -38,6 +38,7 @@ jobs: - run: cargo build --target ${{ matrix.target }} --features zeroize minimal-versions: + if: false # TODO: temp disabled due to unpublished prerelease dependencies uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: working-directory: ${{ github.workflow }} diff --git a/.github/workflows/rc4.yml b/.github/workflows/rc4.yml index a9a160a0..3eaff4ee 100644 --- a/.github/workflows/rc4.yml +++ b/.github/workflows/rc4.yml @@ -38,6 +38,7 @@ jobs: - run: cargo build --target ${{ matrix.target }} --features zeroize minimal-versions: + if: false # TODO: temp disabled due to unpublished prerelease dependencies uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: working-directory: ${{ github.workflow }} diff --git a/.github/workflows/salsa20.yml b/.github/workflows/salsa20.yml index 19a67879..fd1da8d9 100644 --- a/.github/workflows/salsa20.yml +++ b/.github/workflows/salsa20.yml @@ -38,6 +38,7 @@ jobs: - run: cargo build --target ${{ matrix.target }} --features zeroize minimal-versions: + if: false # TODO: temp disabled due to unpublished prerelease dependencies uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master with: working-directory: ${{ github.workflow }} diff --git a/Cargo.lock b/Cargo.lock index 16be5831..49f44fc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,14 +32,16 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "blobby" version = "0.4.0-pre.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a859067dcb257cb2ae028cb821399b55140b76fb8b2a360e052fe109019db43" +source = "git+https://github.com/RustCrypto/utils#f5ac85f6aa02aa39614f62a6a1add9468be67892" [[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +name = "block-buffer" +version = "0.11.0-rc.4" +source = "git+https://github.com/RustCrypto/utils?branch=block-buffer%2Fread-buf#79e12dfd745e732d24ba1566f705f35ba409edc6" +dependencies = [ + "hybrid-array", + "zeroize", +] [[package]] name = "cfg-if" @@ -66,10 +68,10 @@ dependencies = [ [[package]] name = "cipher" version = "0.5.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd4ef774202f1749465fc7cf88d70fc30620e8cacd5429268f4bff7d003bd976" +source = "git+https://github.com/RustCrypto/traits?branch=cipher%2Fread_buf#f63bd790c8a4f5383915f3b5a32c587be5854282" dependencies = [ "blobby", + "block-buffer", "crypto-common", "inout", "zeroize", @@ -87,8 +89,7 @@ dependencies = [ [[package]] name = "crypto-common" version = "0.2.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a23fa214dea9efd4dacee5a5614646b30216ae0f05d4bb51bafb50e9da1c5be" +source = "git+https://github.com/RustCrypto/traits?branch=cipher%2Fread_buf#f63bd790c8a4f5383915f3b5a32c587be5854282" dependencies = [ "hybrid-array", ] @@ -207,18 +208,18 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.7.35", + "zerocopy", ] [[package]] name = "proc-macro2" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beef09f85ae72cea1ef96ba6870c51e6382ebfa4f0e85b643459331f3daa5be0" +checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1" dependencies = [ "unicode-ident", ] @@ -294,12 +295,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom", - "zerocopy 0.8.18", ] [[package]] @@ -367,18 +367,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -387,9 +387,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.138" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -621,39 +621,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79386d31a42a4996e3336b0919ddb90f81112af416270cff95b5f5af22b839c2" -dependencies = [ - "zerocopy-derive 0.8.18", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "proc-macro2", - "quote", - "syn", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.18" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76331675d372f91bf8d17e13afbd5fe639200b73d01f0fc748bb059f9cca2db7" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 26910c8c..3c3d0b0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,11 @@ members = [ [profile.dev] opt-level = 2 + +[patch.crates-io] +# https://github.com/RustCrypto/utils/pull/1187 +blobby = { git = "https://github.com/RustCrypto/utils" } +# https://github.com/RustCrypto/traits/pull/1959 +cipher = { git = "https://github.com/RustCrypto/traits" } +# https://github.com/RustCrypto/utils/pull/1201 +block-buffer = { git = "https://github.com/RustCrypto/utils" } diff --git a/chacha20/Cargo.toml b/chacha20/Cargo.toml index cb87d5b3..7d340b54 100644 --- a/chacha20/Cargo.toml +++ b/chacha20/Cargo.toml @@ -20,7 +20,7 @@ rand_core-compatible RNGs based on those ciphers. [dependencies] cfg-if = "1" -cipher = { version = "0.5.0-rc.0", optional = true } +cipher = { version = "0.5.0-rc.0", optional = true, features = ["stream-wrapper"] } rand_core = { version = "0.9", optional = true, default-features = false } serde = { version = "1.0", features = ["derive"], optional = true } diff --git a/hc-256/Cargo.toml b/hc-256/Cargo.toml index 92e9327d..7336966f 100644 --- a/hc-256/Cargo.toml +++ b/hc-256/Cargo.toml @@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"] description = "Pure Rust implementation of the HC-256 stream cipher" [dependencies] -cipher = "0.5.0-rc.0" +cipher = { version = "0.5.0-rc.0", features = ["stream-wrapper"] } [dev-dependencies] cipher = { version = "0.5.0-rc.0", features = ["dev"] } diff --git a/rabbit/Cargo.toml b/rabbit/Cargo.toml index 997bc89b..8b27e855 100644 --- a/rabbit/Cargo.toml +++ b/rabbit/Cargo.toml @@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"] description = "Pure Rust implementation of the Rabbit stream cipher" [dependencies] -cipher = "0.5.0-rc.0" +cipher = { version = "0.5.0-rc.0", features = ["stream-wrapper"] } [dev-dependencies] cipher = { version = "0.5.0-rc.0", features = ["dev"] } diff --git a/rc4/Cargo.toml b/rc4/Cargo.toml index 83c90f37..96e0204b 100644 --- a/rc4/Cargo.toml +++ b/rc4/Cargo.toml @@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"] description = "Pure Rust implementation of the RC4 stream cipher" [dependencies] -cipher = "0.5.0-rc.0" +cipher = { version = "0.5.0-rc.0", features = ["stream-wrapper"] } [dev-dependencies] hex-literal = "1" diff --git a/salsa20/Cargo.toml b/salsa20/Cargo.toml index 52266b8a..7fac3405 100644 --- a/salsa20/Cargo.toml +++ b/salsa20/Cargo.toml @@ -14,7 +14,7 @@ description = "Pure Rust implementation of the Salsa20 stream cipher" [dependencies] cfg-if = "1" -cipher = "0.5.0-rc.0" +cipher = { version = "0.5.0-rc.0", features = ["stream-wrapper"] } [dev-dependencies] cipher = { version = "0.5.0-rc.0", features = ["dev"] } diff --git a/salsa20/tests/ecrypt.rs b/salsa20/tests/ecrypt.rs index d52cc534..48c87504 100644 --- a/salsa20/tests/ecrypt.rs +++ b/salsa20/tests/ecrypt.rs @@ -1,19 +1,22 @@ use cipher::{KeyIvInit, StreamCipher, StreamCipherSeek, blobby}; use salsa20::Salsa20; -static DATA: &[u8] = include_bytes!("data/ecrypt.blb"); - /// ECRYPT test vectors: /// https://github.com/das-labor/legacy/blob/master/microcontroller-2/arm-crypto-lib/testvectors/salsa20-256.64-verified.test-vectors #[test] fn salsa20_ecrypt() { - let test_vectors = blobby::Blob4Iterator::new(DATA).unwrap(); - for test_vector in test_vectors { - let [key, iv, pos, expected] = test_vector.unwrap(); + blobby::parse_into_structs!( + include_bytes!("data/ecrypt.blb"); + #[define_struct] + static TEST_VECTORS: &[ + TestVector { key, iv, pos, expected } + ]; + ); - let key = key.try_into().unwrap(); - let iv = iv.try_into().unwrap(); - let pos = u32::from_be_bytes(pos.try_into().unwrap()); + for tv in TEST_VECTORS { + let key = tv.key.try_into().unwrap(); + let iv = tv.iv.try_into().unwrap(); + let pos = u32::from_be_bytes(tv.pos.try_into().unwrap()); let mut c = Salsa20::new(key, iv); c.seek(pos); @@ -21,6 +24,6 @@ fn salsa20_ecrypt() { let mut buf = [0u8; 64]; c.apply_keystream(&mut buf); - assert_eq!(buf, expected); + assert_eq!(buf, tv.expected); } }