Re-add SSE2 with soft fallback for non salsa20/20 variants#348
Re-add SSE2 with soft fallback for non salsa20/20 variants#348tarcieri merged 12 commits intoRustCrypto:masterfrom
Conversation
Co-authored-by: Tony Arcieri <bascule@gmail.com>
| #[inline(always)] | ||
| fn get_block_pos(&self) -> u64 { | ||
| (self.state[8] as u64) + ((self.state[9] as u64) << 32) | ||
| self.state[8] as u64 | ||
| } | ||
|
|
||
| #[inline(always)] | ||
| fn set_block_pos(&mut self, pos: u64) { | ||
| self.state[8] = (pos & 0xffff_ffff) as u32; | ||
| self.state[9] = ((pos >> 32) & 0xffff_ffff) as u32; | ||
| self.state[8] = pos as u32; | ||
| } |
There was a problem hiding this comment.
This looks like you're switching from a 64-bit to a 32-bit counter?
There was a problem hiding this comment.
Thank you for pointing me to that. It seems i changed the counter a while back because the xsalsa_seek test was not passing but i never went back to it to fix.
The problem is that when we are in sse2 mode the state is shuffled so it needs to get and set the counter in the right positions.
This was fixed in 98bf204
|
@baloo i think your comments were good and i wanted to give it a try however i was not able to find the time yet, iirc i tried that before i was not able to make the whole thing work so i ended up with the current layout. i might want to give it a new look. can you readd the comments ? |
|
@oxarbitrage I deleted my comments because they were incorrect. Situation is more complex than I initially thought. |
That makes sense, as i think i already tried what was in those comments without being able to make it work. Thanks. |
|
https://github.com/objectx/salsa20/blob/20d595b37597320a73acf87b3d3cc3ad3c9b66e6/src/salsa20.cxx#L182-L185 I like a lot the visual representation of the matrices in this one. I still think it should be possible to reproduce the quarter round in the soft backend. I might try that at some point when I have more time. |
Here i re-added the SSE2 with the caveat of variants.