2012-09-07 00:17:02 +04:00
# define _ _ A R M _ A R C H _ _ _ _ L I N U X _ A R M _ A R C H _ _
@ ====================================================================
@ Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
@ project. The module is, however, dual licensed under OpenSSL and
@ CRYPTOGAMS licenses depending on where you obtain it. For further
@ details see http://www.openssl.org/~appro/cryptogams/.
@ ====================================================================
@ AES for ARMv4
@ January 2007.
@
@ Code uses single 1K S-box and is >2 times faster than code generated
@ by gcc-3.4.1. This is thanks to unique feature of ARMv4 ISA, which
@ allows to merge logical or arithmetic operation with shift or rotate
@ in one instruction and emit combined result every cycle. The module
@ is endian-neutral. The performance is ~42 cycles/byte for 128-bit
@ key [on single-issue Xscale PXA250 core].
@ May 2007.
@
@ AES_set_[en|de]crypt_key is added.
@ July 2010.
@
@ Rescheduling for dual-issue pipeline resulted in 12% improvement on
@ Cortex A8 core and ~25 cycles per byte processed with 128-bit key.
@ February 2011.
@
@ Profiler-assisted and platform-specific optimization resulted in 16%
@ improvement on Cortex A8 core and ~21.5 cycles per byte.
@ A little glue here to select the correct code below for the ARM CPU
@ that is being targetted.
2013-01-10 15:20:15 +04:00
# include < l i n u x / l i n k a g e . h >
2014-06-30 19:29:12 +04:00
# include < a s m / a s s e m b l e r . h >
2013-01-10 15:20:15 +04:00
2012-09-07 00:17:02 +04:00
.text
.type AES_ T e ,% o b j e c t
.align 5
AES_Te :
.word 0 xc6 6 3 6 3 a5 , 0 x f87 c7 c84 , 0 x e e 7 7 7 7 9 9 , 0 x f67 b7 b8 d
.word 0 xfff2 f20 d , 0 x d66 b6 b b d , 0 x d e 6 f6 f b1 , 0 x91 c5 c55 4
.word 0 x6 0 3 0 3 0 5 0 , 0 x02 0 1 0 1 0 3 , 0 x c e 6 7 6 7 a9 , 0 x56 2 b2 b7 d
.word 0 xe7 f e f e 1 9 , 0 x b5 d7 d76 2 , 0 x4 d a b a b e 6 , 0 x e c76 7 6 9 a
.word 0 x8 f c a c a45 , 0 x1 f82 8 2 9 d , 0 x89 c9 c94 0 , 0 x f a7 d7 d87
.word 0 xeffafa1 5 , 0 x b25 9 5 9 e b , 0 x8 e 4 7 4 7 c9 , 0 x f b f0 f00 b
.word 0 x4 1 a d a d e c , 0 x b3 d4 d46 7 , 0 x5 f a2 a2 f d , 0 x45 a f a f e a
.word 0 x2 3 9 c9 c b f , 0 x53 a4 a4 f7 , 0 x e 4 7 2 7 2 9 6 , 0 x9 b c0 c05 b
.word 0 x7 5 b7 b7 c2 , 0 x e 1 f d f d1 c , 0 x3 d93 9 3 a e , 0 x4 c26 2 6 6 a
.word 0 x6 c36 3 6 5 a , 0 x7 e 3 f3 f41 , 0 x f5 f7 f70 2 , 0 x83 c c c c4 f
.word 0 x6 8 3 4 3 4 5 c , 0 x51 a5 a5 f4 , 0 x d1 e 5 e 5 3 4 , 0 x f9 f1 f10 8
.word 0 xe2 7 1 7 1 9 3 , 0 x a b d8 d87 3 , 0 x62 3 1 3 1 5 3 , 0 x2 a15 1 5 3 f
.word 0 x0 8 0 4 0 4 0 c , 0 x95 c7 c75 2 , 0 x46 2 3 2 3 6 5 , 0 x9 d c3 c35 e
.word 0 x3 0 1 8 1 8 2 8 , 0 x37 9 6 9 6 a1 , 0 x0 a05 0 5 0 f , 0 x2 f9 a9 a b5
.word 0 x0 e 0 7 0 7 0 9 , 0 x24 1 2 1 2 3 6 , 0 x1 b80 8 0 9 b , 0 x d f e 2 e 2 3 d
.word 0 xcdebeb2 6 , 0 x4 e 2 7 2 7 6 9 , 0 x7 f b2 b2 c d , 0 x e a75 7 5 9 f
.word 0 x1 2 0 9 0 9 1 b , 0 x1 d83 8 3 9 e , 0 x58 2 c2 c74 , 0 x34 1 a1 a2 e
.word 0 x3 6 1 b1 b2 d , 0 x d c6 e 6 e b2 , 0 x b45 a5 a e e , 0 x5 b a0 a0 f b
.word 0 xa4 5 2 5 2 f6 , 0 x76 3 b3 b4 d , 0 x b7 d6 d66 1 , 0 x7 d b3 b3 c e
.word 0 x5 2 2 9 2 9 7 b , 0 x d d e 3 e 3 3 e , 0 x5 e 2 f2 f71 , 0 x13 8 4 8 4 9 7
.word 0 xa6 5 3 5 3 f5 , 0 x b9 d1 d16 8 , 0 x00 0 0 0 0 0 0 , 0 x c1 e d e d2 c
.word 0 x4 0 2 0 2 0 6 0 , 0 x e 3 f c f c1 f , 0 x79 b1 b1 c8 , 0 x b65 b5 b e d
.word 0 xd4 6 a6 a b e , 0 x8 d c b c b46 , 0 x67 b e b e d9 , 0 x72 3 9 3 9 4 b
.word 0 x9 4 4 a4 a d e , 0 x98 4 c4 c d4 , 0 x b05 8 5 8 e 8 , 0 x85 c f c f4 a
.word 0 xbbd0 d06 b , 0 x c5 e f e f2 a , 0 x4 f a a a a e 5 , 0 x e d f b f b16
.word 0 x8 6 4 3 4 3 c5 , 0 x9 a4 d4 d d7 , 0 x66 3 3 3 3 5 5 , 0 x11 8 5 8 5 9 4
.word 0 x8 a45 4 5 c f , 0 x e 9 f9 f91 0 , 0 x04 0 2 0 2 0 6 , 0 x f e 7 f7 f81
.word 0 xa0 5 0 5 0 f0 , 0 x78 3 c3 c44 , 0 x25 9 f9 f b a , 0 x4 b a8 a8 e 3
.word 0 xa2 5 1 5 1 f3 , 0 x5 d a3 a3 f e , 0 x80 4 0 4 0 c0 , 0 x05 8 f8 f8 a
.word 0 x3 f92 9 2 a d , 0 x21 9 d9 d b c , 0 x70 3 8 3 8 4 8 , 0 x f1 f5 f50 4
.word 0 x6 3 b c b c d f , 0 x77 b6 b6 c1 , 0 x a f d a d a75 , 0 x42 2 1 2 1 6 3
.word 0 x2 0 1 0 1 0 3 0 , 0 x e 5 f f f f1 a , 0 x f d f3 f30 e , 0 x b f d2 d26 d
.word 0 x8 1 c d c d4 c , 0 x18 0 c0 c14 , 0 x26 1 3 1 3 3 5 , 0 x c3 e c e c2 f
.word 0 xbe5 f5 f e 1 , 0 x35 9 7 9 7 a2 , 0 x88 4 4 4 4 c c , 0 x2 e 1 7 1 7 3 9
.word 0 x9 3 c4 c45 7 , 0 x55 a7 a7 f2 , 0 x f c7 e 7 e 8 2 , 0 x7 a3 d3 d47
.word 0 xc8 6 4 6 4 a c , 0 x b a5 d5 d e 7 , 0 x32 1 9 1 9 2 b , 0 x e 6 7 3 7 3 9 5
.word 0 xc0 6 0 6 0 a0 , 0 x19 8 1 8 1 9 8 , 0 x9 e 4 f4 f d1 , 0 x a3 d c d c7 f
.word 0 x4 4 2 2 2 2 6 6 , 0 x54 2 a2 a7 e , 0 x3 b90 9 0 a b , 0 x0 b88 8 8 8 3
.word 0 x8 c46 4 6 c a , 0 x c7 e e e e 2 9 , 0 x6 b b8 b8 d3 , 0 x28 1 4 1 4 3 c
.word 0 xa7 d e d e 7 9 , 0 x b c5 e 5 e e 2 , 0 x16 0 b0 b1 d , 0 x a d d b d b76
.word 0 xdbe0 e 0 3 b , 0 x64 3 2 3 2 5 6 , 0 x74 3 a3 a4 e , 0 x14 0 a0 a1 e
.word 0 x9 2 4 9 4 9 d b , 0 x0 c06 0 6 0 a , 0 x48 2 4 2 4 6 c , 0 x b85 c5 c e 4
.word 0 x9 f c2 c25 d , 0 x b d d3 d36 e , 0 x43 a c a c e f , 0 x c46 2 6 2 a6
.word 0 x3 9 9 1 9 1 a8 , 0 x31 9 5 9 5 a4 , 0 x d3 e 4 e 4 3 7 , 0 x f27 9 7 9 8 b
.word 0 xd5 e 7 e 7 3 2 , 0 x8 b c8 c84 3 , 0 x6 e 3 7 3 7 5 9 , 0 x d a6 d6 d b7
.word 0 x0 1 8 d8 d8 c , 0 x b1 d5 d56 4 , 0 x9 c4 e 4 e d2 , 0 x49 a9 a9 e 0
.word 0 xd8 6 c6 c b4 , 0 x a c56 5 6 f a , 0 x f3 f4 f40 7 , 0 x c f e a e a25
.word 0 xca6 5 6 5 a f , 0 x f47 a7 a8 e , 0 x47 a e a e e 9 , 0 x10 0 8 0 8 1 8
.word 0 x6 f b a b a d5 , 0 x f07 8 7 8 8 8 , 0 x4 a25 2 5 6 f , 0 x5 c2 e 2 e 7 2
.word 0 x3 8 1 c1 c24 , 0 x57 a6 a6 f1 , 0 x73 b4 b4 c7 , 0 x97 c6 c65 1
.word 0 xcbe8 e 8 2 3 , 0 x a1 d d d d7 c , 0 x e 8 7 4 7 4 9 c , 0 x3 e 1 f1 f21
.word 0 x9 6 4 b4 b d d , 0 x61 b d b d d c , 0 x0 d8 b8 b86 , 0 x0 f8 a8 a85
.word 0 xe0 7 0 7 0 9 0 , 0 x7 c3 e 3 e 4 2 , 0 x71 b5 b5 c4 , 0 x c c66 6 6 a a
.word 0 x9 0 4 8 4 8 d8 , 0 x06 0 3 0 3 0 5 , 0 x f7 f6 f60 1 , 0 x1 c0 e 0 e 1 2
.word 0 xc2 6 1 6 1 a3 , 0 x6 a35 3 5 5 f , 0 x a e 5 7 5 7 f9 , 0 x69 b9 b9 d0
.word 0 x1 7 8 6 8 6 9 1 , 0 x99 c1 c15 8 , 0 x3 a1 d1 d27 , 0 x27 9 e 9 e b9
.word 0 xd9 e 1 e 1 3 8 , 0 x e b f8 f81 3 , 0 x2 b98 9 8 b3 , 0 x22 1 1 1 1 3 3
.word 0 xd2 6 9 6 9 b b , 0 x a9 d9 d97 0 , 0 x07 8 e 8 e 8 9 , 0 x33 9 4 9 4 a7
.word 0 x2 d9 b9 b b6 , 0 x3 c1 e 1 e 2 2 , 0 x15 8 7 8 7 9 2 , 0 x c9 e 9 e 9 2 0
.word 0 x8 7 c e c e 4 9 , 0 x a a55 5 5 f f , 0 x50 2 8 2 8 7 8 , 0 x a5 d f d f7 a
.word 0 x0 3 8 c8 c8 f , 0 x59 a1 a1 f8 , 0 x09 8 9 8 9 8 0 , 0 x1 a0 d0 d17
.word 0 x6 5 b f b f d a , 0 x d7 e 6 e 6 3 1 , 0 x84 4 2 4 2 c6 , 0 x d06 8 6 8 b8
.word 0 x8 2 4 1 4 1 c3 , 0 x29 9 9 9 9 b0 , 0 x5 a2 d2 d77 , 0 x1 e 0 f0 f11
.word 0 x7 b b0 b0 c b , 0 x a85 4 5 4 f c , 0 x6 d b b b b d6 , 0 x2 c16 1 6 3 a
@ Te4[256]
.byte 0 x6 3 , 0 x7 c , 0 x77 , 0 x7 b , 0 x f2 , 0 x6 b , 0 x6 f , 0 x c5
.byte 0 x3 0 , 0 x01 , 0 x67 , 0 x2 b , 0 x f e , 0 x d7 , 0 x a b , 0 x76
.byte 0 xca, 0 x82 , 0 x c9 , 0 x7 d , 0 x f a , 0 x59 , 0 x47 , 0 x f0
.byte 0 xad, 0 x d4 , 0 x a2 , 0 x a f , 0 x9 c , 0 x a4 , 0 x72 , 0 x c0
.byte 0 xb7 , 0 x f d , 0 x93 , 0 x26 , 0 x36 , 0 x3 f , 0 x f7 , 0 x c c
.byte 0 x3 4 , 0 x a5 , 0 x e 5 , 0 x f1 , 0 x71 , 0 x d8 , 0 x31 , 0 x15
.byte 0 x0 4 , 0 x c7 , 0 x23 , 0 x c3 , 0 x18 , 0 x96 , 0 x05 , 0 x9 a
.byte 0 x0 7 , 0 x12 , 0 x80 , 0 x e 2 , 0 x e b , 0 x27 , 0 x b2 , 0 x75
.byte 0 x0 9 , 0 x83 , 0 x2 c , 0 x1 a , 0 x1 b , 0 x6 e , 0 x5 a , 0 x a0
.byte 0 x5 2 , 0 x3 b , 0 x d6 , 0 x b3 , 0 x29 , 0 x e 3 , 0 x2 f , 0 x84
.byte 0 x5 3 , 0 x d1 , 0 x00 , 0 x e d , 0 x20 , 0 x f c , 0 x b1 , 0 x5 b
.byte 0 x6 a , 0 x c b , 0 x b e , 0 x39 , 0 x4 a , 0 x4 c , 0 x58 , 0 x c f
.byte 0 xd0 , 0 x e f , 0 x a a , 0 x f b , 0 x43 , 0 x4 d , 0 x33 , 0 x85
.byte 0 x4 5 , 0 x f9 , 0 x02 , 0 x7 f , 0 x50 , 0 x3 c , 0 x9 f , 0 x a8
.byte 0 x5 1 , 0 x a3 , 0 x40 , 0 x8 f , 0 x92 , 0 x9 d , 0 x38 , 0 x f5
.byte 0 xbc, 0 x b6 , 0 x d a , 0 x21 , 0 x10 , 0 x f f , 0 x f3 , 0 x d2
.byte 0 xcd, 0 x0 c , 0 x13 , 0 x e c , 0 x5 f , 0 x97 , 0 x44 , 0 x17
.byte 0 xc4 , 0 x a7 , 0 x7 e , 0 x3 d , 0 x64 , 0 x5 d , 0 x19 , 0 x73
.byte 0 x6 0 , 0 x81 , 0 x4 f , 0 x d c , 0 x22 , 0 x2 a , 0 x90 , 0 x88
.byte 0 x4 6 , 0 x e e , 0 x b8 , 0 x14 , 0 x d e , 0 x5 e , 0 x0 b , 0 x d b
.byte 0 xe0 , 0 x32 , 0 x3 a , 0 x0 a , 0 x49 , 0 x06 , 0 x24 , 0 x5 c
.byte 0 xc2 , 0 x d3 , 0 x a c , 0 x62 , 0 x91 , 0 x95 , 0 x e 4 , 0 x79
.byte 0 xe7 , 0 x c8 , 0 x37 , 0 x6 d , 0 x8 d , 0 x d5 , 0 x4 e , 0 x a9
.byte 0 x6 c , 0 x56 , 0 x f4 , 0 x e a , 0 x65 , 0 x7 a , 0 x a e , 0 x08
.byte 0 xba, 0 x78 , 0 x25 , 0 x2 e , 0 x1 c , 0 x a6 , 0 x b4 , 0 x c6
.byte 0 xe8 , 0 x d d , 0 x74 , 0 x1 f , 0 x4 b , 0 x b d , 0 x8 b , 0 x8 a
.byte 0 x7 0 , 0 x3 e , 0 x b5 , 0 x66 , 0 x48 , 0 x03 , 0 x f6 , 0 x0 e
.byte 0 x6 1 , 0 x35 , 0 x57 , 0 x b9 , 0 x86 , 0 x c1 , 0 x1 d , 0 x9 e
.byte 0 xe1 , 0 x f8 , 0 x98 , 0 x11 , 0 x69 , 0 x d9 , 0 x8 e , 0 x94
.byte 0 x9 b , 0 x1 e , 0 x87 , 0 x e 9 , 0 x c e , 0 x55 , 0 x28 , 0 x d f
.byte 0 x8 c , 0 x a1 , 0 x89 , 0 x0 d , 0 x b f , 0 x e 6 , 0 x42 , 0 x68
.byte 0 x4 1 , 0 x99 , 0 x2 d , 0 x0 f , 0 x b0 , 0 x54 , 0 x b b , 0 x16
@ rcon[]
.word 0 x0 1 0 0 0 0 0 0 , 0 x02 0 0 0 0 0 0 , 0 x04 0 0 0 0 0 0 , 0 x08 0 0 0 0 0 0
.word 0 x1 0 0 0 0 0 0 0 , 0 x20 0 0 0 0 0 0 , 0 x40 0 0 0 0 0 0 , 0 x80 0 0 0 0 0 0
.word 0 x1 B 0 0 0 0 0 0 , 0 x36 0 0 0 0 0 0 , 0 , 0 , 0 , 0 , 0 , 0
.size AES_ T e ,. - A E S _ T e
@ void AES_encrypt(const unsigned char *in, unsigned char *out,
@ const AES_KEY *key) {
.align 5
2013-01-10 15:20:15 +04:00
ENTRY( A E S _ e n c r y p t )
2013-09-21 14:23:50 +04:00
adr r3 ,A E S _ e n c r y p t
2012-09-07 00:17:02 +04:00
stmdb s p ! ,{ r1 ,r4 - r12 ,l r }
mov r12 ,r0 @ inp
mov r11 ,r2
sub r10 ,r3 ,#A E S _ e n c r y p t - A E S _ T e @ T e
# if _ _ A R M _ A R C H _ _ < 7
ldrb r0 ,[ r12 ,#3 ] @ load input data in endian-neutral
ldrb r4 ,[ r12 ,#2 ] @ manner...
ldrb r5 ,[ r12 ,#1 ]
ldrb r6 ,[ r12 ,#0 ]
orr r0 ,r0 ,r4 ,l s l #8
ldrb r1 ,[ r12 ,#7 ]
orr r0 ,r0 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#6 ]
orr r0 ,r0 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#5 ]
ldrb r6 ,[ r12 ,#4 ]
orr r1 ,r1 ,r4 ,l s l #8
ldrb r2 ,[ r12 ,#11 ]
orr r1 ,r1 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#10 ]
orr r1 ,r1 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#9 ]
ldrb r6 ,[ r12 ,#8 ]
orr r2 ,r2 ,r4 ,l s l #8
ldrb r3 ,[ r12 ,#15 ]
orr r2 ,r2 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#14 ]
orr r2 ,r2 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#13 ]
ldrb r6 ,[ r12 ,#12 ]
orr r3 ,r3 ,r4 ,l s l #8
orr r3 ,r3 ,r5 ,l s l #16
orr r3 ,r3 ,r6 ,l s l #24
# else
ldr r0 ,[ r12 ,#0 ]
ldr r1 ,[ r12 ,#4 ]
ldr r2 ,[ r12 ,#8 ]
ldr r3 ,[ r12 ,#12 ]
# ifdef _ _ A R M E L _ _
rev r0 ,r0
rev r1 ,r1
rev r2 ,r2
rev r3 ,r3
# endif
# endif
bl _ a r m v4 _ A E S _ e n c r y p t
ldr r12 ,[ s p ] ,#4 @ pop out
# if _ _ A R M _ A R C H _ _ > =7
# ifdef _ _ A R M E L _ _
rev r0 ,r0
rev r1 ,r1
rev r2 ,r2
rev r3 ,r3
# endif
str r0 ,[ r12 ,#0 ]
str r1 ,[ r12 ,#4 ]
str r2 ,[ r12 ,#8 ]
str r3 ,[ r12 ,#12 ]
# else
mov r4 ,r0 ,l s r #24 @ write output in endian-neutral
mov r5 ,r0 ,l s r #16 @ manner...
mov r6 ,r0 ,l s r #8
strb r4 ,[ r12 ,#0 ]
strb r5 ,[ r12 ,#1 ]
mov r4 ,r1 ,l s r #24
strb r6 ,[ r12 ,#2 ]
mov r5 ,r1 ,l s r #16
strb r0 ,[ r12 ,#3 ]
mov r6 ,r1 ,l s r #8
strb r4 ,[ r12 ,#4 ]
strb r5 ,[ r12 ,#5 ]
mov r4 ,r2 ,l s r #24
strb r6 ,[ r12 ,#6 ]
mov r5 ,r2 ,l s r #16
strb r1 ,[ r12 ,#7 ]
mov r6 ,r2 ,l s r #8
strb r4 ,[ r12 ,#8 ]
strb r5 ,[ r12 ,#9 ]
mov r4 ,r3 ,l s r #24
strb r6 ,[ r12 ,#10 ]
mov r5 ,r3 ,l s r #16
strb r2 ,[ r12 ,#11 ]
mov r6 ,r3 ,l s r #8
strb r4 ,[ r12 ,#12 ]
strb r5 ,[ r12 ,#13 ]
strb r6 ,[ r12 ,#14 ]
strb r3 ,[ r12 ,#15 ]
# endif
ldmia s p ! ,{ r4 - r12 ,p c }
2013-01-10 15:20:15 +04:00
ENDPROC( A E S _ e n c r y p t )
2012-09-07 00:17:02 +04:00
.type _ armv4 _ A E S _ e n c r y p t ,% f u n c t i o n
.align 2
_armv4_AES_encrypt :
str l r ,[ s p ,#- 4 ] ! @ push lr
ldmia r11 ! ,{ r4 - r7 }
eor r0 ,r0 ,r4
ldr r12 ,[ r11 ,#240 - 1 6 ]
eor r1 ,r1 ,r5
eor r2 ,r2 ,r6
eor r3 ,r3 ,r7
sub r12 ,r12 ,#1
mov l r ,#255
and r7 ,l r ,r0
and r8 ,l r ,r0 ,l s r #8
and r9 ,l r ,r0 ,l s r #16
mov r0 ,r0 ,l s r #24
.Lenc_loop :
ldr r4 ,[ r10 ,r7 ,l s l #2 ] @ Te3[s0>>0]
and r7 ,l r ,r1 ,l s r #16 @ i0
ldr r5 ,[ r10 ,r8 ,l s l #2 ] @ Te2[s0>>8]
and r8 ,l r ,r1
ldr r6 ,[ r10 ,r9 ,l s l #2 ] @ Te1[s0>>16]
and r9 ,l r ,r1 ,l s r #8
ldr r0 ,[ r10 ,r0 ,l s l #2 ] @ Te0[s0>>24]
mov r1 ,r1 ,l s r #24
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Te1[s1>>16]
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Te3[s1>>0]
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Te2[s1>>8]
eor r0 ,r0 ,r7 ,r o r #8
ldr r1 ,[ r10 ,r1 ,l s l #2 ] @ Te0[s1>>24]
and r7 ,l r ,r2 ,l s r #8 @ i0
eor r5 ,r5 ,r8 ,r o r #8
and r8 ,l r ,r2 ,l s r #16 @ i1
eor r6 ,r6 ,r9 ,r o r #8
and r9 ,l r ,r2
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Te2[s2>>8]
eor r1 ,r1 ,r4 ,r o r #24
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Te1[s2>>16]
mov r2 ,r2 ,l s r #24
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Te3[s2>>0]
eor r0 ,r0 ,r7 ,r o r #16
ldr r2 ,[ r10 ,r2 ,l s l #2 ] @ Te0[s2>>24]
and r7 ,l r ,r3 @ i0
eor r1 ,r1 ,r8 ,r o r #8
and r8 ,l r ,r3 ,l s r #8 @ i1
eor r6 ,r6 ,r9 ,r o r #16
and r9 ,l r ,r3 ,l s r #16 @ i2
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Te3[s3>>0]
eor r2 ,r2 ,r5 ,r o r #16
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Te2[s3>>8]
mov r3 ,r3 ,l s r #24
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Te1[s3>>16]
eor r0 ,r0 ,r7 ,r o r #24
ldr r7 ,[ r11 ] ,#16
eor r1 ,r1 ,r8 ,r o r #16
ldr r3 ,[ r10 ,r3 ,l s l #2 ] @ Te0[s3>>24]
eor r2 ,r2 ,r9 ,r o r #8
ldr r4 ,[ r11 ,#- 12 ]
eor r3 ,r3 ,r6 ,r o r #8
ldr r5 ,[ r11 ,#- 8 ]
eor r0 ,r0 ,r7
ldr r6 ,[ r11 ,#- 4 ]
and r7 ,l r ,r0
eor r1 ,r1 ,r4
and r8 ,l r ,r0 ,l s r #8
eor r2 ,r2 ,r5
and r9 ,l r ,r0 ,l s r #16
eor r3 ,r3 ,r6
mov r0 ,r0 ,l s r #24
subs r12 ,r12 ,#1
bne . L e n c _ l o o p
add r10 ,r10 ,#2
ldrb r4 ,[ r10 ,r7 ,l s l #2 ] @ Te4[s0>>0]
and r7 ,l r ,r1 ,l s r #16 @ i0
ldrb r5 ,[ r10 ,r8 ,l s l #2 ] @ Te4[s0>>8]
and r8 ,l r ,r1
ldrb r6 ,[ r10 ,r9 ,l s l #2 ] @ Te4[s0>>16]
and r9 ,l r ,r1 ,l s r #8
ldrb r0 ,[ r10 ,r0 ,l s l #2 ] @ Te4[s0>>24]
mov r1 ,r1 ,l s r #24
ldrb r7 ,[ r10 ,r7 ,l s l #2 ] @ Te4[s1>>16]
ldrb r8 ,[ r10 ,r8 ,l s l #2 ] @ Te4[s1>>0]
ldrb r9 ,[ r10 ,r9 ,l s l #2 ] @ Te4[s1>>8]
eor r0 ,r7 ,r0 ,l s l #8
ldrb r1 ,[ r10 ,r1 ,l s l #2 ] @ Te4[s1>>24]
and r7 ,l r ,r2 ,l s r #8 @ i0
eor r5 ,r8 ,r5 ,l s l #8
and r8 ,l r ,r2 ,l s r #16 @ i1
eor r6 ,r9 ,r6 ,l s l #8
and r9 ,l r ,r2
ldrb r7 ,[ r10 ,r7 ,l s l #2 ] @ Te4[s2>>8]
eor r1 ,r4 ,r1 ,l s l #24
ldrb r8 ,[ r10 ,r8 ,l s l #2 ] @ Te4[s2>>16]
mov r2 ,r2 ,l s r #24
ldrb r9 ,[ r10 ,r9 ,l s l #2 ] @ Te4[s2>>0]
eor r0 ,r7 ,r0 ,l s l #8
ldrb r2 ,[ r10 ,r2 ,l s l #2 ] @ Te4[s2>>24]
and r7 ,l r ,r3 @ i0
eor r1 ,r1 ,r8 ,l s l #16
and r8 ,l r ,r3 ,l s r #8 @ i1
eor r6 ,r9 ,r6 ,l s l #8
and r9 ,l r ,r3 ,l s r #16 @ i2
ldrb r7 ,[ r10 ,r7 ,l s l #2 ] @ Te4[s3>>0]
eor r2 ,r5 ,r2 ,l s l #24
ldrb r8 ,[ r10 ,r8 ,l s l #2 ] @ Te4[s3>>8]
mov r3 ,r3 ,l s r #24
ldrb r9 ,[ r10 ,r9 ,l s l #2 ] @ Te4[s3>>16]
eor r0 ,r7 ,r0 ,l s l #8
ldr r7 ,[ r11 ,#0 ]
ldrb r3 ,[ r10 ,r3 ,l s l #2 ] @ Te4[s3>>24]
eor r1 ,r1 ,r8 ,l s l #8
ldr r4 ,[ r11 ,#4 ]
eor r2 ,r2 ,r9 ,l s l #16
ldr r5 ,[ r11 ,#8 ]
eor r3 ,r6 ,r3 ,l s l #24
ldr r6 ,[ r11 ,#12 ]
eor r0 ,r0 ,r7
eor r1 ,r1 ,r4
eor r2 ,r2 ,r5
eor r3 ,r3 ,r6
sub r10 ,r10 ,#2
ldr p c ,[ s p ] ,#4 @ pop and return
.size _ armv4 _ A E S _ e n c r y p t ,. - _ a r m v4 _ A E S _ e n c r y p t
.align 5
2013-01-10 15:20:15 +04:00
ENTRY( p r i v a t e _ A E S _ s e t _ e n c r y p t _ k e y )
2012-09-07 00:17:02 +04:00
_armv4_AES_set_encrypt_key :
2013-09-21 14:23:50 +04:00
adr r3 ,_ a r m v4 _ A E S _ s e t _ e n c r y p t _ k e y
2012-09-07 00:17:02 +04:00
teq r0 ,#0
moveq r0 ,#- 1
beq . L a b r t
teq r2 ,#0
moveq r0 ,#- 1
beq . L a b r t
teq r1 ,#128
beq . L o k
teq r1 ,#192
beq . L o k
teq r1 ,#256
movne r0 ,#- 1
bne . L a b r t
.Lok : stmdb s p ! ,{ r4 - r12 ,l r }
sub r10 ,r3 ,#_ a r m v 4 _ A E S _ s e t _ e n c r y p t _ k e y - A E S _ T e - 1 0 2 4 @ Te4
mov r12 ,r0 @ inp
mov l r ,r1 @ bits
mov r11 ,r2 @ key
# if _ _ A R M _ A R C H _ _ < 7
ldrb r0 ,[ r12 ,#3 ] @ load input data in endian-neutral
ldrb r4 ,[ r12 ,#2 ] @ manner...
ldrb r5 ,[ r12 ,#1 ]
ldrb r6 ,[ r12 ,#0 ]
orr r0 ,r0 ,r4 ,l s l #8
ldrb r1 ,[ r12 ,#7 ]
orr r0 ,r0 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#6 ]
orr r0 ,r0 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#5 ]
ldrb r6 ,[ r12 ,#4 ]
orr r1 ,r1 ,r4 ,l s l #8
ldrb r2 ,[ r12 ,#11 ]
orr r1 ,r1 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#10 ]
orr r1 ,r1 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#9 ]
ldrb r6 ,[ r12 ,#8 ]
orr r2 ,r2 ,r4 ,l s l #8
ldrb r3 ,[ r12 ,#15 ]
orr r2 ,r2 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#14 ]
orr r2 ,r2 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#13 ]
ldrb r6 ,[ r12 ,#12 ]
orr r3 ,r3 ,r4 ,l s l #8
str r0 ,[ r11 ] ,#16
orr r3 ,r3 ,r5 ,l s l #16
str r1 ,[ r11 ,#- 12 ]
orr r3 ,r3 ,r6 ,l s l #24
str r2 ,[ r11 ,#- 8 ]
str r3 ,[ r11 ,#- 4 ]
# else
ldr r0 ,[ r12 ,#0 ]
ldr r1 ,[ r12 ,#4 ]
ldr r2 ,[ r12 ,#8 ]
ldr r3 ,[ r12 ,#12 ]
# ifdef _ _ A R M E L _ _
rev r0 ,r0
rev r1 ,r1
rev r2 ,r2
rev r3 ,r3
# endif
str r0 ,[ r11 ] ,#16
str r1 ,[ r11 ,#- 12 ]
str r2 ,[ r11 ,#- 8 ]
str r3 ,[ r11 ,#- 4 ]
# endif
teq l r ,#128
bne . L n o t 1 2 8
mov r12 ,#10
str r12 ,[ r11 ,#240 - 1 6 ]
add r6 ,r10 ,#256 @ rcon
mov l r ,#255
.L128_loop :
and r5 ,l r ,r3 ,l s r #24
and r7 ,l r ,r3 ,l s r #16
ldrb r5 ,[ r10 ,r5 ]
and r8 ,l r ,r3 ,l s r #8
ldrb r7 ,[ r10 ,r7 ]
and r9 ,l r ,r3
ldrb r8 ,[ r10 ,r8 ]
orr r5 ,r5 ,r7 ,l s l #24
ldrb r9 ,[ r10 ,r9 ]
orr r5 ,r5 ,r8 ,l s l #16
ldr r4 ,[ r6 ] ,#4 @ rcon[i++]
orr r5 ,r5 ,r9 ,l s l #8
eor r5 ,r5 ,r4
eor r0 ,r0 ,r5 @ rk[4]=rk[0]^...
eor r1 ,r1 ,r0 @ rk[5]=rk[1]^rk[4]
str r0 ,[ r11 ] ,#16
eor r2 ,r2 ,r1 @ rk[6]=rk[2]^rk[5]
str r1 ,[ r11 ,#- 12 ]
eor r3 ,r3 ,r2 @ rk[7]=rk[3]^rk[6]
str r2 ,[ r11 ,#- 8 ]
subs r12 ,r12 ,#1
str r3 ,[ r11 ,#- 4 ]
bne . L 1 2 8 _ l o o p
sub r2 ,r11 ,#176
b . L d o n e
.Lnot128 :
# if _ _ A R M _ A R C H _ _ < 7
ldrb r8 ,[ r12 ,#19 ]
ldrb r4 ,[ r12 ,#18 ]
ldrb r5 ,[ r12 ,#17 ]
ldrb r6 ,[ r12 ,#16 ]
orr r8 ,r8 ,r4 ,l s l #8
ldrb r9 ,[ r12 ,#23 ]
orr r8 ,r8 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#22 ]
orr r8 ,r8 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#21 ]
ldrb r6 ,[ r12 ,#20 ]
orr r9 ,r9 ,r4 ,l s l #8
orr r9 ,r9 ,r5 ,l s l #16
str r8 ,[ r11 ] ,#8
orr r9 ,r9 ,r6 ,l s l #24
str r9 ,[ r11 ,#- 4 ]
# else
ldr r8 ,[ r12 ,#16 ]
ldr r9 ,[ r12 ,#20 ]
# ifdef _ _ A R M E L _ _
rev r8 ,r8
rev r9 ,r9
# endif
str r8 ,[ r11 ] ,#8
str r9 ,[ r11 ,#- 4 ]
# endif
teq l r ,#192
bne . L n o t 1 9 2
mov r12 ,#12
str r12 ,[ r11 ,#240 - 2 4 ]
add r6 ,r10 ,#256 @ rcon
mov l r ,#255
mov r12 ,#8
.L192_loop :
and r5 ,l r ,r9 ,l s r #24
and r7 ,l r ,r9 ,l s r #16
ldrb r5 ,[ r10 ,r5 ]
and r8 ,l r ,r9 ,l s r #8
ldrb r7 ,[ r10 ,r7 ]
and r9 ,l r ,r9
ldrb r8 ,[ r10 ,r8 ]
orr r5 ,r5 ,r7 ,l s l #24
ldrb r9 ,[ r10 ,r9 ]
orr r5 ,r5 ,r8 ,l s l #16
ldr r4 ,[ r6 ] ,#4 @ rcon[i++]
orr r5 ,r5 ,r9 ,l s l #8
eor r9 ,r5 ,r4
eor r0 ,r0 ,r9 @ rk[6]=rk[0]^...
eor r1 ,r1 ,r0 @ rk[7]=rk[1]^rk[6]
str r0 ,[ r11 ] ,#24
eor r2 ,r2 ,r1 @ rk[8]=rk[2]^rk[7]
str r1 ,[ r11 ,#- 20 ]
eor r3 ,r3 ,r2 @ rk[9]=rk[3]^rk[8]
str r2 ,[ r11 ,#- 16 ]
subs r12 ,r12 ,#1
str r3 ,[ r11 ,#- 12 ]
subeq r2 ,r11 ,#216
beq . L d o n e
ldr r7 ,[ r11 ,#- 32 ]
ldr r8 ,[ r11 ,#- 28 ]
eor r7 ,r7 ,r3 @ rk[10]=rk[4]^rk[9]
eor r9 ,r8 ,r7 @ rk[11]=rk[5]^rk[10]
str r7 ,[ r11 ,#- 8 ]
str r9 ,[ r11 ,#- 4 ]
b . L 1 9 2 _ l o o p
.Lnot192 :
# if _ _ A R M _ A R C H _ _ < 7
ldrb r8 ,[ r12 ,#27 ]
ldrb r4 ,[ r12 ,#26 ]
ldrb r5 ,[ r12 ,#25 ]
ldrb r6 ,[ r12 ,#24 ]
orr r8 ,r8 ,r4 ,l s l #8
ldrb r9 ,[ r12 ,#31 ]
orr r8 ,r8 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#30 ]
orr r8 ,r8 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#29 ]
ldrb r6 ,[ r12 ,#28 ]
orr r9 ,r9 ,r4 ,l s l #8
orr r9 ,r9 ,r5 ,l s l #16
str r8 ,[ r11 ] ,#8
orr r9 ,r9 ,r6 ,l s l #24
str r9 ,[ r11 ,#- 4 ]
# else
ldr r8 ,[ r12 ,#24 ]
ldr r9 ,[ r12 ,#28 ]
# ifdef _ _ A R M E L _ _
rev r8 ,r8
rev r9 ,r9
# endif
str r8 ,[ r11 ] ,#8
str r9 ,[ r11 ,#- 4 ]
# endif
mov r12 ,#14
str r12 ,[ r11 ,#240 - 3 2 ]
add r6 ,r10 ,#256 @ rcon
mov l r ,#255
mov r12 ,#7
.L256_loop :
and r5 ,l r ,r9 ,l s r #24
and r7 ,l r ,r9 ,l s r #16
ldrb r5 ,[ r10 ,r5 ]
and r8 ,l r ,r9 ,l s r #8
ldrb r7 ,[ r10 ,r7 ]
and r9 ,l r ,r9
ldrb r8 ,[ r10 ,r8 ]
orr r5 ,r5 ,r7 ,l s l #24
ldrb r9 ,[ r10 ,r9 ]
orr r5 ,r5 ,r8 ,l s l #16
ldr r4 ,[ r6 ] ,#4 @ rcon[i++]
orr r5 ,r5 ,r9 ,l s l #8
eor r9 ,r5 ,r4
eor r0 ,r0 ,r9 @ rk[8]=rk[0]^...
eor r1 ,r1 ,r0 @ rk[9]=rk[1]^rk[8]
str r0 ,[ r11 ] ,#32
eor r2 ,r2 ,r1 @ rk[10]=rk[2]^rk[9]
str r1 ,[ r11 ,#- 28 ]
eor r3 ,r3 ,r2 @ rk[11]=rk[3]^rk[10]
str r2 ,[ r11 ,#- 24 ]
subs r12 ,r12 ,#1
str r3 ,[ r11 ,#- 20 ]
subeq r2 ,r11 ,#256
beq . L d o n e
and r5 ,l r ,r3
and r7 ,l r ,r3 ,l s r #8
ldrb r5 ,[ r10 ,r5 ]
and r8 ,l r ,r3 ,l s r #16
ldrb r7 ,[ r10 ,r7 ]
and r9 ,l r ,r3 ,l s r #24
ldrb r8 ,[ r10 ,r8 ]
orr r5 ,r5 ,r7 ,l s l #8
ldrb r9 ,[ r10 ,r9 ]
orr r5 ,r5 ,r8 ,l s l #16
ldr r4 ,[ r11 ,#- 48 ]
orr r5 ,r5 ,r9 ,l s l #24
ldr r7 ,[ r11 ,#- 44 ]
ldr r8 ,[ r11 ,#- 40 ]
eor r4 ,r4 ,r5 @ rk[12]=rk[4]^...
ldr r9 ,[ r11 ,#- 36 ]
eor r7 ,r7 ,r4 @ rk[13]=rk[5]^rk[12]
str r4 ,[ r11 ,#- 16 ]
eor r8 ,r8 ,r7 @ rk[14]=rk[6]^rk[13]
str r7 ,[ r11 ,#- 12 ]
eor r9 ,r9 ,r8 @ rk[15]=rk[7]^rk[14]
str r8 ,[ r11 ,#- 8 ]
str r9 ,[ r11 ,#- 4 ]
b . L 2 5 6 _ l o o p
.Ldone : mov r0 ,#0
ldmia s p ! ,{ r4 - r12 ,l r }
2014-06-30 19:29:12 +04:00
.Labrt : ret l r
2013-01-10 15:20:15 +04:00
ENDPROC( p r i v a t e _ A E S _ s e t _ e n c r y p t _ k e y )
2012-09-07 00:17:02 +04:00
.align 5
2013-01-10 15:20:15 +04:00
ENTRY( p r i v a t e _ A E S _ s e t _ d e c r y p t _ k e y )
2012-09-07 00:17:02 +04:00
str l r ,[ s p ,#- 4 ] ! @ push lr
# if 0
@ kernel does both of these in setkey so optimise this bit out by
@ expecting the key to already have the enc_key work done (see aes_glue.c)
bl _ a r m v4 _ A E S _ s e t _ e n c r y p t _ k e y
# else
mov r0 ,#0
# endif
teq r0 ,#0
ldrne l r ,[ s p ] ,#4 @ pop lr
bne . L a b r t
stmdb s p ! ,{ r4 - r12 }
ldr r12 ,[ r2 ,#240 ] @ AES_set_encrypt_key preserves r2,
mov r11 ,r2 @ which is AES_KEY *key
mov r7 ,r2
add r8 ,r2 ,r12 ,l s l #4
.Linv : ldr r0 ,[ r7 ]
ldr r1 ,[ r7 ,#4 ]
ldr r2 ,[ r7 ,#8 ]
ldr r3 ,[ r7 ,#12 ]
ldr r4 ,[ r8 ]
ldr r5 ,[ r8 ,#4 ]
ldr r6 ,[ r8 ,#8 ]
ldr r9 ,[ r8 ,#12 ]
str r0 ,[ r8 ] ,#- 16
str r1 ,[ r8 ,#16 + 4 ]
str r2 ,[ r8 ,#16 + 8 ]
str r3 ,[ r8 ,#16 + 1 2 ]
str r4 ,[ r7 ] ,#16
str r5 ,[ r7 ,#- 12 ]
str r6 ,[ r7 ,#- 8 ]
str r9 ,[ r7 ,#- 4 ]
teq r7 ,r8
bne . L i n v
ldr r0 ,[ r11 ,#16 ] ! @ prefetch tp1
mov r7 ,#0x80
mov r8 ,#0x1b
orr r7 ,r7 ,#0x8000
orr r8 ,r8 ,#0x1b00
orr r7 ,r7 ,r7 ,l s l #16
orr r8 ,r8 ,r8 ,l s l #16
sub r12 ,r12 ,#1
mvn r9 ,r7
mov r12 ,r12 ,l s l #2 @ (rounds-1)*4
.Lmix : and r4 ,r0 ,r7
and r1 ,r0 ,r9
sub r4 ,r4 ,r4 ,l s r #7
and r4 ,r4 ,r8
eor r1 ,r4 ,r1 ,l s l #1 @ tp2
and r4 ,r1 ,r7
and r2 ,r1 ,r9
sub r4 ,r4 ,r4 ,l s r #7
and r4 ,r4 ,r8
eor r2 ,r4 ,r2 ,l s l #1 @ tp4
and r4 ,r2 ,r7
and r3 ,r2 ,r9
sub r4 ,r4 ,r4 ,l s r #7
and r4 ,r4 ,r8
eor r3 ,r4 ,r3 ,l s l #1 @ tp8
eor r4 ,r1 ,r2
eor r5 ,r0 ,r3 @ tp9
eor r4 ,r4 ,r3 @ tpe
eor r4 ,r4 ,r1 ,r o r #24
eor r4 ,r4 ,r5 ,r o r #24 @ ^= ROTATE(tpb=tp9^tp2,8)
eor r4 ,r4 ,r2 ,r o r #16
eor r4 ,r4 ,r5 ,r o r #16 @ ^= ROTATE(tpd=tp9^tp4,16)
eor r4 ,r4 ,r5 ,r o r #8 @ ^= ROTATE(tp9,24)
ldr r0 ,[ r11 ,#4 ] @ prefetch tp1
str r4 ,[ r11 ] ,#4
subs r12 ,r12 ,#1
bne . L m i x
mov r0 ,#0
ldmia s p ! ,{ r4 - r12 ,p c }
2013-01-10 15:20:15 +04:00
ENDPROC( p r i v a t e _ A E S _ s e t _ d e c r y p t _ k e y )
2012-09-07 00:17:02 +04:00
.type AES_ T d ,% o b j e c t
.align 5
AES_Td :
.word 0 x5 1 f4 a75 0 , 0 x7 e 4 1 6 5 5 3 , 0 x1 a17 a4 c3 , 0 x3 a27 5 e 9 6
.word 0 x3 b a b6 b c b , 0 x1 f9 d45 f1 , 0 x a c f a58 a b , 0 x4 b e 3 0 3 9 3
.word 0 x2 0 3 0 f a55 , 0 x a d76 6 d f6 , 0 x88 c c76 9 1 , 0 x f50 2 4 c25
.word 0 x4 f e 5 d7 f c , 0 x c52 a c b d7 , 0 x26 3 5 4 4 8 0 , 0 x b56 2 a38 f
.word 0 xdeb1 5 a49 , 0 x25 b a1 b67 , 0 x45 e a0 e 9 8 , 0 x5 d f e c0 e 1
.word 0 xc3 2 f75 0 2 , 0 x81 4 c f01 2 , 0 x8 d46 9 7 a3 , 0 x6 b d3 f9 c6
.word 0 x0 3 8 f5 f e 7 , 0 x15 9 2 9 c95 , 0 x b f6 d7 a e b , 0 x95 5 2 5 9 d a
.word 0 xd4 b e 8 3 2 d , 0 x58 7 4 2 1 d3 , 0 x49 e 0 6 9 2 9 , 0 x8 e c9 c84 4
.word 0 x7 5 c28 9 6 a , 0 x f48 e 7 9 7 8 , 0 x99 5 8 3 e 6 b , 0 x27 b97 1 d d
.word 0 xbee1 4 f b6 , 0 x f08 8 a d17 , 0 x c92 0 a c66 , 0 x7 d c e 3 a b4
.word 0 x6 3 d f4 a18 , 0 x e 5 1 a31 8 2 , 0 x97 5 1 3 3 6 0 , 0 x62 5 3 7 f45
.word 0 xb1 6 4 7 7 e 0 , 0 x b b6 b a e 8 4 , 0 x f e 8 1 a01 c , 0 x f90 8 2 b94
.word 0 x7 0 4 8 6 8 5 8 , 0 x8 f45 f d19 , 0 x94 d e 6 c87 , 0 x52 7 b f8 b7
.word 0 xab7 3 d32 3 , 0 x72 4 b02 e 2 , 0 x e 3 1 f8 f57 , 0 x66 5 5 a b2 a
.word 0 xb2 e b28 0 7 , 0 x2 f b5 c20 3 , 0 x86 c57 b9 a , 0 x d33 7 0 8 a5
.word 0 x3 0 2 8 8 7 f2 , 0 x23 b f a5 b2 , 0 x02 0 3 6 a b a , 0 x e d16 8 2 5 c
.word 0 x8 a c f1 c2 b , 0 x a77 9 b49 2 , 0 x f30 7 f2 f0 , 0 x4 e 6 9 e 2 a1
.word 0 x6 5 d a f4 c d , 0 x06 0 5 b e d5 , 0 x d13 4 6 2 1 f , 0 x c4 a6 f e 8 a
.word 0 x3 4 2 e 5 3 9 d , 0 x a2 f35 5 a0 , 0 x05 8 a e 1 3 2 , 0 x a4 f6 e b75
.word 0 x0 b83 e c39 , 0 x40 6 0 e f a a , 0 x5 e 7 1 9 f06 , 0 x b d6 e 1 0 5 1
.word 0 x3 e 2 1 8 a f9 , 0 x96 d d06 3 d , 0 x d d3 e 0 5 a e , 0 x4 d e 6 b d46
.word 0 x9 1 5 4 8 d b5 , 0 x71 c45 d05 , 0 x04 0 6 d46 f , 0 x60 5 0 1 5 f f
.word 0 x1 9 9 8 f b24 , 0 x d6 b d e 9 9 7 , 0 x89 4 0 4 3 c c , 0 x67 d99 e 7 7
.word 0 xb0 e 8 4 2 b d , 0 x07 8 9 8 b88 , 0 x e 7 1 9 5 b38 , 0 x79 c8 e e d b
.word 0 xa1 7 c0 a47 , 0 x7 c42 0 f e 9 , 0 x f88 4 1 e c9 , 0 x00 0 0 0 0 0 0
.word 0 x0 9 8 0 8 6 8 3 , 0 x32 2 b e d48 , 0 x1 e 1 1 7 0 a c , 0 x6 c5 a72 4 e
.word 0 xfd0 e f f f b , 0 x0 f85 3 8 5 6 , 0 x3 d a e d51 e , 0 x36 2 d39 2 7
.word 0 x0 a0 f d96 4 , 0 x68 5 c a62 1 , 0 x9 b5 b54 d1 , 0 x24 3 6 2 e 3 a
.word 0 x0 c0 a67 b1 , 0 x93 5 7 e 7 0 f , 0 x b4 e e 9 6 d2 , 0 x1 b9 b91 9 e
.word 0 x8 0 c0 c54 f , 0 x61 d c20 a2 , 0 x5 a77 4 b69 , 0 x1 c12 1 a16
.word 0 xe2 9 3 b a0 a , 0 x c0 a02 a e 5 , 0 x3 c22 e 0 4 3 , 0 x12 1 b17 1 d
.word 0 x0 e 0 9 0 d0 b , 0 x f28 b c7 a d , 0 x2 d b6 a8 b9 , 0 x14 1 e a9 c8
.word 0 x5 7 f11 9 8 5 , 0 x a f75 0 7 4 c , 0 x e e 9 9 d d b b , 0 x a37 f60 f d
.word 0 xf7 0 1 2 6 9 f , 0 x5 c72 f5 b c , 0 x44 6 6 3 b c5 , 0 x5 b f b7 e 3 4
.word 0 x8 b43 2 9 7 6 , 0 x c b23 c6 d c , 0 x b6 e d f c68 , 0 x b8 e 4 f16 3
.word 0 xd7 3 1 d c c a , 0 x42 6 3 8 5 1 0 , 0 x13 9 7 2 2 4 0 , 0 x84 c61 1 2 0
.word 0 x8 5 4 a24 7 d , 0 x d2 b b3 d f8 , 0 x a e f93 2 1 1 , 0 x c72 9 a16 d
.word 0 x1 d9 e 2 f4 b , 0 x d c b23 0 f3 , 0 x0 d86 5 2 e c , 0 x77 c1 e 3 d0
.word 0 x2 b b31 6 6 c , 0 x a97 0 b99 9 , 0 x11 9 4 4 8 f a , 0 x47 e 9 6 4 2 2
.word 0 xa8 f c8 c c4 , 0 x a0 f03 f1 a , 0 x56 7 d2 c d8 , 0 x22 3 3 9 0 e f
.word 0 x8 7 4 9 4 e c7 , 0 x d93 8 d1 c1 , 0 x8 c c a a2 f e , 0 x98 d40 b36
.word 0 xa6 f58 1 c f , 0 x a57 a d e 2 8 , 0 x d a b78 e 2 6 , 0 x3 f a d b f a4
.word 0 x2 c3 a9 d e 4 , 0 x50 7 8 9 2 0 d , 0 x6 a5 f c c9 b , 0 x54 7 e 4 6 6 2
.word 0 xf6 8 d13 c2 , 0 x90 d8 b8 e 8 , 0 x2 e 3 9 f75 e , 0 x82 c3 a f f5
.word 0 x9 f5 d80 b e , 0 x69 d09 3 7 c , 0 x6 f d52 d a9 , 0 x c f25 1 2 b3
.word 0 xc8 a c99 3 b , 0 x10 1 8 7 d a7 , 0 x e 8 9 c63 6 e , 0 x d b3 b b b7 b
.word 0 xcd2 6 7 8 0 9 , 0 x6 e 5 9 1 8 f4 , 0 x e c9 a b70 1 , 0 x83 4 f9 a a8
.word 0 xe6 9 5 6 e 6 5 , 0 x a a f f e 6 7 e , 0 x21 b c c f08 , 0 x e f15 e 8 e 6
.word 0 xbae7 9 b d9 , 0 x4 a6 f36 c e , 0 x e a9 f09 d4 , 0 x29 b07 c d6
.word 0 x3 1 a4 b2 a f , 0 x2 a3 f23 3 1 , 0 x c6 a59 4 3 0 , 0 x35 a26 6 c0
.word 0 x7 4 4 e b c37 , 0 x f c82 c a a6 , 0 x e 0 9 0 d0 b0 , 0 x33 a7 d81 5
.word 0 xf1 0 4 9 8 4 a , 0 x41 e c d a f7 , 0 x7 f c d50 0 e , 0 x17 9 1 f62 f
.word 0 x7 6 4 d d68 d , 0 x43 e f b04 d , 0 x c c a a4 d54 , 0 x e 4 9 6 0 4 d f
.word 0 x9 e d1 b5 e 3 , 0 x4 c6 a88 1 b , 0 x c12 c1 f b8 , 0 x46 6 5 5 1 7 f
.word 0 x9 d5 e e a04 , 0 x01 8 c35 5 d , 0 x f a87 7 4 7 3 , 0 x f b0 b41 2 e
.word 0 xb3 6 7 1 d5 a , 0 x92 d b d25 2 , 0 x e 9 1 0 5 6 3 3 , 0 x6 d d64 7 1 3
.word 0 x9 a d76 1 8 c , 0 x37 a10 c7 a , 0 x59 f81 4 8 e , 0 x e b13 3 c89
.word 0 xcea9 2 7 e e , 0 x b76 1 c93 5 , 0 x e 1 1 c e 5 e d , 0 x7 a47 b13 c
.word 0 x9 c d2 d f59 , 0 x55 f27 3 3 f , 0 x18 1 4 c e 7 9 , 0 x73 c73 7 b f
.word 0 x5 3 f7 c d e a , 0 x5 f f d a a5 b , 0 x d f3 d6 f14 , 0 x78 4 4 d b86
.word 0 xcaaff3 8 1 , 0 x b96 8 c43 e , 0 x38 2 4 3 4 2 c , 0 x c2 a34 0 5 f
.word 0 x1 6 1 d c37 2 , 0 x b c e 2 2 5 0 c , 0 x28 3 c49 8 b , 0 x f f0 d95 4 1
.word 0 x3 9 a80 1 7 1 , 0 x08 0 c b3 d e , 0 x d8 b4 e 4 9 c , 0 x64 5 6 c19 0
.word 0 x7 b c b84 6 1 , 0 x d53 2 b67 0 , 0 x48 6 c5 c74 , 0 x d0 b85 7 4 2
@ Td4[256]
.byte 0 x5 2 , 0 x09 , 0 x6 a , 0 x d5 , 0 x30 , 0 x36 , 0 x a5 , 0 x38
.byte 0 xbf, 0 x40 , 0 x a3 , 0 x9 e , 0 x81 , 0 x f3 , 0 x d7 , 0 x f b
.byte 0 x7 c , 0 x e 3 , 0 x39 , 0 x82 , 0 x9 b , 0 x2 f , 0 x f f , 0 x87
.byte 0 x3 4 , 0 x8 e , 0 x43 , 0 x44 , 0 x c4 , 0 x d e , 0 x e 9 , 0 x c b
.byte 0 x5 4 , 0 x7 b , 0 x94 , 0 x32 , 0 x a6 , 0 x c2 , 0 x23 , 0 x3 d
.byte 0 xee, 0 x4 c , 0 x95 , 0 x0 b , 0 x42 , 0 x f a , 0 x c3 , 0 x4 e
.byte 0 x0 8 , 0 x2 e , 0 x a1 , 0 x66 , 0 x28 , 0 x d9 , 0 x24 , 0 x b2
.byte 0 x7 6 , 0 x5 b , 0 x a2 , 0 x49 , 0 x6 d , 0 x8 b , 0 x d1 , 0 x25
.byte 0 x7 2 , 0 x f8 , 0 x f6 , 0 x64 , 0 x86 , 0 x68 , 0 x98 , 0 x16
.byte 0 xd4 , 0 x a4 , 0 x5 c , 0 x c c , 0 x5 d , 0 x65 , 0 x b6 , 0 x92
.byte 0 x6 c , 0 x70 , 0 x48 , 0 x50 , 0 x f d , 0 x e d , 0 x b9 , 0 x d a
.byte 0 x5 e , 0 x15 , 0 x46 , 0 x57 , 0 x a7 , 0 x8 d , 0 x9 d , 0 x84
.byte 0 x9 0 , 0 x d8 , 0 x a b , 0 x00 , 0 x8 c , 0 x b c , 0 x d3 , 0 x0 a
.byte 0 xf7 , 0 x e 4 , 0 x58 , 0 x05 , 0 x b8 , 0 x b3 , 0 x45 , 0 x06
.byte 0 xd0 , 0 x2 c , 0 x1 e , 0 x8 f , 0 x c a , 0 x3 f , 0 x0 f , 0 x02
.byte 0 xc1 , 0 x a f , 0 x b d , 0 x03 , 0 x01 , 0 x13 , 0 x8 a , 0 x6 b
.byte 0 x3 a , 0 x91 , 0 x11 , 0 x41 , 0 x4 f , 0 x67 , 0 x d c , 0 x e a
.byte 0 x9 7 , 0 x f2 , 0 x c f , 0 x c e , 0 x f0 , 0 x b4 , 0 x e 6 , 0 x73
.byte 0 x9 6 , 0 x a c , 0 x74 , 0 x22 , 0 x e 7 , 0 x a d , 0 x35 , 0 x85
.byte 0 xe2 , 0 x f9 , 0 x37 , 0 x e 8 , 0 x1 c , 0 x75 , 0 x d f , 0 x6 e
.byte 0 x4 7 , 0 x f1 , 0 x1 a , 0 x71 , 0 x1 d , 0 x29 , 0 x c5 , 0 x89
.byte 0 x6 f , 0 x b7 , 0 x62 , 0 x0 e , 0 x a a , 0 x18 , 0 x b e , 0 x1 b
.byte 0 xfc, 0 x56 , 0 x3 e , 0 x4 b , 0 x c6 , 0 x d2 , 0 x79 , 0 x20
.byte 0 x9 a , 0 x d b , 0 x c0 , 0 x f e , 0 x78 , 0 x c d , 0 x5 a , 0 x f4
.byte 0 x1 f , 0 x d d , 0 x a8 , 0 x33 , 0 x88 , 0 x07 , 0 x c7 , 0 x31
.byte 0 xb1 , 0 x12 , 0 x10 , 0 x59 , 0 x27 , 0 x80 , 0 x e c , 0 x5 f
.byte 0 x6 0 , 0 x51 , 0 x7 f , 0 x a9 , 0 x19 , 0 x b5 , 0 x4 a , 0 x0 d
.byte 0 x2 d , 0 x e 5 , 0 x7 a , 0 x9 f , 0 x93 , 0 x c9 , 0 x9 c , 0 x e f
.byte 0 xa0 , 0 x e 0 , 0 x3 b , 0 x4 d , 0 x a e , 0 x2 a , 0 x f5 , 0 x b0
.byte 0 xc8 , 0 x e b , 0 x b b , 0 x3 c , 0 x83 , 0 x53 , 0 x99 , 0 x61
.byte 0 x1 7 , 0 x2 b , 0 x04 , 0 x7 e , 0 x b a , 0 x77 , 0 x d6 , 0 x26
.byte 0 xe1 , 0 x69 , 0 x14 , 0 x63 , 0 x55 , 0 x21 , 0 x0 c , 0 x7 d
.size AES_ T d ,. - A E S _ T d
@ void AES_decrypt(const unsigned char *in, unsigned char *out,
@ const AES_KEY *key) {
.align 5
2013-01-10 15:20:15 +04:00
ENTRY( A E S _ d e c r y p t )
2013-09-21 14:23:50 +04:00
adr r3 ,A E S _ d e c r y p t
2012-09-07 00:17:02 +04:00
stmdb s p ! ,{ r1 ,r4 - r12 ,l r }
mov r12 ,r0 @ inp
mov r11 ,r2
sub r10 ,r3 ,#A E S _ d e c r y p t - A E S _ T d @ T d
# if _ _ A R M _ A R C H _ _ < 7
ldrb r0 ,[ r12 ,#3 ] @ load input data in endian-neutral
ldrb r4 ,[ r12 ,#2 ] @ manner...
ldrb r5 ,[ r12 ,#1 ]
ldrb r6 ,[ r12 ,#0 ]
orr r0 ,r0 ,r4 ,l s l #8
ldrb r1 ,[ r12 ,#7 ]
orr r0 ,r0 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#6 ]
orr r0 ,r0 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#5 ]
ldrb r6 ,[ r12 ,#4 ]
orr r1 ,r1 ,r4 ,l s l #8
ldrb r2 ,[ r12 ,#11 ]
orr r1 ,r1 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#10 ]
orr r1 ,r1 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#9 ]
ldrb r6 ,[ r12 ,#8 ]
orr r2 ,r2 ,r4 ,l s l #8
ldrb r3 ,[ r12 ,#15 ]
orr r2 ,r2 ,r5 ,l s l #16
ldrb r4 ,[ r12 ,#14 ]
orr r2 ,r2 ,r6 ,l s l #24
ldrb r5 ,[ r12 ,#13 ]
ldrb r6 ,[ r12 ,#12 ]
orr r3 ,r3 ,r4 ,l s l #8
orr r3 ,r3 ,r5 ,l s l #16
orr r3 ,r3 ,r6 ,l s l #24
# else
ldr r0 ,[ r12 ,#0 ]
ldr r1 ,[ r12 ,#4 ]
ldr r2 ,[ r12 ,#8 ]
ldr r3 ,[ r12 ,#12 ]
# ifdef _ _ A R M E L _ _
rev r0 ,r0
rev r1 ,r1
rev r2 ,r2
rev r3 ,r3
# endif
# endif
bl _ a r m v4 _ A E S _ d e c r y p t
ldr r12 ,[ s p ] ,#4 @ pop out
# if _ _ A R M _ A R C H _ _ > =7
# ifdef _ _ A R M E L _ _
rev r0 ,r0
rev r1 ,r1
rev r2 ,r2
rev r3 ,r3
# endif
str r0 ,[ r12 ,#0 ]
str r1 ,[ r12 ,#4 ]
str r2 ,[ r12 ,#8 ]
str r3 ,[ r12 ,#12 ]
# else
mov r4 ,r0 ,l s r #24 @ write output in endian-neutral
mov r5 ,r0 ,l s r #16 @ manner...
mov r6 ,r0 ,l s r #8
strb r4 ,[ r12 ,#0 ]
strb r5 ,[ r12 ,#1 ]
mov r4 ,r1 ,l s r #24
strb r6 ,[ r12 ,#2 ]
mov r5 ,r1 ,l s r #16
strb r0 ,[ r12 ,#3 ]
mov r6 ,r1 ,l s r #8
strb r4 ,[ r12 ,#4 ]
strb r5 ,[ r12 ,#5 ]
mov r4 ,r2 ,l s r #24
strb r6 ,[ r12 ,#6 ]
mov r5 ,r2 ,l s r #16
strb r1 ,[ r12 ,#7 ]
mov r6 ,r2 ,l s r #8
strb r4 ,[ r12 ,#8 ]
strb r5 ,[ r12 ,#9 ]
mov r4 ,r3 ,l s r #24
strb r6 ,[ r12 ,#10 ]
mov r5 ,r3 ,l s r #16
strb r2 ,[ r12 ,#11 ]
mov r6 ,r3 ,l s r #8
strb r4 ,[ r12 ,#12 ]
strb r5 ,[ r12 ,#13 ]
strb r6 ,[ r12 ,#14 ]
strb r3 ,[ r12 ,#15 ]
# endif
ldmia s p ! ,{ r4 - r12 ,p c }
2013-01-10 15:20:15 +04:00
ENDPROC( A E S _ d e c r y p t )
2012-09-07 00:17:02 +04:00
.type _ armv4 _ A E S _ d e c r y p t ,% f u n c t i o n
.align 2
_armv4_AES_decrypt :
str l r ,[ s p ,#- 4 ] ! @ push lr
ldmia r11 ! ,{ r4 - r7 }
eor r0 ,r0 ,r4
ldr r12 ,[ r11 ,#240 - 1 6 ]
eor r1 ,r1 ,r5
eor r2 ,r2 ,r6
eor r3 ,r3 ,r7
sub r12 ,r12 ,#1
mov l r ,#255
and r7 ,l r ,r0 ,l s r #16
and r8 ,l r ,r0 ,l s r #8
and r9 ,l r ,r0
mov r0 ,r0 ,l s r #24
.Ldec_loop :
ldr r4 ,[ r10 ,r7 ,l s l #2 ] @ Td1[s0>>16]
and r7 ,l r ,r1 @ i0
ldr r5 ,[ r10 ,r8 ,l s l #2 ] @ Td2[s0>>8]
and r8 ,l r ,r1 ,l s r #16
ldr r6 ,[ r10 ,r9 ,l s l #2 ] @ Td3[s0>>0]
and r9 ,l r ,r1 ,l s r #8
ldr r0 ,[ r10 ,r0 ,l s l #2 ] @ Td0[s0>>24]
mov r1 ,r1 ,l s r #24
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Td3[s1>>0]
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Td1[s1>>16]
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Td2[s1>>8]
eor r0 ,r0 ,r7 ,r o r #24
ldr r1 ,[ r10 ,r1 ,l s l #2 ] @ Td0[s1>>24]
and r7 ,l r ,r2 ,l s r #8 @ i0
eor r5 ,r8 ,r5 ,r o r #8
and r8 ,l r ,r2 @ i1
eor r6 ,r9 ,r6 ,r o r #8
and r9 ,l r ,r2 ,l s r #16
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Td2[s2>>8]
eor r1 ,r1 ,r4 ,r o r #8
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Td3[s2>>0]
mov r2 ,r2 ,l s r #24
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Td1[s2>>16]
eor r0 ,r0 ,r7 ,r o r #16
ldr r2 ,[ r10 ,r2 ,l s l #2 ] @ Td0[s2>>24]
and r7 ,l r ,r3 ,l s r #16 @ i0
eor r1 ,r1 ,r8 ,r o r #24
and r8 ,l r ,r3 ,l s r #8 @ i1
eor r6 ,r9 ,r6 ,r o r #8
and r9 ,l r ,r3 @ i2
ldr r7 ,[ r10 ,r7 ,l s l #2 ] @ Td1[s3>>16]
eor r2 ,r2 ,r5 ,r o r #8
ldr r8 ,[ r10 ,r8 ,l s l #2 ] @ Td2[s3>>8]
mov r3 ,r3 ,l s r #24
ldr r9 ,[ r10 ,r9 ,l s l #2 ] @ Td3[s3>>0]
eor r0 ,r0 ,r7 ,r o r #8
ldr r7 ,[ r11 ] ,#16
eor r1 ,r1 ,r8 ,r o r #16
ldr r3 ,[ r10 ,r3 ,l s l #2 ] @ Td0[s3>>24]
eor r2 ,r2 ,r9 ,r o r #24
ldr r4 ,[ r11 ,#- 12 ]
eor r0 ,r0 ,r7
ldr r5 ,[ r11 ,#- 8 ]
eor r3 ,r3 ,r6 ,r o r #8
ldr r6 ,[ r11 ,#- 4 ]
and r7 ,l r ,r0 ,l s r #16
eor r1 ,r1 ,r4
and r8 ,l r ,r0 ,l s r #8
eor r2 ,r2 ,r5
and r9 ,l r ,r0
eor r3 ,r3 ,r6
mov r0 ,r0 ,l s r #24
subs r12 ,r12 ,#1
bne . L d e c _ l o o p
add r10 ,r10 ,#1024
ldr r5 ,[ r10 ,#0 ] @ prefetch Td4
ldr r6 ,[ r10 ,#32 ]
ldr r4 ,[ r10 ,#64 ]
ldr r5 ,[ r10 ,#96 ]
ldr r6 ,[ r10 ,#128 ]
ldr r4 ,[ r10 ,#160 ]
ldr r5 ,[ r10 ,#192 ]
ldr r6 ,[ r10 ,#224 ]
ldrb r0 ,[ r10 ,r0 ] @ Td4[s0>>24]
ldrb r4 ,[ r10 ,r7 ] @ Td4[s0>>16]
and r7 ,l r ,r1 @ i0
ldrb r5 ,[ r10 ,r8 ] @ Td4[s0>>8]
and r8 ,l r ,r1 ,l s r #16
ldrb r6 ,[ r10 ,r9 ] @ Td4[s0>>0]
and r9 ,l r ,r1 ,l s r #8
ldrb r7 ,[ r10 ,r7 ] @ Td4[s1>>0]
2013-01-10 15:20:15 +04:00
ARM( l d r b r1 ,[ r10 ,r1 ,l s r #24 ] ) @ Td4[s1>>24]
THUMB( a d d r1 ,r10 ,r1 ,l s r #24 ) @ Td4[s1>>24]
THUMB( l d r b r1 ,[ r1 ] )
2012-09-07 00:17:02 +04:00
ldrb r8 ,[ r10 ,r8 ] @ Td4[s1>>16]
eor r0 ,r7 ,r0 ,l s l #24
ldrb r9 ,[ r10 ,r9 ] @ Td4[s1>>8]
eor r1 ,r4 ,r1 ,l s l #8
and r7 ,l r ,r2 ,l s r #8 @ i0
eor r5 ,r5 ,r8 ,l s l #8
and r8 ,l r ,r2 @ i1
ldrb r7 ,[ r10 ,r7 ] @ Td4[s2>>8]
eor r6 ,r6 ,r9 ,l s l #8
ldrb r8 ,[ r10 ,r8 ] @ Td4[s2>>0]
and r9 ,l r ,r2 ,l s r #16
2013-01-10 15:20:15 +04:00
ARM( l d r b r2 ,[ r10 ,r2 ,l s r #24 ] ) @ Td4[s2>>24]
THUMB( a d d r2 ,r10 ,r2 ,l s r #24 ) @ Td4[s2>>24]
THUMB( l d r b r2 ,[ r2 ] )
2012-09-07 00:17:02 +04:00
eor r0 ,r0 ,r7 ,l s l #8
ldrb r9 ,[ r10 ,r9 ] @ Td4[s2>>16]
eor r1 ,r8 ,r1 ,l s l #16
and r7 ,l r ,r3 ,l s r #16 @ i0
eor r2 ,r5 ,r2 ,l s l #16
and r8 ,l r ,r3 ,l s r #8 @ i1
ldrb r7 ,[ r10 ,r7 ] @ Td4[s3>>16]
eor r6 ,r6 ,r9 ,l s l #16
ldrb r8 ,[ r10 ,r8 ] @ Td4[s3>>8]
and r9 ,l r ,r3 @ i2
ldrb r9 ,[ r10 ,r9 ] @ Td4[s3>>0]
2013-01-10 15:20:15 +04:00
ARM( l d r b r3 ,[ r10 ,r3 ,l s r #24 ] ) @ Td4[s3>>24]
THUMB( a d d r3 ,r10 ,r3 ,l s r #24 ) @ Td4[s3>>24]
THUMB( l d r b r3 ,[ r3 ] )
2012-09-07 00:17:02 +04:00
eor r0 ,r0 ,r7 ,l s l #16
ldr r7 ,[ r11 ,#0 ]
eor r1 ,r1 ,r8 ,l s l #8
ldr r4 ,[ r11 ,#4 ]
eor r2 ,r9 ,r2 ,l s l #8
ldr r5 ,[ r11 ,#8 ]
eor r3 ,r6 ,r3 ,l s l #24
ldr r6 ,[ r11 ,#12 ]
eor r0 ,r0 ,r7
eor r1 ,r1 ,r4
eor r2 ,r2 ,r5
eor r3 ,r3 ,r6
sub r10 ,r10 ,#1024
ldr p c ,[ s p ] ,#4 @ pop and return
.size _ armv4 _ A E S _ d e c r y p t ,. - _ a r m v4 _ A E S _ d e c r y p t
.asciz " AES f o r A R M v4 , C R Y P T O G A M S b y < a p p r o @openssl.org>"
.align 2