Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/chacha20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/hc-256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rabbit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rc4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/salsa20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
79 changes: 29 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion chacha20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
2 changes: 1 addition & 1 deletion hc-256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion rabbit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion rc4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion salsa20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
21 changes: 12 additions & 9 deletions salsa20/tests/ecrypt.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
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);

let mut buf = [0u8; 64];
c.apply_keystream(&mut buf);

assert_eq!(buf, expected);
assert_eq!(buf, tv.expected);
}
}
Loading