19 #if (CRYPTOPP_SSSE3_AVAILABLE) 21 # include <pmmintrin.h> 22 # include <tmmintrin.h> 26 # include <ammintrin.h> 29 #if defined(__AVX512F__) 30 # define CRYPTOPP_AVX512_ROTATE 1 31 # include <immintrin.h> 35 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 38 # include <arm_neon.h> 42 #if (CRYPTOPP_ARM_ACLE_AVAILABLE) 44 # include <arm_acle.h> 47 #if defined(CRYPTOPP_POWER8_AVAILABLE) 53 extern const char SPECK128_SIMD_FNAME[] = __FILE__;
55 ANONYMOUS_NAMESPACE_BEGIN
58 using CryptoPP::word32;
59 using CryptoPP::word64;
63 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 66 #if defined(_MSC_VER) && !defined(_M_ARM64) 67 inline uint64x2_t vld1q_dup_u64(
const uint64_t* ptr)
69 return vmovq_n_u64(*ptr);
74 inline T UnpackHigh64(
const T& a,
const T& b)
76 const uint64x1_t x(vget_high_u64((uint64x2_t)a));
77 const uint64x1_t y(vget_high_u64((uint64x2_t)b));
78 return (T)vcombine_u64(x, y);
82 inline T UnpackLow64(
const T& a,
const T& b)
84 const uint64x1_t x(vget_low_u64((uint64x2_t)a));
85 const uint64x1_t y(vget_low_u64((uint64x2_t)b));
86 return (T)vcombine_u64(x, y);
89 template <
unsigned int R>
90 inline uint64x2_t RotateLeft64(
const uint64x2_t& val)
92 const uint64x2_t a(vshlq_n_u64(val, R));
93 const uint64x2_t b(vshrq_n_u64(val, 64 - R));
94 return vorrq_u64(a, b);
97 template <
unsigned int R>
98 inline uint64x2_t RotateRight64(
const uint64x2_t& val)
100 const uint64x2_t a(vshlq_n_u64(val, 64 - R));
101 const uint64x2_t b(vshrq_n_u64(val, R));
102 return vorrq_u64(a, b);
105 #if defined(__aarch32__) || defined(__aarch64__) 108 inline uint64x2_t RotateLeft64<8>(
const uint64x2_t& val)
110 #if (CRYPTOPP_BIG_ENDIAN) 111 const uint8_t maskb[16] = { 14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7 };
112 const uint8x16_t mask = vld1q_u8(maskb);
114 const uint8_t maskb[16] = { 7,0,1,2, 3,4,5,6, 15,8,9,10, 11,12,13,14 };
115 const uint8x16_t mask = vld1q_u8(maskb);
118 return vreinterpretq_u64_u8(
119 vqtbl1q_u8(vreinterpretq_u8_u64(val), mask));
124 inline uint64x2_t RotateRight64<8>(
const uint64x2_t& val)
126 #if (CRYPTOPP_BIG_ENDIAN) 127 const uint8_t maskb[16] = { 8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1 };
128 const uint8x16_t mask = vld1q_u8(maskb);
130 const uint8_t maskb[16] = { 1,2,3,4, 5,6,7,0, 9,10,11,12, 13,14,15,8 };
131 const uint8x16_t mask = vld1q_u8(maskb);
134 return vreinterpretq_u64_u8(
135 vqtbl1q_u8(vreinterpretq_u8_u64(val), mask));
139 inline void SPECK128_Enc_Block(uint64x2_t &block0, uint64x2_t &block1,
140 const word64 *subkeys,
unsigned int rounds)
143 uint64x2_t x1 = UnpackHigh64(block0, block1);
144 uint64x2_t y1 = UnpackLow64(block0, block1);
146 for (
int i=0; i < static_cast<int>(rounds); ++i)
148 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
150 x1 = RotateRight64<8>(x1);
151 x1 = vaddq_u64(x1, y1);
152 x1 = veorq_u64(x1, rk);
153 y1 = RotateLeft64<3>(y1);
154 y1 = veorq_u64(y1, x1);
158 block0 = UnpackLow64(y1, x1);
159 block1 = UnpackHigh64(y1, x1);
162 inline void SPECK128_Enc_6_Blocks(uint64x2_t &block0, uint64x2_t &block1,
163 uint64x2_t &block2, uint64x2_t &block3, uint64x2_t &block4, uint64x2_t &block5,
164 const word64 *subkeys,
unsigned int rounds)
167 uint64x2_t x1 = UnpackHigh64(block0, block1);
168 uint64x2_t y1 = UnpackLow64(block0, block1);
169 uint64x2_t x2 = UnpackHigh64(block2, block3);
170 uint64x2_t y2 = UnpackLow64(block2, block3);
171 uint64x2_t x3 = UnpackHigh64(block4, block5);
172 uint64x2_t y3 = UnpackLow64(block4, block5);
174 for (
int i=0; i < static_cast<int>(rounds); ++i)
176 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
178 x1 = RotateRight64<8>(x1);
179 x2 = RotateRight64<8>(x2);
180 x3 = RotateRight64<8>(x3);
181 x1 = vaddq_u64(x1, y1);
182 x2 = vaddq_u64(x2, y2);
183 x3 = vaddq_u64(x3, y3);
184 x1 = veorq_u64(x1, rk);
185 x2 = veorq_u64(x2, rk);
186 x3 = veorq_u64(x3, rk);
187 y1 = RotateLeft64<3>(y1);
188 y2 = RotateLeft64<3>(y2);
189 y3 = RotateLeft64<3>(y3);
190 y1 = veorq_u64(y1, x1);
191 y2 = veorq_u64(y2, x2);
192 y3 = veorq_u64(y3, x3);
196 block0 = UnpackLow64(y1, x1);
197 block1 = UnpackHigh64(y1, x1);
198 block2 = UnpackLow64(y2, x2);
199 block3 = UnpackHigh64(y2, x2);
200 block4 = UnpackLow64(y3, x3);
201 block5 = UnpackHigh64(y3, x3);
204 inline void SPECK128_Dec_Block(uint64x2_t &block0, uint64x2_t &block1,
205 const word64 *subkeys,
unsigned int rounds)
208 uint64x2_t x1 = UnpackHigh64(block0, block1);
209 uint64x2_t y1 = UnpackLow64(block0, block1);
211 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
213 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
215 y1 = veorq_u64(y1, x1);
216 y1 = RotateRight64<3>(y1);
217 x1 = veorq_u64(x1, rk);
218 x1 = vsubq_u64(x1, y1);
219 x1 = RotateLeft64<8>(x1);
223 block0 = UnpackLow64(y1, x1);
224 block1 = UnpackHigh64(y1, x1);
227 inline void SPECK128_Dec_6_Blocks(uint64x2_t &block0, uint64x2_t &block1,
228 uint64x2_t &block2, uint64x2_t &block3, uint64x2_t &block4, uint64x2_t &block5,
229 const word64 *subkeys,
unsigned int rounds)
232 uint64x2_t x1 = UnpackHigh64(block0, block1);
233 uint64x2_t y1 = UnpackLow64(block0, block1);
234 uint64x2_t x2 = UnpackHigh64(block2, block3);
235 uint64x2_t y2 = UnpackLow64(block2, block3);
236 uint64x2_t x3 = UnpackHigh64(block4, block5);
237 uint64x2_t y3 = UnpackLow64(block4, block5);
239 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
241 const uint64x2_t rk = vld1q_dup_u64(subkeys+i);
243 y1 = veorq_u64(y1, x1);
244 y2 = veorq_u64(y2, x2);
245 y3 = veorq_u64(y3, x3);
246 y1 = RotateRight64<3>(y1);
247 y2 = RotateRight64<3>(y2);
248 y3 = RotateRight64<3>(y3);
249 x1 = veorq_u64(x1, rk);
250 x2 = veorq_u64(x2, rk);
251 x3 = veorq_u64(x3, rk);
252 x1 = vsubq_u64(x1, y1);
253 x2 = vsubq_u64(x2, y2);
254 x3 = vsubq_u64(x3, y3);
255 x1 = RotateLeft64<8>(x1);
256 x2 = RotateLeft64<8>(x2);
257 x3 = RotateLeft64<8>(x3);
261 block0 = UnpackLow64(y1, x1);
262 block1 = UnpackHigh64(y1, x1);
263 block2 = UnpackLow64(y2, x2);
264 block3 = UnpackHigh64(y2, x2);
265 block4 = UnpackLow64(y3, x3);
266 block5 = UnpackHigh64(y3, x3);
269 #endif // CRYPTOPP_ARM_NEON_AVAILABLE 273 #if defined(CRYPTOPP_SSSE3_AVAILABLE) 277 # define M128_CAST(x) ((__m128i *)(void *)(x)) 279 #ifndef CONST_M128_CAST 280 # define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x)) 285 # define DOUBLE_CAST(x) ((double *)(void *)(x)) 287 #ifndef CONST_DOUBLE_CAST 288 # define CONST_DOUBLE_CAST(x) ((const double *)(const void *)(x)) 291 template <
unsigned int R>
292 inline __m128i RotateLeft64(
const __m128i& val)
294 #if defined(CRYPTOPP_AVX512_ROTATE) 295 return _mm_rol_epi64(val, R);
296 #elif defined(__XOP__) 297 return _mm_roti_epi64(val, R);
300 _mm_slli_epi64(val, R), _mm_srli_epi64(val, 64-R));
304 template <
unsigned int R>
305 inline __m128i RotateRight64(
const __m128i& val)
307 #if defined(CRYPTOPP_AVX512_ROTATE) 308 return _mm_ror_epi64(val, R);
309 #elif defined(__XOP__) 310 return _mm_roti_epi64(val, 64-R);
313 _mm_slli_epi64(val, 64-R), _mm_srli_epi64(val, R));
319 __m128i RotateLeft64<8>(
const __m128i& val)
322 return _mm_roti_epi64(val, 8);
324 const __m128i mask = _mm_set_epi8(14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7);
325 return _mm_shuffle_epi8(val, mask);
331 __m128i RotateRight64<8>(
const __m128i& val)
334 return _mm_roti_epi64(val, 64-8);
336 const __m128i mask = _mm_set_epi8(8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1);
337 return _mm_shuffle_epi8(val, mask);
341 inline void SPECK128_Enc_Block(__m128i &block0, __m128i &block1,
342 const word64 *subkeys,
unsigned int rounds)
345 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
346 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
348 for (
int i=0; i < static_cast<int>(rounds); ++i)
350 const __m128i rk = _mm_castpd_si128(
351 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
353 x1 = RotateRight64<8>(x1);
354 x1 = _mm_add_epi64(x1, y1);
355 x1 = _mm_xor_si128(x1, rk);
356 y1 = RotateLeft64<3>(y1);
357 y1 = _mm_xor_si128(y1, x1);
361 block0 = _mm_unpacklo_epi64(y1, x1);
362 block1 = _mm_unpackhi_epi64(y1, x1);
365 inline void SPECK128_Enc_6_Blocks(__m128i &block0, __m128i &block1,
366 __m128i &block2, __m128i &block3, __m128i &block4, __m128i &block5,
367 const word64 *subkeys,
unsigned int rounds)
370 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
371 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
372 __m128i x2 = _mm_unpackhi_epi64(block2, block3);
373 __m128i y2 = _mm_unpacklo_epi64(block2, block3);
374 __m128i x3 = _mm_unpackhi_epi64(block4, block5);
375 __m128i y3 = _mm_unpacklo_epi64(block4, block5);
377 for (
int i=0; i < static_cast<int>(rounds); ++i)
379 const __m128i rk = _mm_castpd_si128(
380 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
382 x1 = RotateRight64<8>(x1);
383 x2 = RotateRight64<8>(x2);
384 x3 = RotateRight64<8>(x3);
385 x1 = _mm_add_epi64(x1, y1);
386 x2 = _mm_add_epi64(x2, y2);
387 x3 = _mm_add_epi64(x3, y3);
388 x1 = _mm_xor_si128(x1, rk);
389 x2 = _mm_xor_si128(x2, rk);
390 x3 = _mm_xor_si128(x3, rk);
391 y1 = RotateLeft64<3>(y1);
392 y2 = RotateLeft64<3>(y2);
393 y3 = RotateLeft64<3>(y3);
394 y1 = _mm_xor_si128(y1, x1);
395 y2 = _mm_xor_si128(y2, x2);
396 y3 = _mm_xor_si128(y3, x3);
400 block0 = _mm_unpacklo_epi64(y1, x1);
401 block1 = _mm_unpackhi_epi64(y1, x1);
402 block2 = _mm_unpacklo_epi64(y2, x2);
403 block3 = _mm_unpackhi_epi64(y2, x2);
404 block4 = _mm_unpacklo_epi64(y3, x3);
405 block5 = _mm_unpackhi_epi64(y3, x3);
408 inline void SPECK128_Dec_Block(__m128i &block0, __m128i &block1,
409 const word64 *subkeys,
unsigned int rounds)
412 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
413 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
415 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
417 const __m128i rk = _mm_castpd_si128(
418 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
420 y1 = _mm_xor_si128(y1, x1);
421 y1 = RotateRight64<3>(y1);
422 x1 = _mm_xor_si128(x1, rk);
423 x1 = _mm_sub_epi64(x1, y1);
424 x1 = RotateLeft64<8>(x1);
428 block0 = _mm_unpacklo_epi64(y1, x1);
429 block1 = _mm_unpackhi_epi64(y1, x1);
432 inline void SPECK128_Dec_6_Blocks(__m128i &block0, __m128i &block1,
433 __m128i &block2, __m128i &block3, __m128i &block4, __m128i &block5,
434 const word64 *subkeys,
unsigned int rounds)
437 __m128i x1 = _mm_unpackhi_epi64(block0, block1);
438 __m128i y1 = _mm_unpacklo_epi64(block0, block1);
439 __m128i x2 = _mm_unpackhi_epi64(block2, block3);
440 __m128i y2 = _mm_unpacklo_epi64(block2, block3);
441 __m128i x3 = _mm_unpackhi_epi64(block4, block5);
442 __m128i y3 = _mm_unpacklo_epi64(block4, block5);
444 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
446 const __m128i rk = _mm_castpd_si128(
447 _mm_loaddup_pd(CONST_DOUBLE_CAST(subkeys+i)));
449 y1 = _mm_xor_si128(y1, x1);
450 y2 = _mm_xor_si128(y2, x2);
451 y3 = _mm_xor_si128(y3, x3);
452 y1 = RotateRight64<3>(y1);
453 y2 = RotateRight64<3>(y2);
454 y3 = RotateRight64<3>(y3);
455 x1 = _mm_xor_si128(x1, rk);
456 x2 = _mm_xor_si128(x2, rk);
457 x3 = _mm_xor_si128(x3, rk);
458 x1 = _mm_sub_epi64(x1, y1);
459 x2 = _mm_sub_epi64(x2, y2);
460 x3 = _mm_sub_epi64(x3, y3);
461 x1 = RotateLeft64<8>(x1);
462 x2 = RotateLeft64<8>(x2);
463 x3 = RotateLeft64<8>(x3);
467 block0 = _mm_unpacklo_epi64(y1, x1);
468 block1 = _mm_unpackhi_epi64(y1, x1);
469 block2 = _mm_unpacklo_epi64(y2, x2);
470 block3 = _mm_unpackhi_epi64(y2, x2);
471 block4 = _mm_unpacklo_epi64(y3, x3);
472 block5 = _mm_unpackhi_epi64(y3, x3);
475 #endif // CRYPTOPP_SSSE3_AVAILABLE 479 #if defined(CRYPTOPP_POWER8_AVAILABLE) 491 template<
unsigned int C>
495 return vec_rl(val, m);
499 template<
unsigned int C>
503 return vec_rl(val, m);
506 void SPECK128_Enc_Block(
uint32x4_p &block,
const word64 *subkeys,
unsigned int rounds)
508 #if (CRYPTOPP_BIG_ENDIAN) 509 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
510 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
512 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
513 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
520 for (
int i=0; i < static_cast<int>(rounds); ++i)
522 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
524 x1 = RotateRight64<8>(x1);
528 y1 = RotateLeft64<3>(y1);
532 #if (CRYPTOPP_BIG_ENDIAN) 533 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
536 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
544 void SPECK128_Dec_Block(
uint32x4_p &block,
const word64 *subkeys,
unsigned int rounds)
546 #if (CRYPTOPP_BIG_ENDIAN) 547 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
548 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
550 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
551 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
558 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
560 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
563 y1 = RotateRight64<3>(y1);
566 x1 = RotateLeft64<8>(x1);
569 #if (CRYPTOPP_BIG_ENDIAN) 570 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
573 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
583 uint32x4_p &block5,
const word64 *subkeys,
unsigned int rounds)
585 #if (CRYPTOPP_BIG_ENDIAN) 586 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
587 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
589 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
590 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
601 for (
int i=0; i < static_cast<int>(rounds); ++i)
603 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
605 x1 = RotateRight64<8>(x1);
606 x2 = RotateRight64<8>(x2);
607 x3 = RotateRight64<8>(x3);
615 y1 = RotateLeft64<3>(y1);
616 y2 = RotateLeft64<3>(y2);
617 y3 = RotateLeft64<3>(y3);
623 #if (CRYPTOPP_BIG_ENDIAN) 624 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
625 const uint8x16_p m4 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
627 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
628 const uint8x16_p m4 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
642 uint32x4_p &block5,
const word64 *subkeys,
unsigned int rounds)
644 #if (CRYPTOPP_BIG_ENDIAN) 645 const uint8x16_p m1 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
646 const uint8x16_p m2 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
648 const uint8x16_p m1 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
649 const uint8x16_p m2 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
660 for (
int i = static_cast<int>(rounds-1); i >= 0; --i)
662 const uint64x2_p rk = vec_splats((
unsigned long long)subkeys[i]);
667 y1 = RotateRight64<3>(y1);
668 y2 = RotateRight64<3>(y2);
669 y3 = RotateRight64<3>(y3);
677 x1 = RotateLeft64<8>(x1);
678 x2 = RotateLeft64<8>(x2);
679 x3 = RotateLeft64<8>(x3);
682 #if (CRYPTOPP_BIG_ENDIAN) 683 const uint8x16_p m3 = {31,30,29,28,27,26,25,24, 15,14,13,12,11,10,9,8};
684 const uint8x16_p m4 = {23,22,21,20,19,18,17,16, 7,6,5,4,3,2,1,0};
686 const uint8x16_p m3 = {7,6,5,4,3,2,1,0, 23,22,21,20,19,18,17,16};
687 const uint8x16_p m4 = {15,14,13,12,11,10,9,8, 31,30,29,28,27,26,25,24};
699 #endif // CRYPTOPP_POWER8_AVAILABLE 701 ANONYMOUS_NAMESPACE_END
709 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 710 size_t SPECK128_Enc_AdvancedProcessBlocks_NEON(
const word64* subKeys,
size_t rounds,
711 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
713 return AdvancedProcessBlocks128_6x2_NEON(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
714 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
717 size_t SPECK128_Dec_AdvancedProcessBlocks_NEON(
const word64* subKeys,
size_t rounds,
718 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
720 return AdvancedProcessBlocks128_6x2_NEON(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
721 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
723 #endif // CRYPTOPP_ARM_NEON_AVAILABLE 727 #if defined(CRYPTOPP_SSSE3_AVAILABLE) 728 size_t SPECK128_Enc_AdvancedProcessBlocks_SSSE3(
const word64* subKeys,
size_t rounds,
729 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
731 return AdvancedProcessBlocks128_6x2_SSE(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
732 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
735 size_t SPECK128_Dec_AdvancedProcessBlocks_SSSE3(
const word64* subKeys,
size_t rounds,
736 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
738 return AdvancedProcessBlocks128_6x2_SSE(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
739 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
741 #endif // CRYPTOPP_SSSE3_AVAILABLE 745 #if defined(CRYPTOPP_POWER8_AVAILABLE) 746 size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(
const word64* subKeys,
size_t rounds,
747 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
749 return AdvancedProcessBlocks128_6x1_ALTIVEC(SPECK128_Enc_Block, SPECK128_Enc_6_Blocks,
750 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
753 size_t SPECK128_Dec_AdvancedProcessBlocks_POWER8(
const word64* subKeys,
size_t rounds,
754 const byte *inBlocks,
const byte *xorBlocks, byte *outBlocks,
size_t length, word32 flags)
756 return AdvancedProcessBlocks128_6x1_ALTIVEC(SPECK128_Dec_Block, SPECK128_Dec_6_Blocks,
757 subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
759 #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.