diff options
author | Sebastian Siewior <sebastian@breakpoint.cc> | 2007-11-10 06:07:16 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:10 -0500 |
commit | 5157dea8139cf0edc4834d528531e642c0d27e37 (patch) | |
tree | 33d14cadc04c60ea95449c6bdc64ec0102eb823d /arch/x86/crypto/aes-i586-asm_32.S | |
parent | b345cee90a3ffec5eca6d6c1c59bd0d1feb453d4 (diff) |
[CRYPTO] aes-i586: Remove setkey
The setkey() function can be shared with the generic algorithm.
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/x86/crypto/aes-i586-asm_32.S')
-rw-r--r-- | arch/x86/crypto/aes-i586-asm_32.S | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/arch/x86/crypto/aes-i586-asm_32.S b/arch/x86/crypto/aes-i586-asm_32.S index f942f0c8f630..1093bede3e0a 100644 --- a/arch/x86/crypto/aes-i586-asm_32.S +++ b/arch/x86/crypto/aes-i586-asm_32.S | |||
@@ -46,9 +46,9 @@ | |||
46 | #define in_blk 16 | 46 | #define in_blk 16 |
47 | 47 | ||
48 | /* offsets in crypto_tfm structure */ | 48 | /* offsets in crypto_tfm structure */ |
49 | #define ekey (crypto_tfm_ctx_offset + 0) | 49 | #define klen (crypto_tfm_ctx_offset + 0) |
50 | #define nrnd (crypto_tfm_ctx_offset + 256) | 50 | #define ekey (crypto_tfm_ctx_offset + 4) |
51 | #define dkey (crypto_tfm_ctx_offset + 260) | 51 | #define dkey (crypto_tfm_ctx_offset + 244) |
52 | 52 | ||
53 | // register mapping for encrypt and decrypt subroutines | 53 | // register mapping for encrypt and decrypt subroutines |
54 | 54 | ||
@@ -221,8 +221,8 @@ | |||
221 | 221 | ||
222 | .global aes_enc_blk | 222 | .global aes_enc_blk |
223 | 223 | ||
224 | .extern ft_tab | 224 | .extern crypto_ft_tab |
225 | .extern fl_tab | 225 | .extern crypto_fl_tab |
226 | 226 | ||
227 | .align 4 | 227 | .align 4 |
228 | 228 | ||
@@ -236,7 +236,7 @@ aes_enc_blk: | |||
236 | 1: push %ebx | 236 | 1: push %ebx |
237 | mov in_blk+4(%esp),%r2 | 237 | mov in_blk+4(%esp),%r2 |
238 | push %esi | 238 | push %esi |
239 | mov nrnd(%ebp),%r3 // number of rounds | 239 | mov klen(%ebp),%r3 // key size |
240 | push %edi | 240 | push %edi |
241 | #if ekey != 0 | 241 | #if ekey != 0 |
242 | lea ekey(%ebp),%ebp // key pointer | 242 | lea ekey(%ebp),%ebp // key pointer |
@@ -255,26 +255,26 @@ aes_enc_blk: | |||
255 | 255 | ||
256 | sub $8,%esp // space for register saves on stack | 256 | sub $8,%esp // space for register saves on stack |
257 | add $16,%ebp // increment to next round key | 257 | add $16,%ebp // increment to next round key |
258 | cmp $12,%r3 | 258 | cmp $24,%r3 |
259 | jb 4f // 10 rounds for 128-bit key | 259 | jb 4f // 10 rounds for 128-bit key |
260 | lea 32(%ebp),%ebp | 260 | lea 32(%ebp),%ebp |
261 | je 3f // 12 rounds for 192-bit key | 261 | je 3f // 12 rounds for 192-bit key |
262 | lea 32(%ebp),%ebp | 262 | lea 32(%ebp),%ebp |
263 | 263 | ||
264 | 2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key | 264 | 2: fwd_rnd1( -64(%ebp), crypto_ft_tab) // 14 rounds for 256-bit key |
265 | fwd_rnd2( -48(%ebp) ,ft_tab) | 265 | fwd_rnd2( -48(%ebp), crypto_ft_tab) |
266 | 3: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 192-bit key | 266 | 3: fwd_rnd1( -32(%ebp), crypto_ft_tab) // 12 rounds for 192-bit key |
267 | fwd_rnd2( -16(%ebp) ,ft_tab) | 267 | fwd_rnd2( -16(%ebp), crypto_ft_tab) |
268 | 4: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key | 268 | 4: fwd_rnd1( (%ebp), crypto_ft_tab) // 10 rounds for 128-bit key |
269 | fwd_rnd2( +16(%ebp) ,ft_tab) | 269 | fwd_rnd2( +16(%ebp), crypto_ft_tab) |
270 | fwd_rnd1( +32(%ebp) ,ft_tab) | 270 | fwd_rnd1( +32(%ebp), crypto_ft_tab) |
271 | fwd_rnd2( +48(%ebp) ,ft_tab) | 271 | fwd_rnd2( +48(%ebp), crypto_ft_tab) |
272 | fwd_rnd1( +64(%ebp) ,ft_tab) | 272 | fwd_rnd1( +64(%ebp), crypto_ft_tab) |
273 | fwd_rnd2( +80(%ebp) ,ft_tab) | 273 | fwd_rnd2( +80(%ebp), crypto_ft_tab) |
274 | fwd_rnd1( +96(%ebp) ,ft_tab) | 274 | fwd_rnd1( +96(%ebp), crypto_ft_tab) |
275 | fwd_rnd2(+112(%ebp) ,ft_tab) | 275 | fwd_rnd2(+112(%ebp), crypto_ft_tab) |
276 | fwd_rnd1(+128(%ebp) ,ft_tab) | 276 | fwd_rnd1(+128(%ebp), crypto_ft_tab) |
277 | fwd_rnd2(+144(%ebp) ,fl_tab) // last round uses a different table | 277 | fwd_rnd2(+144(%ebp), crypto_fl_tab) // last round uses a different table |
278 | 278 | ||
279 | // move final values to the output array. CAUTION: the | 279 | // move final values to the output array. CAUTION: the |
280 | // order of these assigns rely on the register mappings | 280 | // order of these assigns rely on the register mappings |
@@ -297,8 +297,8 @@ aes_enc_blk: | |||
297 | 297 | ||
298 | .global aes_dec_blk | 298 | .global aes_dec_blk |
299 | 299 | ||
300 | .extern it_tab | 300 | .extern crypto_it_tab |
301 | .extern il_tab | 301 | .extern crypto_il_tab |
302 | 302 | ||
303 | .align 4 | 303 | .align 4 |
304 | 304 | ||
@@ -312,14 +312,11 @@ aes_dec_blk: | |||
312 | 1: push %ebx | 312 | 1: push %ebx |
313 | mov in_blk+4(%esp),%r2 | 313 | mov in_blk+4(%esp),%r2 |
314 | push %esi | 314 | push %esi |
315 | mov nrnd(%ebp),%r3 // number of rounds | 315 | mov klen(%ebp),%r3 // key size |
316 | push %edi | 316 | push %edi |
317 | #if dkey != 0 | 317 | #if dkey != 0 |
318 | lea dkey(%ebp),%ebp // key pointer | 318 | lea dkey(%ebp),%ebp // key pointer |
319 | #endif | 319 | #endif |
320 | mov %r3,%r0 | ||
321 | shl $4,%r0 | ||
322 | add %r0,%ebp | ||
323 | 320 | ||
324 | // input four columns and xor in first round key | 321 | // input four columns and xor in first round key |
325 | 322 | ||
@@ -333,27 +330,27 @@ aes_dec_blk: | |||
333 | xor 12(%ebp),%r5 | 330 | xor 12(%ebp),%r5 |
334 | 331 | ||
335 | sub $8,%esp // space for register saves on stack | 332 | sub $8,%esp // space for register saves on stack |
336 | sub $16,%ebp // increment to next round key | 333 | add $16,%ebp // increment to next round key |
337 | cmp $12,%r3 | 334 | cmp $24,%r3 |
338 | jb 4f // 10 rounds for 128-bit key | 335 | jb 4f // 10 rounds for 128-bit key |
339 | lea -32(%ebp),%ebp | 336 | lea 32(%ebp),%ebp |
340 | je 3f // 12 rounds for 192-bit key | 337 | je 3f // 12 rounds for 192-bit key |
341 | lea -32(%ebp),%ebp | 338 | lea 32(%ebp),%ebp |
342 | 339 | ||
343 | 2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key | 340 | 2: inv_rnd1( -64(%ebp), crypto_it_tab) // 14 rounds for 256-bit key |
344 | inv_rnd2( +48(%ebp), it_tab) | 341 | inv_rnd2( -48(%ebp), crypto_it_tab) |
345 | 3: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 192-bit key | 342 | 3: inv_rnd1( -32(%ebp), crypto_it_tab) // 12 rounds for 192-bit key |
346 | inv_rnd2( +16(%ebp), it_tab) | 343 | inv_rnd2( -16(%ebp), crypto_it_tab) |
347 | 4: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key | 344 | 4: inv_rnd1( (%ebp), crypto_it_tab) // 10 rounds for 128-bit key |
348 | inv_rnd2( -16(%ebp), it_tab) | 345 | inv_rnd2( +16(%ebp), crypto_it_tab) |
349 | inv_rnd1( -32(%ebp), it_tab) | 346 | inv_rnd1( +32(%ebp), crypto_it_tab) |
350 | inv_rnd2( -48(%ebp), it_tab) | 347 | inv_rnd2( +48(%ebp), crypto_it_tab) |
351 | inv_rnd1( -64(%ebp), it_tab) | 348 | inv_rnd1( +64(%ebp), crypto_it_tab) |
352 | inv_rnd2( -80(%ebp), it_tab) | 349 | inv_rnd2( +80(%ebp), crypto_it_tab) |
353 | inv_rnd1( -96(%ebp), it_tab) | 350 | inv_rnd1( +96(%ebp), crypto_it_tab) |
354 | inv_rnd2(-112(%ebp), it_tab) | 351 | inv_rnd2(+112(%ebp), crypto_it_tab) |
355 | inv_rnd1(-128(%ebp), it_tab) | 352 | inv_rnd1(+128(%ebp), crypto_it_tab) |
356 | inv_rnd2(-144(%ebp), il_tab) // last round uses a different table | 353 | inv_rnd2(+144(%ebp), crypto_il_tab) // last round uses a different table |
357 | 354 | ||
358 | // move final values to the output array. CAUTION: the | 355 | // move final values to the output array. CAUTION: the |
359 | // order of these assigns rely on the register mappings | 356 | // order of these assigns rely on the register mappings |