Skip to content

Commit 8e72580

Browse files
committed
fix new_seek_test
1 parent d805428 commit 8e72580

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
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.0"
3+
version = "0.3.1"
44
authors = ["RustCrypto Developers"]
55
license = "MIT OR Apache-2.0"
66
description = "Stream cipher traits"

stream-cipher/src/dev.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ macro_rules! new_seek_test {
4747
SyncStreamCipher, SyncStreamCipherSeek, NewStreamCipher
4848
};
4949
use stream_cipher::blobby::Blob4Iterator;
50+
use core::cmp;
5051

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

5859
let mut mode = <$cipher>::new_var(key, iv).unwrap();
59-
for seek_n in 0..512 {
60+
for seek_n in 0..cmp::min(512, plaintext.len()) {
6061
let mut pt = plaintext[seek_n..].to_vec();
6162
mode.seek(seek_n as u64);
6263
mode.apply_keystream(&mut pt);

0 commit comments

Comments
 (0)