3 This file is part of the ARM-Crypto-Lib.
4 Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
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.
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.
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/>.
20 * \file bmw_small-asm.S
22 * \email daniel.otte@rub.de
24 * \license GPLv3 or later
33 #define S32_1(x) ( (SHR32((x), 1)) ^ \
38 #define S32_2(x) ( (SHR32((x), 2)) ^ \
43 #define S32_3(x) ( (SHR32((x), 2)) ^ \
48 #define S32_4(x) ( (SHR32((x), 1)) ^ (x))
50 #define S32_5(x) ( (SHR32((x), 2)) ^ (x))
59 .type bmw_s32_0, %function
63 eor r0, r0, r1, lsl #3
64 eor r0, r0, r1, ror #28
65 eor r0, r0, r1, ror #13
73 .type bmw_s32_1, %function
77 eor r0, r0, r1, lsl #2
78 eor r0, r0, r1, ror #24
79 eor r0, r0, r1, ror #9
87 .type bmw_s32_2, %function
91 eor r0, r0, r1, lsl #1
92 eor r0, r0, r1, ror #20
93 eor r0, r0, r1, ror #7
101 .type bmw_s32_3, %function
105 eor r0, r0, r1, lsl #2
106 eor r0, r0, r1, ror #17
107 eor r0, r0, r1, ror #3
115 .type bmw_s32_4, %function
117 eor r0, r0, r0, lsr #1
125 .type bmw_s32_5, %function
127 eor r0, r0, r0, lsr #2
137 .type bmw_small_f0, %function
149 ldmia r1!, {r4,r6,r8,r10}
150 ldmia r2!, {r5,r7,r9,r11}
155 stmia r3!, {r4,r6,r8,r10}
157 ldmia r1!, {r4,r6,r8,r10}
158 ldmia r2!, {r5,r7,r9,r11}
163 stmia r3!, {r4,r6,r8,r10}
165 ldmia r1!, {r4,r6,r8,r10}
166 ldmia r2!, {r5,r7,r9,r11}
171 stmia r3!, {r4,r6,r8,r10}
173 ldmia r1!, {r4,r6,r8,r10}
174 ldmia r2!, {r5,r7,r9,r11}
179 stmia r3!, {r4,r6,r8,r10}
184 q[ 0] = (+ h[ 5] - h[ 7] + h[10] + h[13] + h[14]);
185 q[ 3] = (+ h[ 8] - h[10] + h[13] + h[ 0] - h[ 1]);
186 q[ 6] = (- h[11] + h[13] - h[ 0] - h[ 3] + h[ 4]);
187 q[ 9] = (+ h[14] + h[ 0] - h[ 3] + h[ 6] - h[ 7]);
188 q[12] = (+ h[ 1] + h[ 3] - h[ 6] - h[ 9] + h[10]);
189 q[15] = (- h[ 4] - h[ 6] - h[ 9] + h[12] + h[13]);
190 q[ 2] = (+ h[ 7] + h[ 9] - h[12] + h[15] + h[ 0]);
191 q[ 5] = (+ h[10] - h[12] + h[15] - h[ 2] + h[ 3]);
192 q[ 8] = (+ h[13] - h[15] + h[ 2] - h[ 5] - h[ 6]);
193 q[11] = (- h[ 0] - h[ 2] - h[ 5] + h[ 8] + h[ 9]);
194 q[14] = (+ h[ 3] - h[ 5] + h[ 8] - h[11] - h[12]);
195 q[ 1] = (+ h[ 6] - h[ 8] + h[11] + h[14] - h[15]);
196 q[ 4] = (+ h[ 9] - h[11] - h[14] + h[ 1] + h[ 2]);
197 q[ 7] = (- h[12] - h[14] + h[ 1] - h[ 4] - h[ 5]);
198 q[10] = (+ h[15] - h[ 1] - h[ 4] - h[ 7] + h[ 8]);
199 q[13] = (+ h[ 2] + h[ 4] + h[ 7] + h[10] + h[11]);
203 ldr r6, [r3, #(10*4)]
204 ldr r7, [r3, #(13*4)]
205 ldr r8, [r3, #(14*4)]
207 ldr r10, [r3, #(11*4)]