15 #ifndef CRYPTOPP_INLINE 16 # if defined(CRYPTOPP_DEBUG) 17 # define CRYPTOPP_INLINE static 19 # define CRYPTOPP_INLINE inline 28 #if (CRYPTOPP_SSSE3_AVAILABLE) 29 # include <pmmintrin.h> 30 # include <tmmintrin.h> 34 # include <ammintrin.h> 37 #if defined(__AVX512F__) && defined(__AVX512VL__) 38 # define CRYPTOPP_AVX512_ROTATE 1 39 # include <immintrin.h> 42 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 43 # include <arm_neon.h> 48 #if (CRYPTOPP_ARM_ACLE_AVAILABLE) 50 # include <arm_acle.h> 53 #if defined(CRYPTOPP_POWER8_AVAILABLE) 58 extern const char SPECK128_SIMD_FNAME[] = __FILE__;
60 ANONYMOUS_NAMESPACE_BEGIN
63 using CryptoPP::word32;
64 using CryptoPP::word64;
68 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 71 CRYPTOPP_INLINE T UnpackHigh64(
const T& a,
const T& b)
73 const uint64x1_t x(vget_high_u64((uint64x2_t)a));
74 const uint64x1_t y(vget_high_u64((uint64x2_t)b));
75 return (T)vcombine_u64(x, y);
79 CRYPTOPP_INLINE T UnpackLow64(
const T& a,
const T& b)
81 const uint64x1_t x(vget_low_u64((uint64x2_t)a));
82 const uint64x1_t y(vget_low_u64((uint64x2_t)b));
83 return (T)vcombine_u64(x, y);
86 template <
unsigned int R>
87 CRYPTOPP_INLINE uint64x2_t RotateLeft64(
const uint64x2_t& val)
89 const uint64x2_t a(vshlq_n_u64(val, R));
90 const uint64x2_t b(vshrq_n_u64(val, 64 - R));
91 return vorrq_u64(a, b);
94 template <
unsigned int R>
95 CRYPTOPP_INLINE uint64x2_t RotateRight64(
const uint64x2_t& val)
97 const uint64x2_t a(vshlq_n_u64(val, 64 - R));
98 const uint64x2_t b(vshrq_n_u64(val, R));
99 return vorrq_u64(a, b);
102 #if defined(__aarch32__) || defined(__aarch64__) 105 CRYPTOPP_INLINE uint64x2_t RotateLeft64<8>(
const uint64x2_t& val)
107 #if (CRYPTOPP_BIG_ENDIAN) 108 const uint8_t maskb[16] = { 14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7 };
109 const uint8x16_t mask = vld1q_u8(maskb);
111 const uint8_t maskb[16] = { 7,0,1,2, 3,4,5,6, 15,8,9,10, 11,12,13,14 };
112 const uint8x16_t mask = vld1q_u8(maskb);
115 return vreinterpretq_u64_u8(
116 vqtbl1q_u8(vreinterpretq_u8_u64(val), mask));
121 CRYPTOPP_INLINE uint64x2_t RotateRight64<8>(
const uint64x2_t& val)
123 #if (CRYPTOPP_BIG_ENDIAN) 124 const uint8_t maskb[16] = { 8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1 };
125 const uint8x16_t mask = vld1q_u8(maskb);
127 const uint8_t maskb[16] = { 1,2,3,4, 5,6,7,0, 9,10,11,12, 13,14,15,8 };
128 const uint8x16_t mask = vld1q_u8(maskb);
131 return vreinterpretq_u64_u8(
132 vqtbl1q_u8(vreinterpretq_u8_u64(val), mask));
136 CRYPTOPP_INLINE
void SPECK128_Enc_Block(uint64x2_t &block0, uint64x2_t &block1,
137 const word64 *subkeys,
unsigned int rounds)
140 uint64x2_t x1 = UnpackHigh64(block0, block1);
141 uint64x2_t y1 = UnpackLow64(block0, block1);
143 for (
int i=0; i < static_cast<int>(rounds); ++i)
145 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
147 x1 = RotateRight64<8>(x1);
148 x1 = vaddq_u64(x1, y1);
149 x1 = veorq_u64(x1, rk);
150 y1 = RotateLeft64<3>(y1);
151 y1 = veorq_u64(y1, x1);
155 block0 = UnpackLow64(y1, x1);
156 block1 = UnpackHigh64(y1, x1);
159 CRYPTOPP_INLINE
void SPECK128_Enc_6_Blocks(uint64x2_t &block0, uint64x2_t &block1,
160 uint64x2_t &block2, uint64x2_t &block3, uint64x2_t &block4, uint64x2_t &block5,
161 const word64 *subkeys,
unsigned int rounds)
164 uint64x2_t x1 = UnpackHigh64(block0, block1);
165 uint64x2_t y1 = UnpackLow64(block0, block1);
166 uint64x2_t x2 = UnpackHigh64(block2, block3);
167 uint64x2_t y2 = UnpackLow64(block2, block3);
168 uint64x2_t x3 = UnpackHigh64(block4, block5);
169 uint64x2_t y3 = UnpackLow64(block4, block5);
171 for (
int i=0; i < static_cast<int>(rounds); ++i)
173 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
175 x1 = RotateRight64<8>(x1);
176 x2 = RotateRight64<8>(x2);
177 x3 = RotateRight64<8>(x3);
178 x1 = vaddq_u64(x1, y1);
179 x2 = vaddq_u64(x2, y2);
180 x3 = vaddq_u64(x3, y3);
181 x1 = veorq_u64(x1, rk);
182 x2 = veorq_u64(x2, rk);
183 x3 = veorq_u64(x3, rk);
184 y1 = RotateLeft64<3>(y1);
185 y2 = RotateLeft64<3>(y2);
186 y3 = RotateLeft64<3>(y3);
187 y1 = veorq_u64(y1, x1);
188 y2 = veorq_u64(y2, x2);
189 y3 = veorq_u64(y3, x3);
193 block0 = UnpackLow64(y1, x1);
194 block1 = UnpackHigh64(y1, x1);
195 block2 = UnpackLow64(y2, x2);
196 block3 = UnpackHigh64(y2, x2);
197 block4 = UnpackLow64(y3, x3);
198 block5 = UnpackHigh64(y3, x3);
201 CRYPTOPP_INLINE
void SPECK128_Dec_Block(uint64x2_t &block0, uint64x2_t &block1,
202 const word64 *subkeys,
unsigned int rounds)
205 uint64x2_t x1 = UnpackHigh64(block0, block1);
206 uint64x2_t y1 = UnpackLow64(block0, block1);
208 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
210 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
212 y1 = veorq_u64(y1, x1);
213 y1 = RotateRight64<3>(y1);
214 x1 = veorq_u64(x1, rk);
215 x1 = vsubq_u64(x1, y1);
216 x1 = RotateLeft64<8>(x1);
220 block0 = UnpackLow64(y1, x1);
221 block1 = UnpackHigh64(y1, x1);
224 CRYPTOPP_INLINE
void SPECK128_Dec_6_Blocks(uint64x2_t &block0, uint64x2_t &block1,
225 uint64x2_t &block2, uint64x2_t &block3, uint64x2_t &block4, uint64x2_t &block5,
226 const word64 *subkeys,
unsigned int rounds)
229 uint64x2_t x1 = UnpackHigh64(block0, block1);
230 uint64x2_t y1 = UnpackLow64(block0, block1);
231 uint64x2_t x2 = UnpackHigh64(block2, block3);
232 uint64x2_t y2 = UnpackLow64(block2, block3);
233 uint64x2_t x3 = UnpackHigh64(block4, block5);
234 uint64x2_t y3 = UnpackLow64(block4, block5);
236 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
238 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
240 y1 = veorq_u64(y1, x1);
241 y2 = veorq_u64(y2, x2);
242 y3 = veorq_u64(y3, x3);
243 y1 = RotateRight64<3>(y1);
244 y2 = RotateRight64<3>(y2);
245 y3 = RotateRight64<3>(y3);
246 x1 = veorq_u64(x1, rk);
247 x2 = veorq_u64(x2, rk);
248 x3 = veorq_u64(x3, rk);
249 x1 = vsubq_u64(x1, y1);
250 x2 = vsubq_u64(x2, y2);
251 x3 = vsubq_u64(x3, y3);
252 x1 = RotateLeft64<8>(x1);
253 x2 = RotateLeft64<8>(x2);
254 x3 = RotateLeft64<8>(x3);
258 block0 = UnpackLow64(y1, x1);
259 block1 = UnpackHigh64(y1, x1);
260 block2 = UnpackLow64(y2, x2);
261 block3 = UnpackHigh64(y2, x2);
262 block4 = UnpackLow64(y3, x3);
263 block5 = UnpackHigh64(y3, x3);
266 #endif // CRYPTOPP_ARM_NEON_AVAILABLE 270 #if defined(CRYPTOPP_SSSE3_AVAILABLE) 274 # define M128_CAST(x) ((__m128i *)(void *)(x)) 276 #ifndef CONST_M128_CAST 277 # define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x)) 282 # define DOUBLE_CAST(x) ((double *)(void *)(x)) 284 #ifndef CONST_DOUBLE_CAST 285 # define CONST_DOUBLE_CAST(x) ((const double *)(const void *)(x)) 288 template <
unsigned int R>
289 CRYPTOPP_INLINE __m128i RotateLeft64(
const __m128i& val)
291 #if defined(CRYPTOPP_AVX512_ROTATE) 292 return _mm_rol_epi64(val, R);
293 #elif defined(__XOP__) 294 return _mm_roti_epi64(val, R);
297 _mm_slli_epi64(val, R), _mm_srli_epi64(val, 64-R));
301 template <
unsigned int R>
302 CRYPTOPP_INLINE __m128i RotateRight64(
const __m128i& val)
304 #if defined(CRYPTOPP_AVX512_ROTATE) 305 return _mm_ror_epi64(val, R);
306 #elif defined(__XOP__) 307 return _mm_roti_epi64(val, 64-R);
310 _mm_slli_epi64(val, 64-R), _mm_srli_epi64(val, R));
316 __m128i RotateLeft64<8>(
const __m128i& val)
319 return _mm_roti_epi64(val, 8);
321 const __m128i mask = _mm_set_epi8(14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7);
322 return _mm_shuffle_epi8(val, mask);
328 __m128i RotateRight64<8>(
const __m128i& val)
331 return _mm_roti_epi64(val, 64-8);
333 const __m128i mask = _mm_set_epi8(8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1);
334 return _mm_shuffle_epi8(val, mask);
338 CRYPTOPP_INLINE
void SPECK128_Enc_Block(__m128i &block0, __m128i &block1,
339 const word64 *subkeys,
unsigned int rounds)
342 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
343 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
345 for (
int i=0; i < static_cast<int>(rounds); ++i)
347 const __m128i rk = _mm_castpd_si128(
348 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
350 x1 = RotateRight64<8>(x1);
351 x1 = _mm_add_epi64(x1, y1);
352 x1 = _mm_xor_si128(x1, rk);
353 y1 = RotateLeft64<3>(y1);
354 y1 = _mm_xor_si128(y1, x1);
358 block0 = _mm_unpacklo_epi64(y1, x1);
359 block1 = _mm_unpackhi_epi64(y1, x1);
362 CRYPTOPP_INLINE
void SPECK128_Enc_6_Blocks(__m128i &block0, __m128i &block1,
363 __m128i &block2, __m128i &block3, __m128i &block4, __m128i &block5,
364 const word64 *subkeys,
unsigned int rounds)
367 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
368 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
369 __m128i x2 = _mm_unpackhi_epi64(block2, block3);
370 __m128i y2 = _mm_unpacklo_epi64(block2, block3);
371 __m128i x3 = _mm_unpackhi_epi64(block4, block5);
372 __m128i y3 = _mm_unpacklo_epi64(block4, block5);
374 for (
int i=0; i < static_cast<int>(rounds); ++i)
376 const __m128i rk = _mm_castpd_si128(
377 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
379 x1 = RotateRight64<8>(x1);
380 x2 = RotateRight64<8>(x2);
381 x3 = RotateRight64<8>(x3);
382 x1 = _mm_add_epi64(x1, y1);
383 x2 = _mm_add_epi64(x2, y2);
384 x3 = _mm_add_epi64(x3, y3);
385 x1 = _mm_xor_si128(x1, rk);
386 x2 = _mm_xor_si128(x2, rk);
387 x3 = _mm_xor_si128(x3, rk);
388 y1 = RotateLeft64<3>(y1);
389 y2 = RotateLeft64<3>(y2);
390 y3 = RotateLeft64<3>(y3);
391 y1 = _mm_xor_si128(y1, x1);
392 y2 = _mm_xor_si128(y2, x2);
393 y3 = _mm_xor_si128(y3, x3);
397 block0 = _mm_unpacklo_epi64(y1, x1);
398 block1 = _mm_unpackhi_epi64(y1, x1);
399 block2 = _mm_unpacklo_epi64(y2, x2);
400 block3 = _mm_unpackhi_epi64(y2, x2);
401 block4 = _mm_unpacklo_epi64(y3, x3);
402 block5 = _mm_unpackhi_epi64(y3, x3);
405 CRYPTOPP_INLINE
void SPECK128_Dec_Block(__m128i &block0, __m128i &block1,
406 const word64 *subkeys,
unsigned int rounds)
409 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
410 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
412 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
414 const __m128i rk = _mm_castpd_si128(
415 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
417 y1 = _mm_xor_si128(y1, x1);
418 y1 = RotateRight64<3>(y1);
419 x1 = _mm_xor_si128(x1, rk);
420 x1 = _mm_sub_epi64(x1, y1);
421 x1 = RotateLeft64<8>(x1);
425 block0 = _mm_unpacklo_epi64(y1, x1);
426 block1 = _mm_unpackhi_epi64(y1, x1);
429 CRYPTOPP_INLINE
void SPECK128_Dec_6_Blocks(__m128i &block0, __m128i &block1,
430 __m128i &block2, __m128i &block3, __m128i &block4, __m128i &block5,
431 const word64 *subkeys,
unsigned int rounds)
434 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
435 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
436 __m128i x2 = _mm_unpackhi_epi64(block2, block3);
437 __m128i y2 = _mm_unpacklo_epi64(block2, block3);
438 __m128i x3 = _mm_unpackhi_epi64(block4, block5);
439 __m128i y3 = _mm_unpacklo_epi64(block4, block5);
441 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
443 const __m128i rk = _mm_castpd_si128(
444 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
446 y1 = _mm_xor_si128(y1, x1);
447 y2 = _mm_xor_si128(y2, x2);
448 y3 = _mm_xor_si128(y3, x3);
449 y1 = RotateRight64<3>(y1);
450 y2 = RotateRight64<3>(y2);
451 y3 = RotateRight64<3>(y3);
452 x1 = _mm_xor_si128(x1, rk);
453 x2 = _mm_xor_si128(x2, rk);
454 x3 = _mm_xor_si128(x3, rk);
455 x1 = _mm_sub_epi64(x1, y1);
456 x2 = _mm_sub_epi64(x2, y2);
457 x3 = _mm_sub_epi64(x3, y3);
458 x1 = RotateLeft64<8>(x1);
459 x2 = RotateLeft64<8>(x2);
460 x3 = RotateLeft64<8>(x3);
464 block0 = _mm_unpacklo_epi64(y1, x1);
465 block1 = _mm_unpackhi_epi64(y1, x1);
466 block2 = _mm_unpacklo_epi64(y2, x2);
467 block3 = _mm_unpackhi_epi64(y2, x2);
468 block4 = _mm_unpacklo_epi64(y3, x3);
469 block5 = _mm_unpackhi_epi64(y3, x3);
472 #endif // CRYPTOPP_SSSE3_AVAILABLE 476 #if defined(CRYPTOPP_POWER8_AVAILABLE) 488 template<
unsigned int C>
492 return vec_rl(val, m);
496 template<
unsigned int C>
500 return vec_rl(val, m);
503 void SPECK128_Enc_Block(
uint32x4_p &block,
const word64 *subkeys,
unsigned int rounds)
505 #if (CRYPTOPP_BIG_ENDIAN) 506 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
507 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
509 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
510 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
517 for (
int i=0; i < static_cast<int>(rounds); ++i)
519 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
521 x1 = RotateRight64<8>(x1);
525 y1 = RotateLeft64<3>(y1);
529 #if (CRYPTOPP_BIG_ENDIAN) 530 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
533 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
541 void SPECK128_Dec_Block(
uint32x4_p &block,
const word64 *subkeys,
unsigned int rounds)
543 #if (CRYPTOPP_BIG_ENDIAN) 544 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
545 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
547 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
548 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
555 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
557 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
560 y1 = RotateRight64<3>(y1);
563 x1 = RotateLeft64<8>(x1);
566 #if (CRYPTOPP_BIG_ENDIAN) 567 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
570 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
580 uint32x4_p &block5,
const word64 *subkeys,
unsigned int rounds)
582 #if (CRYPTOPP_BIG_ENDIAN) 583 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
584 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
586 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
587 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
598 for (
int i=0; i < static_cast<int>(rounds); ++i)
600 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
602 x1 = RotateRight64<8>(x1);
603 x2 = RotateRight64<8>(x2);
604 x3 = RotateRight64<8>(x3);
612 y1 = RotateLeft64<3>(y1);
613 y2 = RotateLeft64<3>(y2);
614 y3 = RotateLeft64<3>(y3);
620 #if (CRYPTOPP_BIG_ENDIAN) 621 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
622 const uint8x16_p m4 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
624 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
625 const uint8x16_p m4 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
639 uint32x4_p &block5,
const word64 *subkeys,
unsigned int rounds)
641 #if (CRYPTOPP_BIG_ENDIAN) 642 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
643 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
645 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
646 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
657 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
659 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
664 y1 = RotateRight64<3>(y1);
665 y2 = RotateRight64<3>(y2);
666 y3 = RotateRight64<3>(y3);
674 x1 = RotateLeft64<8>(x1);
675 x2 = RotateLeft64<8>(x2);
676 x3 = RotateLeft64<8>(x3);
679 #if (CRYPTOPP_BIG_ENDIAN) 680 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
681 const uint8x16_p m4 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
683 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
684 const uint8x16_p m4 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
696 #endif // CRYPTOPP_POWER8_AVAILABLE 698 ANONYMOUS_NAMESPACE_END
706 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 707 size_t SPECK128_Enc_AdvancedProcessBlocks_NEON(
const word64* subKeys,
size_t rounds,
708 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
710 return AdvancedProcessBlocks128_6x2_NEON(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
711 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
714 size_t SPECK128_Dec_AdvancedProcessBlocks_NEON(
const word64* subKeys,
size_t rounds,
715 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
717 return AdvancedProcessBlocks128_6x2_NEON(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
718 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
720 #endif // CRYPTOPP_ARM_NEON_AVAILABLE 724 #if defined(CRYPTOPP_SSSE3_AVAILABLE) 725 size_t SPECK128_Enc_AdvancedProcessBlocks_SSSE3(
const word64* subKeys,
size_t rounds,
726 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
728 return AdvancedProcessBlocks128_6x2_SSE(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
729 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
732 size_t SPECK128_Dec_AdvancedProcessBlocks_SSSE3(
const word64* subKeys,
size_t rounds,
733 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
735 return AdvancedProcessBlocks128_6x2_SSE(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
736 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
738 #endif // CRYPTOPP_SSSE3_AVAILABLE 742 #if defined(CRYPTOPP_POWER8_AVAILABLE) 743 size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(
const word64* subKeys,
size_t rounds,
744 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
746 return AdvancedProcessBlocks128_6x1_ALTIVEC(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
747 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
750 size_t SPECK128_Dec_AdvancedProcessBlocks_POWER8(
const word64* subKeys,
size_t rounds,
751 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
753 return AdvancedProcessBlocks128_6x1_ALTIVEC(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
754 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
756 #endif // CRYPTOPP_POWER8_AVAILABLE Utility functions for the Crypto++ library.
T1 VecSub(const T1 vec1, const T2 vec2)
Subtract two vectors.
Library configuration file.
T1 VecAdd(const T1 vec1, const T2 vec2)
Add two vectors.
T1 VecPermute(const T1 vec, const T2 mask)
Permutes a vector.
__vector unsigned int uint32x4_p
Vector of 32-bit elements.
Support functions for PowerPC and vector operations.
Template for AdvancedProcessBlocks and SIMD processing.
Classes for the Speck block cipher.
T1 VecXor(const T1 vec1, const T2 vec2)
XOR two vectors.
__vector unsigned long long uint64x2_p
Vector of 64-bit elements.
Crypto++ library namespace.
__vector unsigned char uint8x16_p
Vector of 8-bit elements.