Skip to content

Commit 4765384

Browse files
committed
fix new_seek_test
1 parent 8e72580 commit 4765384

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

stream-cipher/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stream-cipher"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["RustCrypto Developers"]
55
license = "MIT OR Apache-2.0"
66
description = "Stream cipher traits"

stream-cipher/src/dev.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ macro_rules! new_seek_test {
4747
SyncStreamCipher, SyncStreamCipherSeek, NewStreamCipher
4848
};
4949
use stream_cipher::blobby::Blob4Iterator;
50-
use core::cmp;
50+
51+
const MAX_SEEK: usize = 512;
5152

5253
let data = include_bytes!(concat!("data/", $test_name, ".blb"));
5354
for (i, row) in Blob4Iterator::new(data).unwrap().enumerate() {
@@ -57,7 +58,9 @@ macro_rules! new_seek_test {
5758
let ciphertext = row[3];
5859

5960
let mut mode = <$cipher>::new_var(key, iv).unwrap();
60-
for seek_n in 0..cmp::min(512, plaintext.len()) {
61+
let pl = plaintext.len();
62+
let n = if pl > MAX_SEEK { MAX_SEEK } else { pl };
63+
for seek_n in 0..n {
6164
let mut pt = plaintext[seek_n..].to_vec();
6265
mode.seek(seek_n as u64);
6366
mode.apply_keystream(&mut pt);

0 commit comments

Comments
 (0)