7373 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg"
7474) ]
7575#![ warn( missing_docs, rust_2018_idioms, trivial_casts, unused_qualifications) ]
76-
77- use cfg_if:: cfg_if;
7876pub use cipher;
7977
8078use cipher:: {
@@ -178,17 +176,6 @@ impl<R: Unsigned> KeyIvInit for SalsaCore<R> {
178176
179177 state[ 15 ] = CONSTANTS [ 3 ] ;
180178
181- cfg_if ! {
182- if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
183- state = [
184- state[ 0 ] , state[ 5 ] , state[ 10 ] , state[ 15 ] ,
185- state[ 4 ] , state[ 9 ] , state[ 14 ] , state[ 3 ] ,
186- state[ 8 ] , state[ 13 ] , state[ 2 ] , state[ 7 ] ,
187- state[ 12 ] , state[ 1 ] , state[ 6 ] , state[ 11 ] ,
188- ] ;
189- }
190- }
191-
192179 Self {
193180 state,
194181 rounds : PhantomData ,
@@ -203,15 +190,7 @@ impl<R: Unsigned> StreamCipherCore for SalsaCore<R> {
203190 rem. try_into ( ) . ok ( )
204191 }
205192 fn process_with_backend ( & mut self , f : impl StreamCipherClosure < BlockSize = Self :: BlockSize > ) {
206- cfg_if ! {
207- if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
208- unsafe {
209- backends:: sse2:: inner:: <R , _>( & mut self . state, f) ;
210- }
211- } else {
212- f. call( & mut backends:: soft:: Backend ( self ) ) ;
213- }
214- }
193+ f. call ( & mut backends:: soft:: Backend ( self ) ) ;
215194 }
216195}
217196
@@ -220,28 +199,13 @@ impl<R: Unsigned> StreamCipherSeekCore for SalsaCore<R> {
220199
221200 #[ inline( always) ]
222201 fn get_block_pos ( & self ) -> u64 {
223- cfg_if ! {
224- if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
225- ( self . state[ 8 ] as u64 ) + ( ( self . state[ 5 ] as u64 ) << 32 )
226- }
227- else {
228- ( self . state[ 8 ] as u64 ) + ( ( self . state[ 9 ] as u64 ) << 32 )
229- }
230- }
202+ ( self . state [ 8 ] as u64 ) + ( ( self . state [ 9 ] as u64 ) << 32 )
231203 }
232204
233205 #[ inline( always) ]
234206 fn set_block_pos ( & mut self , pos : u64 ) {
235- cfg_if ! {
236- if #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
237- self . state[ 8 ] = ( pos & 0xffff_ffff ) as u32 ;
238- self . state[ 5 ] = ( ( pos >> 32 ) & 0xffff_ffff ) as u32 ;
239- }
240- else {
241- self . state[ 8 ] = ( pos & 0xffff_ffff ) as u32 ;
242- self . state[ 9 ] = ( ( pos >> 32 ) & 0xffff_ffff ) as u32 ;
243- }
244- }
207+ self . state [ 8 ] = ( pos & 0xffff_ffff ) as u32 ;
208+ self . state [ 9 ] = ( ( pos >> 32 ) & 0xffff_ffff ) as u32 ;
245209 }
246210}
247211
0 commit comments