| OLD | NEW |
| 1 | 1 |
| 2 @ ==================================================================== | 2 @ ==================================================================== |
| 3 @ Written by Andy Polyakov <appro@openssl.org> for the OpenSSL | 3 @ Written by Andy Polyakov <appro@openssl.org> for the OpenSSL |
| 4 @ project. The module is, however, dual licensed under OpenSSL and | 4 @ project. The module is, however, dual licensed under OpenSSL and |
| 5 @ CRYPTOGAMS licenses depending on where you obtain it. For further | 5 @ CRYPTOGAMS licenses depending on where you obtain it. For further |
| 6 @ details see http://www.openssl.org/~appro/cryptogams/. | 6 @ details see http://www.openssl.org/~appro/cryptogams/. |
| 7 @ ==================================================================== | 7 @ ==================================================================== |
| 8 | 8 |
| 9 @ AES for ARMv4 | 9 @ AES for ARMv4 |
| 10 | 10 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 .byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 | 149 .byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 |
| 150 .byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf | 150 .byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf |
| 151 .byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 | 151 .byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 |
| 152 .byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 | 152 .byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 |
| 153 @ rcon[] | 153 @ rcon[] |
| 154 .word 0x01000000, 0x02000000, 0x04000000, 0x08000000 | 154 .word 0x01000000, 0x02000000, 0x04000000, 0x08000000 |
| 155 .word 0x10000000, 0x20000000, 0x40000000, 0x80000000 | 155 .word 0x10000000, 0x20000000, 0x40000000, 0x80000000 |
| 156 .word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0 | 156 .word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0 |
| 157 .size AES_Te,.-AES_Te | 157 .size AES_Te,.-AES_Te |
| 158 | 158 |
| 159 @ void AES_encrypt(const unsigned char *in, unsigned char *out, | 159 @ void asm_AES_encrypt(const unsigned char *in, unsigned char *out, |
| 160 @ » » const AES_KEY *key) { | 160 @ » » const AES_KEY *key) { |
| 161 .global AES_encrypt | 161 .global asm_AES_encrypt |
| 162 .type AES_encrypt,%function | 162 .hidden asm_AES_encrypt |
| 163 .type asm_AES_encrypt,%function |
| 163 .align 5 | 164 .align 5 |
| 164 AES_encrypt: | 165 asm_AES_encrypt: |
| 165 #if __ARM_ARCH__<7 | 166 #if __ARM_ARCH__<7 |
| 166 » sub» r3,pc,#8» » @ AES_encrypt | 167 » sub» r3,pc,#8» » @ asm_AES_encrypt |
| 167 #else | 168 #else |
| 168 » adr» r3,AES_encrypt | 169 » adr» r3,asm_AES_encrypt |
| 169 #endif | 170 #endif |
| 170 stmdb sp!,{r1,r4-r12,lr} | 171 stmdb sp!,{r1,r4-r12,lr} |
| 171 mov r12,r0 @ inp | 172 mov r12,r0 @ inp |
| 172 mov r11,r2 | 173 mov r11,r2 |
| 173 » sub» r10,r3,#AES_encrypt-AES_Te» @ Te | 174 » sub» r10,r3,#asm_AES_encrypt-AES_Te» @ Te |
| 174 #if __ARM_ARCH__<7 | 175 #if __ARM_ARCH__<7 |
| 175 ldrb r0,[r12,#3] @ load input data in endian-neutral | 176 ldrb r0,[r12,#3] @ load input data in endian-neutral |
| 176 ldrb r4,[r12,#2] @ manner... | 177 ldrb r4,[r12,#2] @ manner... |
| 177 ldrb r5,[r12,#1] | 178 ldrb r5,[r12,#1] |
| 178 ldrb r6,[r12,#0] | 179 ldrb r6,[r12,#0] |
| 179 orr r0,r0,r4,lsl#8 | 180 orr r0,r0,r4,lsl#8 |
| 180 ldrb r1,[r12,#7] | 181 ldrb r1,[r12,#7] |
| 181 orr r0,r0,r5,lsl#16 | 182 orr r0,r0,r5,lsl#16 |
| 182 ldrb r4,[r12,#6] | 183 ldrb r4,[r12,#6] |
| 183 orr r0,r0,r6,lsl#24 | 184 orr r0,r0,r6,lsl#24 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 strb r3,[r12,#15] | 258 strb r3,[r12,#15] |
| 258 #endif | 259 #endif |
| 259 #if __ARM_ARCH__>=5 | 260 #if __ARM_ARCH__>=5 |
| 260 ldmia sp!,{r4-r12,pc} | 261 ldmia sp!,{r4-r12,pc} |
| 261 #else | 262 #else |
| 262 ldmia sp!,{r4-r12,lr} | 263 ldmia sp!,{r4-r12,lr} |
| 263 tst lr,#1 | 264 tst lr,#1 |
| 264 moveq pc,lr @ be binary compatible with V4, yet | 265 moveq pc,lr @ be binary compatible with V4, yet |
| 265 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) | 266 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) |
| 266 #endif | 267 #endif |
| 267 .size» AES_encrypt,.-AES_encrypt | 268 .size» asm_AES_encrypt,.-asm_AES_encrypt |
| 268 | 269 |
| 269 .type _armv4_AES_encrypt,%function | 270 .type _armv4_AES_encrypt,%function |
| 270 .align 2 | 271 .align 2 |
| 271 _armv4_AES_encrypt: | 272 _armv4_AES_encrypt: |
| 272 str lr,[sp,#-4]! @ push lr | 273 str lr,[sp,#-4]! @ push lr |
| 273 ldmia r11!,{r4-r7} | 274 ldmia r11!,{r4-r7} |
| 274 eor r0,r0,r4 | 275 eor r0,r0,r4 |
| 275 ldr r12,[r11,#240-16] | 276 ldr r12,[r11,#240-16] |
| 276 eor r1,r1,r5 | 277 eor r1,r1,r5 |
| 277 eor r2,r2,r6 | 278 eor r2,r2,r6 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 397 |
| 397 eor r0,r0,r7 | 398 eor r0,r0,r7 |
| 398 eor r1,r1,r4 | 399 eor r1,r1,r4 |
| 399 eor r2,r2,r5 | 400 eor r2,r2,r5 |
| 400 eor r3,r3,r6 | 401 eor r3,r3,r6 |
| 401 | 402 |
| 402 sub r10,r10,#2 | 403 sub r10,r10,#2 |
| 403 ldr pc,[sp],#4 @ pop and return | 404 ldr pc,[sp],#4 @ pop and return |
| 404 .size _armv4_AES_encrypt,.-_armv4_AES_encrypt | 405 .size _armv4_AES_encrypt,.-_armv4_AES_encrypt |
| 405 | 406 |
| 406 .global AES_set_encrypt_key | 407 .global asm_AES_set_encrypt_key |
| 407 .type AES_set_encrypt_key,%function | 408 .hidden asm_AES_set_encrypt_key |
| 409 .type asm_AES_set_encrypt_key,%function |
| 408 .align 5 | 410 .align 5 |
| 409 AES_set_encrypt_key: | 411 asm_AES_set_encrypt_key: |
| 410 _armv4_AES_set_encrypt_key: | 412 _armv4_AES_set_encrypt_key: |
| 411 #if __ARM_ARCH__<7 | 413 #if __ARM_ARCH__<7 |
| 412 » sub» r3,pc,#8» » @ AES_set_encrypt_key | 414 » sub» r3,pc,#8» » @ asm_AES_set_encrypt_key |
| 413 #else | 415 #else |
| 414 » adr» r3,AES_set_encrypt_key | 416 » adr» r3,asm_AES_set_encrypt_key |
| 415 #endif | 417 #endif |
| 416 teq r0,#0 | 418 teq r0,#0 |
| 417 #if __ARM_ARCH__>=7 | 419 #if __ARM_ARCH__>=7 |
| 418 itt eq @ Thumb2 thing, sanity check in ARM | 420 itt eq @ Thumb2 thing, sanity check in ARM |
| 419 #endif | 421 #endif |
| 420 moveq r0,#-1 | 422 moveq r0,#-1 |
| 421 beq .Labrt | 423 beq .Labrt |
| 422 teq r2,#0 | 424 teq r2,#0 |
| 423 #if __ARM_ARCH__>=7 | 425 #if __ARM_ARCH__>=7 |
| 424 itt eq @ Thumb2 thing, sanity check in ARM | 426 itt eq @ Thumb2 thing, sanity check in ARM |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 .Ldone: mov r0,#0 | 698 .Ldone: mov r0,#0 |
| 697 ldmia sp!,{r4-r12,lr} | 699 ldmia sp!,{r4-r12,lr} |
| 698 .Labrt: | 700 .Labrt: |
| 699 #if defined(__thumb2__) && __ARM_ARCH__>=7 | 701 #if defined(__thumb2__) && __ARM_ARCH__>=7 |
| 700 .short 0x4770 @ .word 0xe12fff1e in Thumb2 encoding | 702 .short 0x4770 @ .word 0xe12fff1e in Thumb2 encoding |
| 701 #else | 703 #else |
| 702 tst lr,#1 | 704 tst lr,#1 |
| 703 moveq pc,lr @ be binary compatible with V4, yet | 705 moveq pc,lr @ be binary compatible with V4, yet |
| 704 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) | 706 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) |
| 705 #endif | 707 #endif |
| 706 .size» AES_set_encrypt_key,.-AES_set_encrypt_key | 708 .size» asm_AES_set_encrypt_key,.-asm_AES_set_encrypt_key |
| 707 | 709 |
| 708 .global AES_set_decrypt_key | 710 .global asm_AES_set_decrypt_key |
| 709 .type AES_set_decrypt_key,%function | 711 .hidden asm_AES_set_decrypt_key |
| 712 .type asm_AES_set_decrypt_key,%function |
| 710 .align 5 | 713 .align 5 |
| 711 AES_set_decrypt_key: | 714 asm_AES_set_decrypt_key: |
| 712 str lr,[sp,#-4]! @ push lr | 715 str lr,[sp,#-4]! @ push lr |
| 713 bl _armv4_AES_set_encrypt_key | 716 bl _armv4_AES_set_encrypt_key |
| 714 teq r0,#0 | 717 teq r0,#0 |
| 715 ldr lr,[sp],#4 @ pop lr | 718 ldr lr,[sp],#4 @ pop lr |
| 716 bne .Labrt | 719 bne .Labrt |
| 717 | 720 |
| 718 » mov» r0,r2» » » @ AES_set_encrypt_key preserves r2, | 721 » mov» r0,r2» » » @ asm_AES_set_encrypt_key preserves r2, |
| 719 mov r1,r2 @ which is AES_KEY *key | 722 mov r1,r2 @ which is AES_KEY *key |
| 720 b _armv4_AES_set_enc2dec_key | 723 b _armv4_AES_set_enc2dec_key |
| 721 .size» AES_set_decrypt_key,.-AES_set_decrypt_key | 724 .size» asm_AES_set_decrypt_key,.-asm_AES_set_decrypt_key |
| 722 | 725 |
| 723 @ void AES_set_enc2dec_key(const AES_KEY *inp,AES_KEY *out) | 726 @ void AES_set_enc2dec_key(const AES_KEY *inp,AES_KEY *out) |
| 724 .global AES_set_enc2dec_key | 727 .global AES_set_enc2dec_key |
| 728 .hidden AES_set_enc2dec_key |
| 725 .type AES_set_enc2dec_key,%function | 729 .type AES_set_enc2dec_key,%function |
| 726 .align 5 | 730 .align 5 |
| 727 AES_set_enc2dec_key: | 731 AES_set_enc2dec_key: |
| 728 _armv4_AES_set_enc2dec_key: | 732 _armv4_AES_set_enc2dec_key: |
| 729 stmdb sp!,{r4-r12,lr} | 733 stmdb sp!,{r4-r12,lr} |
| 730 | 734 |
| 731 ldr r12,[r0,#240] | 735 ldr r12,[r0,#240] |
| 732 mov r7,r0 @ input | 736 mov r7,r0 @ input |
| 733 add r8,r0,r12,lsl#4 | 737 add r8,r0,r12,lsl#4 |
| 734 mov r11,r1 @ ouput | 738 mov r11,r1 @ ouput |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 .byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 | 916 .byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 |
| 913 .byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f | 917 .byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f |
| 914 .byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d | 918 .byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d |
| 915 .byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef | 919 .byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef |
| 916 .byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 | 920 .byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 |
| 917 .byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 | 921 .byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 |
| 918 .byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 | 922 .byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 |
| 919 .byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d | 923 .byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d |
| 920 .size AES_Td,.-AES_Td | 924 .size AES_Td,.-AES_Td |
| 921 | 925 |
| 922 @ void AES_decrypt(const unsigned char *in, unsigned char *out, | 926 @ void asm_AES_decrypt(const unsigned char *in, unsigned char *out, |
| 923 @ » » const AES_KEY *key) { | 927 @ » » const AES_KEY *key) { |
| 924 .global AES_decrypt | 928 .global asm_AES_decrypt |
| 925 .type AES_decrypt,%function | 929 .hidden asm_AES_decrypt |
| 930 .type asm_AES_decrypt,%function |
| 926 .align 5 | 931 .align 5 |
| 927 AES_decrypt: | 932 asm_AES_decrypt: |
| 928 #if __ARM_ARCH__<7 | 933 #if __ARM_ARCH__<7 |
| 929 » sub» r3,pc,#8» » @ AES_decrypt | 934 » sub» r3,pc,#8» » @ asm_AES_decrypt |
| 930 #else | 935 #else |
| 931 » adr» r3,AES_decrypt | 936 » adr» r3,asm_AES_decrypt |
| 932 #endif | 937 #endif |
| 933 stmdb sp!,{r1,r4-r12,lr} | 938 stmdb sp!,{r1,r4-r12,lr} |
| 934 mov r12,r0 @ inp | 939 mov r12,r0 @ inp |
| 935 mov r11,r2 | 940 mov r11,r2 |
| 936 » sub» r10,r3,#AES_decrypt-AES_Td» » @ Td | 941 » sub» r10,r3,#asm_AES_decrypt-AES_Td» » @ Td |
| 937 #if __ARM_ARCH__<7 | 942 #if __ARM_ARCH__<7 |
| 938 ldrb r0,[r12,#3] @ load input data in endian-neutral | 943 ldrb r0,[r12,#3] @ load input data in endian-neutral |
| 939 ldrb r4,[r12,#2] @ manner... | 944 ldrb r4,[r12,#2] @ manner... |
| 940 ldrb r5,[r12,#1] | 945 ldrb r5,[r12,#1] |
| 941 ldrb r6,[r12,#0] | 946 ldrb r6,[r12,#0] |
| 942 orr r0,r0,r4,lsl#8 | 947 orr r0,r0,r4,lsl#8 |
| 943 ldrb r1,[r12,#7] | 948 ldrb r1,[r12,#7] |
| 944 orr r0,r0,r5,lsl#16 | 949 orr r0,r0,r5,lsl#16 |
| 945 ldrb r4,[r12,#6] | 950 ldrb r4,[r12,#6] |
| 946 orr r0,r0,r6,lsl#24 | 951 orr r0,r0,r6,lsl#24 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 strb r3,[r12,#15] | 1025 strb r3,[r12,#15] |
| 1021 #endif | 1026 #endif |
| 1022 #if __ARM_ARCH__>=5 | 1027 #if __ARM_ARCH__>=5 |
| 1023 ldmia sp!,{r4-r12,pc} | 1028 ldmia sp!,{r4-r12,pc} |
| 1024 #else | 1029 #else |
| 1025 ldmia sp!,{r4-r12,lr} | 1030 ldmia sp!,{r4-r12,lr} |
| 1026 tst lr,#1 | 1031 tst lr,#1 |
| 1027 moveq pc,lr @ be binary compatible with V4, yet | 1032 moveq pc,lr @ be binary compatible with V4, yet |
| 1028 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) | 1033 .word 0xe12fff1e @ interoperable with Thumb ISA:-
) |
| 1029 #endif | 1034 #endif |
| 1030 .size» AES_decrypt,.-AES_decrypt | 1035 .size» asm_AES_decrypt,.-asm_AES_decrypt |
| 1031 | 1036 |
| 1032 .type _armv4_AES_decrypt,%function | 1037 .type _armv4_AES_decrypt,%function |
| 1033 .align 2 | 1038 .align 2 |
| 1034 _armv4_AES_decrypt: | 1039 _armv4_AES_decrypt: |
| 1035 str lr,[sp,#-4]! @ push lr | 1040 str lr,[sp,#-4]! @ push lr |
| 1036 ldmia r11!,{r4-r7} | 1041 ldmia r11!,{r4-r7} |
| 1037 eor r0,r0,r4 | 1042 eor r0,r0,r4 |
| 1038 ldr r12,[r11,#240-16] | 1043 ldr r12,[r11,#240-16] |
| 1039 eor r1,r1,r5 | 1044 eor r1,r1,r5 |
| 1040 eor r2,r2,r6 | 1045 eor r2,r2,r6 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 eor r2,r2,r5 | 1176 eor r2,r2,r5 |
| 1172 eor r3,r3,r6 | 1177 eor r3,r3,r6 |
| 1173 | 1178 |
| 1174 sub r10,r10,#1024 | 1179 sub r10,r10,#1024 |
| 1175 ldr pc,[sp],#4 @ pop and return | 1180 ldr pc,[sp],#4 @ pop and return |
| 1176 .size _armv4_AES_decrypt,.-_armv4_AES_decrypt | 1181 .size _armv4_AES_decrypt,.-_armv4_AES_decrypt |
| 1177 .asciz "AES for ARMv4, CRYPTOGAMS by <appro@openssl.org>" | 1182 .asciz "AES for ARMv4, CRYPTOGAMS by <appro@openssl.org>" |
| 1178 .align 2 | 1183 .align 2 |
| 1179 | 1184 |
| 1180 #endif | 1185 #endif |
| OLD | NEW |