/src/botan/build/include/botan/internal/serpent_sbox.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * (C) 1999-2007,2013 Jack Lloyd |
3 | | * |
4 | | * The sbox expressions used here were discovered by Dag Arne Osvik and |
5 | | * are described in his paper "Speeding Up Serpent". |
6 | | * |
7 | | * Botan is released under the Simplified BSD License (see license.txt) |
8 | | */ |
9 | | |
10 | | #ifndef BOTAN_SERPENT_FUNCS_H_ |
11 | | #define BOTAN_SERPENT_FUNCS_H_ |
12 | | |
13 | | #include <botan/build.h> |
14 | | |
15 | | namespace Botan::Serpent_F { |
16 | | |
17 | | template<typename T> |
18 | | BOTAN_FORCE_INLINE void SBoxE0(T& a, T& b, T& c, T& d) |
19 | 0 | { |
20 | 0 | d ^= a; |
21 | 0 | T t0 = b; |
22 | 0 | b &= d; |
23 | 0 | t0 ^= c; |
24 | 0 | b ^= a; |
25 | 0 | a |= d; |
26 | 0 | a ^= t0; |
27 | 0 | t0 ^= d; |
28 | 0 | d ^= c; |
29 | 0 | c |= b; |
30 | 0 | c ^= t0; |
31 | 0 | t0 = ~t0; |
32 | 0 | t0 |= b; |
33 | 0 | b ^= d; |
34 | 0 | b ^= t0; |
35 | 0 | d |= a; |
36 | 0 | b ^= d; |
37 | 0 | t0 ^= d; |
38 | 0 | d = a; |
39 | 0 | a = b; |
40 | 0 | b = t0; |
41 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE0<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE0<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE0<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
42 | | |
43 | | template<typename T> |
44 | | BOTAN_FORCE_INLINE void SBoxE1(T& a, T& b, T& c, T& d) |
45 | 0 | { |
46 | 0 | a = ~a; |
47 | 0 | c = ~c; |
48 | 0 | T t0 = a; |
49 | 0 | a &= b; |
50 | 0 | c ^= a; |
51 | 0 | a |= d; |
52 | 0 | d ^= c; |
53 | 0 | b ^= a; |
54 | 0 | a ^= t0; |
55 | 0 | t0 |= b; |
56 | 0 | b ^= d; |
57 | 0 | c |= a; |
58 | 0 | c &= t0; |
59 | 0 | a ^= b; |
60 | 0 | b &= c; |
61 | 0 | b ^= a; |
62 | 0 | a &= c; |
63 | 0 | t0 ^= a; |
64 | 0 | a = c; |
65 | 0 | c = d; |
66 | 0 | d = b; |
67 | 0 | b = t0; |
68 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE1<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE1<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE1<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
69 | | |
70 | | template<typename T> |
71 | | BOTAN_FORCE_INLINE void SBoxE2(T& a, T& b, T& c, T& d) |
72 | 0 | { |
73 | 0 | T t0 = a; |
74 | 0 | a &= c; |
75 | 0 | a ^= d; |
76 | 0 | c ^= b; |
77 | 0 | c ^= a; |
78 | 0 | d |= t0; |
79 | 0 | d ^= b; |
80 | 0 | t0 ^= c; |
81 | 0 | b = d; |
82 | 0 | d |= t0; |
83 | 0 | d ^= a; |
84 | 0 | a &= b; |
85 | 0 | t0 ^= a; |
86 | 0 | b ^= d; |
87 | 0 | b ^= t0; |
88 | 0 | a = c; |
89 | 0 | c = b; |
90 | 0 | b = d; |
91 | 0 | d = ~t0; |
92 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE2<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE2<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE2<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
93 | | |
94 | | template<typename T> |
95 | | BOTAN_FORCE_INLINE void SBoxE3(T& a, T& b, T& c, T& d) |
96 | 0 | { |
97 | 0 | T t0 = a; |
98 | 0 | a |= d; |
99 | 0 | d ^= b; |
100 | 0 | b &= t0; |
101 | 0 | t0 ^= c; |
102 | 0 | c ^= d; |
103 | 0 | d &= a; |
104 | 0 | t0 |= b; |
105 | 0 | d ^= t0; |
106 | 0 | a ^= b; |
107 | 0 | t0 &= a; |
108 | 0 | b ^= d; |
109 | 0 | t0 ^= c; |
110 | 0 | b |= a; |
111 | 0 | b ^= c; |
112 | 0 | a ^= d; |
113 | 0 | c = b; |
114 | 0 | b |= d; |
115 | 0 | a ^= b; |
116 | 0 | b = c; |
117 | 0 | c = d; |
118 | 0 | d = t0; |
119 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE3<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE3<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE3<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
120 | | |
121 | | template<typename T> |
122 | | BOTAN_FORCE_INLINE void SBoxE4(T& a, T& b, T& c, T& d) |
123 | 0 | { |
124 | 0 | b ^= d; |
125 | 0 | d = ~d; |
126 | 0 | c ^= d; |
127 | 0 | d ^= a; |
128 | 0 | T t0 = b; |
129 | 0 | b &= d; |
130 | 0 | b ^= c; |
131 | 0 | t0 ^= d; |
132 | 0 | a ^= t0; |
133 | 0 | c &= t0; |
134 | 0 | c ^= a; |
135 | 0 | a &= b; |
136 | 0 | d ^= a; |
137 | 0 | t0 |= b; |
138 | 0 | t0 ^= a; |
139 | 0 | a |= d; |
140 | 0 | a ^= c; |
141 | 0 | c &= d; |
142 | 0 | a = ~a; |
143 | 0 | t0 ^= c; |
144 | 0 | c = a; |
145 | 0 | a = b; |
146 | 0 | b = t0; |
147 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE4<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE4<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE4<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
148 | | |
149 | | template<typename T> |
150 | | BOTAN_FORCE_INLINE void SBoxE5(T& a, T& b, T& c, T& d) |
151 | 0 | { |
152 | 0 | a ^= b; |
153 | 0 | b ^= d; |
154 | 0 | d = ~d; |
155 | 0 | T t0 = b; |
156 | 0 | b &= a; |
157 | 0 | c ^= d; |
158 | 0 | b ^= c; |
159 | 0 | c |= t0; |
160 | 0 | t0 ^= d; |
161 | 0 | d &= b; |
162 | 0 | d ^= a; |
163 | 0 | t0 ^= b; |
164 | 0 | t0 ^= c; |
165 | 0 | c ^= a; |
166 | 0 | a &= d; |
167 | 0 | c = ~c; |
168 | 0 | a ^= t0; |
169 | 0 | t0 |= d; |
170 | 0 | t0 ^= c; |
171 | 0 | c = a; |
172 | 0 | a = b; |
173 | 0 | b = d; |
174 | 0 | d = t0; |
175 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE5<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE5<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE5<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
176 | | |
177 | | template<typename T> |
178 | | BOTAN_FORCE_INLINE void SBoxE6(T& a, T& b, T& c, T& d) |
179 | 0 | { |
180 | 0 | c = ~c; |
181 | 0 | T t0 = d; |
182 | 0 | d &= a; |
183 | 0 | a ^= t0; |
184 | 0 | d ^= c; |
185 | 0 | c |= t0; |
186 | 0 | b ^= d; |
187 | 0 | c ^= a; |
188 | 0 | a |= b; |
189 | 0 | c ^= b; |
190 | 0 | t0 ^= a; |
191 | 0 | a |= d; |
192 | 0 | a ^= c; |
193 | 0 | t0 ^= d; |
194 | 0 | t0 ^= a; |
195 | 0 | d = ~d; |
196 | 0 | c &= t0; |
197 | 0 | d ^= c; |
198 | 0 | c = t0; |
199 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE6<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE6<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE6<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
200 | | |
201 | | template<typename T> |
202 | | BOTAN_FORCE_INLINE void SBoxE7(T& a, T& b, T& c, T& d) |
203 | 0 | { |
204 | 0 | T t0 = b; |
205 | 0 | b |= c; |
206 | 0 | b ^= d; |
207 | 0 | t0 ^= c; |
208 | 0 | c ^= b; |
209 | 0 | d |= t0; |
210 | 0 | d &= a; |
211 | 0 | t0 ^= c; |
212 | 0 | d ^= b; |
213 | 0 | b |= t0; |
214 | 0 | b ^= a; |
215 | 0 | a |= t0; |
216 | 0 | a ^= c; |
217 | 0 | b ^= t0; |
218 | 0 | c ^= b; |
219 | 0 | b &= a; |
220 | 0 | b ^= t0; |
221 | 0 | c = ~c; |
222 | 0 | c |= a; |
223 | 0 | t0 ^= c; |
224 | 0 | c = b; |
225 | 0 | b = d; |
226 | 0 | d = a; |
227 | 0 | a = t0; |
228 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxE7<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE7<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxE7<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
229 | | |
230 | | template<typename T> |
231 | | BOTAN_FORCE_INLINE void SBoxD0(T& a, T& b, T& c, T& d) |
232 | 0 | { |
233 | 0 | c = ~c; |
234 | 0 | T t0 = b; |
235 | 0 | b |= a; |
236 | 0 | t0 = ~t0; |
237 | 0 | b ^= c; |
238 | 0 | c |= t0; |
239 | 0 | b ^= d; |
240 | 0 | a ^= t0; |
241 | 0 | c ^= a; |
242 | 0 | a &= d; |
243 | 0 | t0 ^= a; |
244 | 0 | a |= b; |
245 | 0 | a ^= c; |
246 | 0 | d ^= t0; |
247 | 0 | c ^= b; |
248 | 0 | d ^= a; |
249 | 0 | d ^= b; |
250 | 0 | c &= d; |
251 | 0 | t0 ^= c; |
252 | 0 | c = b; |
253 | 0 | b = t0; |
254 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD0<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD0<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD0<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
255 | | |
256 | | template<typename T> |
257 | | BOTAN_FORCE_INLINE void SBoxD1(T& a, T& b, T& c, T& d) |
258 | 0 | { |
259 | 0 | T t0 = b; |
260 | 0 | b ^= d; |
261 | 0 | d &= b; |
262 | 0 | t0 ^= c; |
263 | 0 | d ^= a; |
264 | 0 | a |= b; |
265 | 0 | c ^= d; |
266 | 0 | a ^= t0; |
267 | 0 | a |= c; |
268 | 0 | b ^= d; |
269 | 0 | a ^= b; |
270 | 0 | b |= d; |
271 | 0 | b ^= a; |
272 | 0 | t0 = ~t0; |
273 | 0 | t0 ^= b; |
274 | 0 | b |= a; |
275 | 0 | b ^= a; |
276 | 0 | b |= t0; |
277 | 0 | d ^= b; |
278 | 0 | b = a; |
279 | 0 | a = t0; |
280 | 0 | t0 = c; |
281 | 0 | c = d; |
282 | 0 | d = t0; |
283 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD1<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD1<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD1<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
284 | | |
285 | | template<typename T> |
286 | | BOTAN_FORCE_INLINE void SBoxD2(T& a, T& b, T& c, T& d) |
287 | 0 | { |
288 | 0 | c ^= d; |
289 | 0 | d ^= a; |
290 | 0 | T t0 = d; |
291 | 0 | d &= c; |
292 | 0 | d ^= b; |
293 | 0 | b |= c; |
294 | 0 | b ^= t0; |
295 | 0 | t0 &= d; |
296 | 0 | c ^= d; |
297 | 0 | t0 &= a; |
298 | 0 | t0 ^= c; |
299 | 0 | c &= b; |
300 | 0 | c |= a; |
301 | 0 | d = ~d; |
302 | 0 | c ^= d; |
303 | 0 | a ^= d; |
304 | 0 | a &= b; |
305 | 0 | d ^= t0; |
306 | 0 | d ^= a; |
307 | 0 | a = b; |
308 | 0 | b = t0; |
309 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD2<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD2<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD2<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
310 | | |
311 | | template<typename T> |
312 | | BOTAN_FORCE_INLINE void SBoxD3(T& a, T& b, T& c, T& d) |
313 | 0 | { |
314 | 0 | T t0 = c; |
315 | 0 | c ^= b; |
316 | 0 | a ^= c; |
317 | 0 | t0 &= c; |
318 | 0 | t0 ^= a; |
319 | 0 | a &= b; |
320 | 0 | b ^= d; |
321 | 0 | d |= t0; |
322 | 0 | c ^= d; |
323 | 0 | a ^= d; |
324 | 0 | b ^= t0; |
325 | 0 | d &= c; |
326 | 0 | d ^= b; |
327 | 0 | b ^= a; |
328 | 0 | b |= c; |
329 | 0 | a ^= d; |
330 | 0 | b ^= t0; |
331 | 0 | a ^= b; |
332 | 0 | t0 = a; |
333 | 0 | a = c; |
334 | 0 | c = d; |
335 | 0 | d = t0; |
336 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD3<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD3<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD3<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
337 | | |
338 | | template<typename T> |
339 | | BOTAN_FORCE_INLINE void SBoxD4(T& a, T& b, T& c, T& d) |
340 | 0 | { |
341 | 0 | T t0 = c; |
342 | 0 | c &= d; |
343 | 0 | c ^= b; |
344 | 0 | b |= d; |
345 | 0 | b &= a; |
346 | 0 | t0 ^= c; |
347 | 0 | t0 ^= b; |
348 | 0 | b &= c; |
349 | 0 | a = ~a; |
350 | 0 | d ^= t0; |
351 | 0 | b ^= d; |
352 | 0 | d &= a; |
353 | 0 | d ^= c; |
354 | 0 | a ^= b; |
355 | 0 | c &= a; |
356 | 0 | d ^= a; |
357 | 0 | c ^= t0; |
358 | 0 | c |= d; |
359 | 0 | d ^= a; |
360 | 0 | c ^= b; |
361 | 0 | b = d; |
362 | 0 | d = t0; |
363 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD4<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD4<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD4<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
364 | | |
365 | | template<typename T> |
366 | | BOTAN_FORCE_INLINE void SBoxD5(T& a, T& b, T& c, T& d) |
367 | 0 | { |
368 | 0 | b = ~b; |
369 | 0 | T t0 = d; |
370 | 0 | c ^= b; |
371 | 0 | d |= a; |
372 | 0 | d ^= c; |
373 | 0 | c |= b; |
374 | 0 | c &= a; |
375 | 0 | t0 ^= d; |
376 | 0 | c ^= t0; |
377 | 0 | t0 |= a; |
378 | 0 | t0 ^= b; |
379 | 0 | b &= c; |
380 | 0 | b ^= d; |
381 | 0 | t0 ^= c; |
382 | 0 | d &= t0; |
383 | 0 | t0 ^= b; |
384 | 0 | d ^= t0; |
385 | 0 | t0 = ~t0; |
386 | 0 | d ^= a; |
387 | 0 | a = b; |
388 | 0 | b = t0; |
389 | 0 | t0 = d; |
390 | 0 | d = c; |
391 | 0 | c = t0; |
392 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD5<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD5<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD5<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
393 | | |
394 | | template<typename T> |
395 | | BOTAN_FORCE_INLINE void SBoxD6(T& a, T& b, T& c, T& d) |
396 | 0 | { |
397 | 0 | a ^= c; |
398 | 0 | T t0 = c; |
399 | 0 | c &= a; |
400 | 0 | t0 ^= d; |
401 | 0 | c = ~c; |
402 | 0 | d ^= b; |
403 | 0 | c ^= d; |
404 | 0 | t0 |= a; |
405 | 0 | a ^= c; |
406 | 0 | d ^= t0; |
407 | 0 | t0 ^= b; |
408 | 0 | b &= d; |
409 | 0 | b ^= a; |
410 | 0 | a ^= d; |
411 | 0 | a |= c; |
412 | 0 | d ^= b; |
413 | 0 | t0 ^= a; |
414 | 0 | a = b; |
415 | 0 | b = c; |
416 | 0 | c = t0; |
417 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD6<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD6<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD6<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
418 | | |
419 | | template<typename T> |
420 | | BOTAN_FORCE_INLINE void SBoxD7(T& a, T& b, T& c, T& d) |
421 | 0 | { |
422 | 0 | T t0 = c; |
423 | 0 | c ^= a; |
424 | 0 | a &= d; |
425 | 0 | t0 |= d; |
426 | 0 | c = ~c; |
427 | 0 | d ^= b; |
428 | 0 | b |= a; |
429 | 0 | a ^= c; |
430 | 0 | c &= t0; |
431 | 0 | d &= t0; |
432 | 0 | b ^= c; |
433 | 0 | c ^= a; |
434 | 0 | a |= c; |
435 | 0 | t0 ^= b; |
436 | 0 | a ^= d; |
437 | 0 | d ^= t0; |
438 | 0 | t0 |= a; |
439 | 0 | d ^= c; |
440 | 0 | t0 ^= c; |
441 | 0 | c = b; |
442 | 0 | b = a; |
443 | 0 | a = d; |
444 | 0 | d = t0; |
445 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::SBoxD7<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD7<Botan::SIMD_8x32>(Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) Unexecuted instantiation: void Botan::Serpent_F::SBoxD7<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
446 | | |
447 | | template<size_t S> |
448 | | BOTAN_FORCE_INLINE uint32_t shl(uint32_t v) |
449 | 0 | { |
450 | 0 | return v << S; |
451 | 0 | } Unexecuted instantiation: unsigned int Botan::Serpent_F::shl<3ul>(unsigned int) Unexecuted instantiation: unsigned int Botan::Serpent_F::shl<7ul>(unsigned int) |
452 | | |
453 | | /* |
454 | | * Serpent's Linear Transform |
455 | | */ |
456 | | template<typename T> |
457 | | BOTAN_FORCE_INLINE void transform(T& B0, T& B1, T& B2, T& B3) |
458 | 0 | { |
459 | 0 | B0 = rotl<13>(B0); |
460 | 0 | B2 = rotl<3>(B2); |
461 | 0 | B1 ^= B0 ^ B2; |
462 | 0 | B3 ^= B2 ^ shl<3>(B0); |
463 | 0 | B1 = rotl<1>(B1); |
464 | 0 | B3 = rotl<7>(B3); |
465 | 0 | B0 ^= B1 ^ B3; |
466 | 0 | B2 ^= B3 ^ shl<7>(B1); |
467 | 0 | B0 = rotl<5>(B0); |
468 | 0 | B2 = rotl<22>(B2); |
469 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::transform<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::transform<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
470 | | |
471 | | /* |
472 | | * Serpent's Inverse Linear Transform |
473 | | */ |
474 | | template<typename T> |
475 | | BOTAN_FORCE_INLINE void i_transform(T& B0, T& B1, T& B2, T& B3) |
476 | 0 | { |
477 | 0 | B2 = rotr<22>(B2); |
478 | 0 | B0 = rotr<5>(B0); |
479 | 0 | B2 ^= B3 ^ shl<7>(B1); |
480 | 0 | B0 ^= B1 ^ B3; |
481 | 0 | B3 = rotr<7>(B3); |
482 | 0 | B1 = rotr<1>(B1); |
483 | 0 | B3 ^= B2 ^ shl<3>(B0); |
484 | 0 | B1 ^= B0 ^ B2; |
485 | 0 | B2 = rotr<3>(B2); |
486 | 0 | B0 = rotr<13>(B0); |
487 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::i_transform<unsigned int>(unsigned int&, unsigned int&, unsigned int&, unsigned int&) Unexecuted instantiation: void Botan::Serpent_F::i_transform<Botan::SIMD_4x32>(Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) |
488 | | |
489 | | class Key_Inserter final |
490 | | { |
491 | | public: |
492 | 0 | Key_Inserter(const uint32_t* RK) : m_RK(RK) {} |
493 | | |
494 | | template<typename T> |
495 | | inline void operator()(size_t R, T& B0, T& B1, T& B2, T& B3) const |
496 | 0 | { |
497 | 0 | B0 ^= m_RK[4*R ]; |
498 | 0 | B1 ^= m_RK[4*R+1]; |
499 | 0 | B2 ^= m_RK[4*R+2]; |
500 | 0 | B3 ^= m_RK[4*R+3]; |
501 | 0 | } Unexecuted instantiation: void Botan::Serpent_F::Key_Inserter::operator()<unsigned int>(unsigned long, unsigned int&, unsigned int&, unsigned int&, unsigned int&) const Unexecuted instantiation: void Botan::Serpent_F::Key_Inserter::operator()<Botan::SIMD_8x32>(unsigned long, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&, Botan::SIMD_8x32&) const Unexecuted instantiation: void Botan::Serpent_F::Key_Inserter::operator()<Botan::SIMD_4x32>(unsigned long, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&, Botan::SIMD_4x32&) const |
502 | | |
503 | | private: |
504 | | const uint32_t* m_RK; |
505 | | }; |
506 | | |
507 | | } |
508 | | |
509 | | #endif |