File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " stream-cipher"
3
- version = " 0.3.1 "
3
+ version = " 0.3.2 "
4
4
authors = [" RustCrypto Developers" ]
5
5
license = " MIT OR Apache-2.0"
6
6
description = " Stream cipher traits"
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ macro_rules! new_seek_test {
47
47
SyncStreamCipher , SyncStreamCipherSeek , NewStreamCipher
48
48
} ;
49
49
use stream_cipher:: blobby:: Blob4Iterator ;
50
- use core:: cmp;
50
+
51
+ const MAX_SEEK : usize = 512 ;
51
52
52
53
let data = include_bytes!( concat!( "data/" , $test_name, ".blb" ) ) ;
53
54
for ( i, row) in Blob4Iterator :: new( data) . unwrap( ) . enumerate( ) {
@@ -57,7 +58,9 @@ macro_rules! new_seek_test {
57
58
let ciphertext = row[ 3 ] ;
58
59
59
60
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 {
61
64
let mut pt = plaintext[ seek_n..] . to_vec( ) ;
62
65
mode. seek( seek_n as u64 ) ;
63
66
mode. apply_keystream( & mut pt) ;
You can’t perform that action at this time.
0 commit comments