]> git.cryptolib.org Git - arm-crypto-lib.git/blob - bmw/bmw_small_speed_asm_f0.S
forgotten bmw stuff
[arm-crypto-lib.git] / bmw / bmw_small_speed_asm_f0.S
1 /* bmw_small_speed_asm_f0.S */
2 /*
3     This file is part of the ARM-Crypto-Lib.
4     Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20         .syntax unified
21
22 .macro S32_0 out:req in:req
23         lsr \out, \in, #1
24         eor \out, \out, \in, LSL #3
25         eor \out, \out, \in, ROR #28
26         eor \out, \out, \in, ROR #13
27 .endm
28
29 .macro S32_1 out:req in:req
30         lsr \out, \in, #1
31         eor \out, \out, \in, LSL #2
32         eor \out, \out, \in, ROR #24
33         eor \out, \out, \in, ROR #9
34 .endm
35
36 .macro S32_2 out:req in:req
37         lsr \out, \in, #2
38         eor \out, \out, \in, LSL #1
39         eor \out, \out, \in, ROR #20
40         eor \out, \out, \in, ROR #7
41 .endm
42
43 .macro S32_3 out:req in:req
44         lsr \out, \in, #2
45         eor \out, \out, \in, LSL #2
46         eor \out, \out, \in, ROR #17
47         eor \out, \out, \in, ROR #3
48 .endm
49
50 .macro S32_4 in:req
51         eor \in, \in, \in, LSR #1
52 .endm
53
54 .macro S32_5 in:req
55         eor \in, \in, \in, LSR #2
56 .endm
57
58 #define T00_ADDR [SP, #(15-3)*4]
59 #define T01_ADDR [SP, #(15-2)*4]
60 #define T02_ADDR [SP, #(15-1)*4]
61 #define T03_ADDR [SP, #(15-0)*4]
62 #define T04_ADDR [SP, #(15-7)*4]
63 #define T05_ADDR [SP, #(15-6)*4]
64 #define T06_ADDR [SP, #(15-5)*4]
65 #define T07_ADDR [SP, #(15-4)*4]
66 #define T08_ADDR [SP, #(15-11)*4]
67 #define T09_ADDR [SP, #(15-10)*4]
68 #define T10_ADDR [SP, #(15-9)*4]
69 #define T11_ADDR [SP, #(15-8)*4]
70 #define T12_ADDR [SP, #(15-15)*4]
71 #define T13_ADDR [SP, #(15-14)*4]
72 #define T14_ADDR [SP, #(15-13)*4]
73 #define T15_ADDR [SP, #(15-12)*4]
74
75         .text
76         .align 2
77         .thumb
78         .thumb_func
79         .type   bmw_small_f0, %function
80         .global bmw_small_f0
81 bmw_small_f0:
82         push {r4, r5, r6, r7, r8, r9, r10, r11, r12, r14}
83         /* memxor(<STACK>, h, m, 16) */
84         ldmia r1!, {r4, r5, r6, r7}
85         ldmia r2!, {r8, r9, r10, r11}
86         eor r4, r8
87         eor r5, r9
88         eor r6, r10
89         eor r7, r11
90         push {r4, r5, r6, r7}
91         ldmia r1!, {r4, r5, r6, r7}
92         ldmia r2!, {r8, r9, r10, r11}
93         eor r4, r8
94         eor r5, r9
95         eor r6, r10
96         eor r7, r11
97         push {r4, r5, r6, r7}
98         ldmia r1!, {r4, r5, r6, r7}
99         ldmia r2!, {r8, r9, r10, r11}
100         eor r4, r8
101         eor r5, r9
102         eor r6, r10
103         eor r7, r11
104         push {r4, r5, r6, r7}
105         ldmia r1!, {r4, r5, r6, r7}
106         ldmia r2!, {r8, r9, r10, r11}
107         eor r4, r8
108         eor r5, r9
109         eor r6, r10
110         eor r7, r11
111         push {r4, r5, r6, r7}
112     sub r1, #16*4
113
114 #include "f0_small_autogen.i"
115
116         add SP, #16*4
117         pop {r4, r5, r6, r7, r8, r9, r10, r11, r12, PC}
118