@@ -251,22 +251,6 @@ static u32 inv_mix_columns(u32 x)
251251 return mix_columns (x ^ y ^ ror32 (y , 16 ));
252252}
253253
254- static __always_inline u32 subshift (u32 in [], int pos )
255- {
256- return (aes_sbox [in [pos ] & 0xff ]) ^
257- (aes_sbox [(in [(pos + 1 ) % 4 ] >> 8 ) & 0xff ] << 8 ) ^
258- (aes_sbox [(in [(pos + 2 ) % 4 ] >> 16 ) & 0xff ] << 16 ) ^
259- (aes_sbox [(in [(pos + 3 ) % 4 ] >> 24 ) & 0xff ] << 24 );
260- }
261-
262- static __always_inline u32 inv_subshift (u32 in [], int pos )
263- {
264- return (aes_inv_sbox [in [pos ] & 0xff ]) ^
265- (aes_inv_sbox [(in [(pos + 3 ) % 4 ] >> 8 ) & 0xff ] << 8 ) ^
266- (aes_inv_sbox [(in [(pos + 2 ) % 4 ] >> 16 ) & 0xff ] << 16 ) ^
267- (aes_inv_sbox [(in [(pos + 1 ) % 4 ] >> 24 ) & 0xff ] << 24 );
268- }
269-
270254static u32 subw (u32 in )
271255{
272256 return (aes_sbox [in & 0xff ]) ^
@@ -345,51 +329,6 @@ int aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key,
345329}
346330EXPORT_SYMBOL (aes_expandkey );
347331
348- void aes_encrypt_old (const struct crypto_aes_ctx * ctx , u8 * out , const u8 * in )
349- {
350- const u32 * rkp = ctx -> key_enc + 4 ;
351- int rounds = 6 + ctx -> key_length / 4 ;
352- u32 st0 [4 ], st1 [4 ];
353- int round ;
354-
355- st0 [0 ] = ctx -> key_enc [0 ] ^ get_unaligned_le32 (in );
356- st0 [1 ] = ctx -> key_enc [1 ] ^ get_unaligned_le32 (in + 4 );
357- st0 [2 ] = ctx -> key_enc [2 ] ^ get_unaligned_le32 (in + 8 );
358- st0 [3 ] = ctx -> key_enc [3 ] ^ get_unaligned_le32 (in + 12 );
359-
360- /*
361- * Force the compiler to emit data independent Sbox references,
362- * by xoring the input with Sbox values that are known to add up
363- * to zero. This pulls the entire Sbox into the D-cache before any
364- * data dependent lookups are done.
365- */
366- st0 [0 ] ^= aes_sbox [ 0 ] ^ aes_sbox [ 64 ] ^ aes_sbox [134 ] ^ aes_sbox [195 ];
367- st0 [1 ] ^= aes_sbox [16 ] ^ aes_sbox [ 82 ] ^ aes_sbox [158 ] ^ aes_sbox [221 ];
368- st0 [2 ] ^= aes_sbox [32 ] ^ aes_sbox [ 96 ] ^ aes_sbox [160 ] ^ aes_sbox [234 ];
369- st0 [3 ] ^= aes_sbox [48 ] ^ aes_sbox [112 ] ^ aes_sbox [186 ] ^ aes_sbox [241 ];
370-
371- for (round = 0 ;; round += 2 , rkp += 8 ) {
372- st1 [0 ] = mix_columns (subshift (st0 , 0 )) ^ rkp [0 ];
373- st1 [1 ] = mix_columns (subshift (st0 , 1 )) ^ rkp [1 ];
374- st1 [2 ] = mix_columns (subshift (st0 , 2 )) ^ rkp [2 ];
375- st1 [3 ] = mix_columns (subshift (st0 , 3 )) ^ rkp [3 ];
376-
377- if (round == rounds - 2 )
378- break ;
379-
380- st0 [0 ] = mix_columns (subshift (st1 , 0 )) ^ rkp [4 ];
381- st0 [1 ] = mix_columns (subshift (st1 , 1 )) ^ rkp [5 ];
382- st0 [2 ] = mix_columns (subshift (st1 , 2 )) ^ rkp [6 ];
383- st0 [3 ] = mix_columns (subshift (st1 , 3 )) ^ rkp [7 ];
384- }
385-
386- put_unaligned_le32 (subshift (st1 , 0 ) ^ rkp [4 ], out );
387- put_unaligned_le32 (subshift (st1 , 1 ) ^ rkp [5 ], out + 4 );
388- put_unaligned_le32 (subshift (st1 , 2 ) ^ rkp [6 ], out + 8 );
389- put_unaligned_le32 (subshift (st1 , 3 ) ^ rkp [7 ], out + 12 );
390- }
391- EXPORT_SYMBOL (aes_encrypt_old );
392-
393332static __always_inline u32 enc_quarterround (const u32 w [4 ], int i , u32 rk )
394333{
395334 return rk ^ aes_enc_tab [(u8 )w [i ]] ^
@@ -498,51 +437,6 @@ static void __maybe_unused aes_decrypt_generic(const u32 inv_rndkeys[],
498437 put_unaligned_le32 (declast_quarterround (w , 3 , * rkp ++ ), & out [12 ]);
499438}
500439
501- void aes_decrypt_old (const struct crypto_aes_ctx * ctx , u8 * out , const u8 * in )
502- {
503- const u32 * rkp = ctx -> key_dec + 4 ;
504- int rounds = 6 + ctx -> key_length / 4 ;
505- u32 st0 [4 ], st1 [4 ];
506- int round ;
507-
508- st0 [0 ] = ctx -> key_dec [0 ] ^ get_unaligned_le32 (in );
509- st0 [1 ] = ctx -> key_dec [1 ] ^ get_unaligned_le32 (in + 4 );
510- st0 [2 ] = ctx -> key_dec [2 ] ^ get_unaligned_le32 (in + 8 );
511- st0 [3 ] = ctx -> key_dec [3 ] ^ get_unaligned_le32 (in + 12 );
512-
513- /*
514- * Force the compiler to emit data independent Sbox references,
515- * by xoring the input with Sbox values that are known to add up
516- * to zero. This pulls the entire Sbox into the D-cache before any
517- * data dependent lookups are done.
518- */
519- st0 [0 ] ^= aes_inv_sbox [ 0 ] ^ aes_inv_sbox [ 64 ] ^ aes_inv_sbox [129 ] ^ aes_inv_sbox [200 ];
520- st0 [1 ] ^= aes_inv_sbox [16 ] ^ aes_inv_sbox [ 83 ] ^ aes_inv_sbox [150 ] ^ aes_inv_sbox [212 ];
521- st0 [2 ] ^= aes_inv_sbox [32 ] ^ aes_inv_sbox [ 96 ] ^ aes_inv_sbox [160 ] ^ aes_inv_sbox [236 ];
522- st0 [3 ] ^= aes_inv_sbox [48 ] ^ aes_inv_sbox [112 ] ^ aes_inv_sbox [187 ] ^ aes_inv_sbox [247 ];
523-
524- for (round = 0 ;; round += 2 , rkp += 8 ) {
525- st1 [0 ] = inv_mix_columns (inv_subshift (st0 , 0 )) ^ rkp [0 ];
526- st1 [1 ] = inv_mix_columns (inv_subshift (st0 , 1 )) ^ rkp [1 ];
527- st1 [2 ] = inv_mix_columns (inv_subshift (st0 , 2 )) ^ rkp [2 ];
528- st1 [3 ] = inv_mix_columns (inv_subshift (st0 , 3 )) ^ rkp [3 ];
529-
530- if (round == rounds - 2 )
531- break ;
532-
533- st0 [0 ] = inv_mix_columns (inv_subshift (st1 , 0 )) ^ rkp [4 ];
534- st0 [1 ] = inv_mix_columns (inv_subshift (st1 , 1 )) ^ rkp [5 ];
535- st0 [2 ] = inv_mix_columns (inv_subshift (st1 , 2 )) ^ rkp [6 ];
536- st0 [3 ] = inv_mix_columns (inv_subshift (st1 , 3 )) ^ rkp [7 ];
537- }
538-
539- put_unaligned_le32 (inv_subshift (st1 , 0 ) ^ rkp [4 ], out );
540- put_unaligned_le32 (inv_subshift (st1 , 1 ) ^ rkp [5 ], out + 4 );
541- put_unaligned_le32 (inv_subshift (st1 , 2 ) ^ rkp [6 ], out + 8 );
542- put_unaligned_le32 (inv_subshift (st1 , 3 ) ^ rkp [7 ], out + 12 );
543- }
544- EXPORT_SYMBOL (aes_decrypt_old );
545-
546440/*
547441 * Note: the aes_prepare*key_* names reflect the fact that the implementation
548442 * might not actually expand the key. (The s390 code for example doesn't.)
@@ -608,19 +502,19 @@ int aes_prepareenckey(struct aes_enckey *key, const u8 *in_key, size_t key_len)
608502}
609503EXPORT_SYMBOL (aes_prepareenckey );
610504
611- void aes_encrypt_new (aes_encrypt_arg key , u8 out [AES_BLOCK_SIZE ],
612- const u8 in [AES_BLOCK_SIZE ])
505+ void aes_encrypt (aes_encrypt_arg key , u8 out [AES_BLOCK_SIZE ],
506+ const u8 in [AES_BLOCK_SIZE ])
613507{
614508 aes_encrypt_arch (key .enc_key , out , in );
615509}
616- EXPORT_SYMBOL (aes_encrypt_new );
510+ EXPORT_SYMBOL (aes_encrypt );
617511
618- void aes_decrypt_new (const struct aes_key * key , u8 out [AES_BLOCK_SIZE ],
619- const u8 in [AES_BLOCK_SIZE ])
512+ void aes_decrypt (const struct aes_key * key , u8 out [AES_BLOCK_SIZE ],
513+ const u8 in [AES_BLOCK_SIZE ])
620514{
621515 aes_decrypt_arch (key , out , in );
622516}
623- EXPORT_SYMBOL (aes_decrypt_new );
517+ EXPORT_SYMBOL (aes_decrypt );
624518
625519#ifdef aes_mod_init_arch
626520static int __init aes_mod_init (void )
0 commit comments