Skip to content

Commit 5ae5b22

Browse files
committed
fixed sse2 tests
1 parent 8a8f8fe commit 5ae5b22

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

chacha20/src/backends/sse2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<R: Rounds> Backend<R> {
121121
fn gen_ks_blocks(&mut self, block: &mut [u32]) {
122122
unsafe {
123123
let res = rounds::<R>(&self.v);
124-
self.v[3] = _mm_add_epi64(self.v[3], _mm_set_epi64x(0, 1));
124+
self.v[3] = _mm_add_epi64(self.v[3], _mm_set_epi64x(0, PAR_BLOCKS as i64));
125125

126126
let blocks_ptr = block.as_mut_ptr() as *mut __m128i;
127127
for block in 0..PAR_BLOCKS {
@@ -138,7 +138,7 @@ impl<R: Rounds> Backend<R> {
138138
unsafe fn rounds<R: Rounds>(v: &[__m128i; 4]) -> [[__m128i; 4]; PAR_BLOCKS] {
139139
let mut res = [*v; 4];
140140
for block in 1..PAR_BLOCKS {
141-
res[block][3] = _mm_add_epi32(res[block][3], _mm_set_epi32(0, 0, 0, block as i32));
141+
res[block][3] = _mm_add_epi64(res[block][3], _mm_set_epi64x(0, block as i64));
142142
}
143143

144144
for _ in 0..R::COUNT {

chacha20/src/rng.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,7 @@ pub(crate) mod tests {
11621162
}
11631163

11641164
#[test]
1165+
#[ignore = "64 bit counter"]
11651166
fn test_chacha_word_pos_zero() {
11661167
let mut rng = ChaChaRng::from_seed(Default::default());
11671168
assert_eq!(rng.core.core.0.state[12], 0);

0 commit comments

Comments
 (0)