Crypto++  7.0
Free C++ class library of cryptographic schemes
ppc-simd.h
Go to the documentation of this file.
1 // ppc-simd.h - written and placed in public domain by Jeffrey Walton
2 
3 /// \file ppc-simd.h
4 /// \brief Support functions for PowerPC and vector operations
5 /// \details This header provides an agnostic interface into GCC and
6 /// IBM XL C/C++ compilers modulo their different built-in functions
7 /// for accessing vector intructions.
8 /// \details The abstractions are necesssary to support back to GCC 4.8.
9 /// GCC 4.8 and 4.9 are still popular, and they are the default
10 /// compiler for GCC112, GCC118 and others on the compile farm. Older
11 /// IBM XL C/C++ compilers also experience it due to lack of
12 /// <tt>vec_xl_be</tt> support on some platforms. Modern compilers
13 /// provide best support and don't need many of the little hacks below.
14 /// \since Crypto++ 6.0
15 
16 #ifndef CRYPTOPP_PPC_CRYPTO_H
17 #define CRYPTOPP_PPC_CRYPTO_H
18 
19 #include "config.h"
20 #include "misc.h"
21 
22 #if defined(CRYPTOPP_ALTIVEC_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
23 # include <altivec.h>
24 # undef vector
25 # undef pixel
26 # undef bool
27 #endif
28 
29 NAMESPACE_BEGIN(CryptoPP)
30 
31 #if defined(CRYPTOPP_ALTIVEC_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
32 
33 typedef __vector unsigned char uint8x16_p;
34 typedef __vector unsigned short uint16x8_p;
35 typedef __vector unsigned int uint32x4_p;
36 
37 #if defined(CRYPTOPP_POWER8_AVAILABLE)
38 typedef __vector unsigned long long uint64x2_p;
39 #endif
40 
41 #endif // CRYPTOPP_ALTIVEC_AVAILABLE
42 
43 #if defined(CRYPTOPP_ALTIVEC_AVAILABLE) && !defined(CRYPTOPP_POWER7_AVAILABLE)
44 
45 inline uint32x4_p VectorLoad(const byte src[16])
46 {
47  uint8x16_p data;
48  if (IsAlignedOn(src, 16))
49  {
50  data = vec_ld(0, src);
51  }
52  else
53  {
54  // http://www.nxp.com/docs/en/reference-manual/ALTIVECPEM.pdf
55  const uint8x16_p perm = vec_lvsl(0, src);
56  const uint8x16_p low = vec_ld(0, src);
57  const uint8x16_p high = vec_ld(15, src);
58  data = vec_perm(low, high, perm);
59  }
60 
61 #if defined(CRYPTOPP_BIG_ENDIAN)
62  return (uint32x4_p)data;
63 #else
64  const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0};
65  return (uint32x4_p)vec_perm(data, data, mask);
66 #endif
67 }
68 
69 inline void VectorStore(const uint32x4_p data, byte dest[16])
70 {
71 #if defined(CRYPTOPP_LITTLE_ENDIAN)
72  const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0};
73  const uint8x16_p t1 = (uint8x16_p)vec_perm(data, data, mask);
74 #else
75  const uint8x16_p t1 = (uint8x16_p)data;
76 #endif
77 
78  if (IsAlignedOn(dest, 16))
79  {
80  vec_st(t1, 0, dest);
81  }
82  else
83  {
84  // http://www.nxp.com/docs/en/reference-manual/ALTIVECPEM.pdf
85  const uint8x16_p t2 = vec_perm(t1, t1, vec_lvsr(0, dest));
86  vec_ste((uint8x16_p) t2, 0, (unsigned char*) dest);
87  vec_ste((uint16x8_p) t2, 1, (unsigned short*)dest);
88  vec_ste((uint32x4_p) t2, 3, (unsigned int*) dest);
89  vec_ste((uint32x4_p) t2, 4, (unsigned int*) dest);
90  vec_ste((uint32x4_p) t2, 8, (unsigned int*) dest);
91  vec_ste((uint32x4_p) t2, 12, (unsigned int*) dest);
92  vec_ste((uint16x8_p) t2, 14, (unsigned short*)dest);
93  vec_ste((uint8x16_p) t2, 15, (unsigned char*) dest);
94  }
95 }
96 
97 inline uint32x4_p VectorXor(const uint32x4_p vec1, const uint32x4_p vec2)
98 {
99  return vec_xor(vec1, vec2);
100 }
101 
102 inline uint32x4_p VectorAdd(const uint32x4_p vec1, const uint32x4_p vec2)
103 {
104  return vec_add(vec1, vec2);
105 }
106 
107 #endif
108 
109 #if defined(CRYPTOPP_POWER7_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
110 
111 /// \brief Reverse a 16-byte array
112 /// \param src the byte array
113 /// \details ReverseByteArrayLE reverses a 16-byte array on a little endian
114 /// system. It does nothing on a big endian system.
115 /// \since Crypto++ 6.0
116 inline void ReverseByteArrayLE(byte src[16])
117 {
118 #if defined(CRYPTOPP_XLC_VERSION) && defined(CRYPTOPP_LITTLE_ENDIAN)
119  vec_st(vec_reve(vec_ld(0, src)), 0, src);
120 #elif defined(CRYPTOPP_LITTLE_ENDIAN)
121  const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0};
122  const uint8x16_p zero = {0};
123  vec_vsx_st(vec_perm(vec_vsx_ld(0, src), zero, mask), 0, src);
124 #endif
125 }
126 
127 /// \brief Reverse a vector
128 /// \tparam T vector type
129 /// \param src the vector
130 /// \details Reverse() endian swaps the bytes in a vector
131 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
132 /// \since Crypto++ 6.0
133 template <class T>
134 inline T Reverse(const T& src)
135 {
136  const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0};
137  return vec_perm(src, src, mask);
138 }
139 
140 /// \brief Loads a vector from a byte array
141 /// \param src the byte array
142 /// \details Loads a vector in big endian format from a byte array.
143 /// VectorLoadBE will swap endianess on little endian systems.
144 /// \note VectorLoadBE() does not require an aligned array.
145 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
146 /// \since Crypto++ 6.0
147 inline uint32x4_p VectorLoadBE(const uint8_t src[16])
148 {
149 #if defined(CRYPTOPP_XLC_VERSION)
150  return (uint32x4_p)vec_xl_be(0, src);
151 #else
152 # if defined(CRYPTOPP_LITTLE_ENDIAN)
153  return (uint32x4_p)Reverse(vec_vsx_ld(0, src));
154 # else
155  return (uint32x4_p)vec_vsx_ld(0, src);
156 # endif
157 #endif
158 }
159 
160 /// \brief Loads a vector from a byte array
161 /// \param src the byte array
162 /// \param off offset into the src byte array
163 /// \details Loads a vector in big endian format from a byte array.
164 /// VectorLoadBE will swap endianess on little endian systems.
165 /// \note VectorLoadBE does not require an aligned array.
166 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
167 /// \since Crypto++ 6.0
168 inline uint32x4_p VectorLoadBE(int off, const uint8_t src[16])
169 {
170 #if defined(CRYPTOPP_XLC_VERSION)
171  return (uint32x4_p)vec_xl_be(off, src);
172 #else
173 # if defined(CRYPTOPP_LITTLE_ENDIAN)
174  return (uint32x4_p)Reverse(vec_vsx_ld(off, src));
175 # else
176  return (uint32x4_p)vec_vsx_ld(off, src);
177 # endif
178 #endif
179 }
180 
181 /// \brief Loads a vector from a byte array
182 /// \param src the byte array
183 /// \details Loads a vector in big endian format from a byte array.
184 /// VectorLoad will swap endianess on little endian systems.
185 /// \note VectorLoad does not require an aligned array.
186 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
187 /// \since Crypto++ 6.0
188 inline uint32x4_p VectorLoad(const byte src[16])
189 {
190  return (uint32x4_p)VectorLoadBE(src);
191 }
192 
193 /// \brief Loads a vector from a byte array
194 /// \param src the byte array
195 /// \param off offset into the src byte array
196 /// \details Loads a vector in big endian format from a byte array.
197 /// VectorLoad will swap endianess on little endian systems.
198 /// \note VectorLoad does not require an aligned array.
199 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
200 /// \since Crypto++ 6.0
201 inline uint32x4_p VectorLoad(int off, const byte src[16])
202 {
203  return (uint32x4_p)VectorLoadBE(off, src);
204 }
205 
206 /// \brief Loads a vector from a byte array
207 /// \param src the byte array
208 /// \details Loads a vector from a byte array.
209 /// VectorLoadKey does not swap endianess on little endian systems.
210 /// \note VectorLoadKey does not require an aligned array.
211 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
212 /// \since Crypto++ 6.0
213 inline uint32x4_p VectorLoadKey(const byte src[16])
214 {
215 #if defined(CRYPTOPP_XLC_VERSION)
216  return (uint32x4_p)vec_xl(0, src);
217 #else
218  return (uint32x4_p)vec_vsx_ld(0, src);
219 #endif
220 }
221 
222 /// \brief Loads a vector from a 32-bit word array
223 /// \param src the 32-bit word array
224 /// \details Loads a vector from a 32-bit word array.
225 /// VectorLoadKey does not swap endianess on little endian systems.
226 /// \note VectorLoadKey does not require an aligned array.
227 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
228 /// \since Crypto++ 6.0
229 inline uint32x4_p VectorLoadKey(const word32 src[4])
230 {
231 #if defined(CRYPTOPP_XLC_VERSION)
232  return (uint32x4_p)vec_xl(0, src);
233 #else
234  return (uint32x4_p)vec_vsx_ld(0, src);
235 #endif
236 }
237 
238 /// \brief Loads a vector from a byte array
239 /// \param src the byte array
240 /// \param off offset into the src byte array
241 /// \details Loads a vector from a byte array.
242 /// VectorLoadKey does not swap endianess on little endian systems.
243 /// \note VectorLoadKey does not require an aligned array.
244 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
245 /// \since Crypto++ 6.0
246 inline uint32x4_p VectorLoadKey(int off, const byte src[16])
247 {
248 #if defined(CRYPTOPP_XLC_VERSION)
249  return (uint32x4_p)vec_xl(off, src);
250 #else
251  return (uint32x4_p)vec_vsx_ld(off, src);
252 #endif
253 }
254 
255 /// \brief Stores a vector to a byte array
256 /// \tparam T vector type
257 /// \param src the vector
258 /// \param dest the byte array
259 /// \details Stores a vector in big endian format to a byte array.
260 /// VectorStoreBE will swap endianess on little endian systems.
261 /// \note VectorStoreBE does not require an aligned array.
262 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
263 /// \since Crypto++ 6.0
264 template <class T>
265 inline void VectorStoreBE(const T& src, uint8_t dest[16])
266 {
267 #if defined(CRYPTOPP_XLC_VERSION)
268  vec_xst_be((uint8x16_p)src, 0, dest);
269 #else
270 # if defined(CRYPTOPP_LITTLE_ENDIAN)
271  vec_vsx_st(Reverse((uint8x16_p)src), 0, dest);
272 # else
273  vec_vsx_st((uint8x16_p)src, 0, dest);
274 # endif
275 #endif
276 }
277 /// \brief Stores a vector to a byte array
278 /// \tparam T vector type
279 /// \param src the vector
280 /// \param off offset into the dest byte array
281 /// \param dest the byte array
282 /// \details Stores a vector in big endian format to a byte array.
283 /// VectorStoreBE will swap endianess on little endian systems.
284 /// \note VectorStoreBE does not require an aligned array.
285 /// \sa Reverse(), VectorLoadBE(), VectorLoad(), VectorLoadKey()
286 /// \since Crypto++ 6.0
287 template <class T>
288 inline void VectorStoreBE(const T& src, int off, uint8_t dest[16])
289 {
290 #if defined(CRYPTOPP_XLC_VERSION)
291  vec_xst_be((uint8x16_p)src, off, dest);
292 #else
293 # if defined(CRYPTOPP_LITTLE_ENDIAN)
294  vec_vsx_st(Reverse((uint8x16_p)src), off, dest);
295 # else
296  vec_vsx_st((uint8x16_p)src, off, dest);
297 # endif
298 #endif
299 }
300 
301 /// \brief Stores a vector to a byte array
302 /// \tparam T vector type
303 /// \param src the vector
304 /// \param dest the byte array
305 /// \details Stores a vector in big endian format to a byte array.
306 /// VectorStore will swap endianess on little endian systems.
307 /// \note VectorStore does not require an aligned array.
308 /// \since Crypto++ 6.0
309 template<class T>
310 inline void VectorStore(const T& src, byte dest[16])
311 {
312  // Do not call VectorStoreBE. It slows us down by about 0.5 cpb on LE.
313 #if defined(CRYPTOPP_XLC_VERSION)
314  vec_xst_be((uint8x16_p)src, 0, dest);
315 #else
316 # if defined(CRYPTOPP_LITTLE_ENDIAN)
317  vec_vsx_st(Reverse((uint8x16_p)src), 0, dest);
318 # else
319  vec_vsx_st((uint8x16_p)src, 0, dest);
320 # endif
321 #endif
322 }
323 
324 /// \brief Stores a vector to a byte array
325 /// \tparam T vector type
326 /// \param src the vector
327 /// \param off offset into the dest byte array
328 /// \param dest the byte array
329 /// \details Stores a vector in big endian format to a byte array.
330 /// VectorStore will swap endianess on little endian systems.
331 /// \note VectorStore does not require an aligned array.
332 /// \since Crypto++ 6.0
333 template<class T>
334 inline void VectorStore(const T& src, int off, byte dest[16])
335 {
336  // Do not call VectorStoreBE. It slows us down by about 0.5 cpb on LE.
337 #if defined(CRYPTOPP_XLC_VERSION)
338  vec_xst_be((uint8x16_p)src, off, dest);
339 #else
340 # if defined(CRYPTOPP_LITTLE_ENDIAN)
341  vec_vsx_st(Reverse((uint8x16_p)src), off, dest);
342 # else
343  vec_vsx_st((uint8x16_p)src, off, dest);
344 # endif
345 #endif
346 }
347 
348 /// \brief Permutes two vectors
349 /// \tparam T1 vector type
350 /// \tparam T2 vector type
351 /// \param vec1 the first vector
352 /// \param vec2 the second vector
353 /// \param mask vector mask
354 /// \details VectorPermute returns a new vector from vec1 and vec2
355 /// based on mask. mask is an uint8x16_p type vector. The return
356 /// vector is the same type as vec1.
357 /// \since Crypto++ 6.0
358 template <class T1, class T2>
359 inline T1 VectorPermute(const T1& vec1, const T1& vec2, const T2& mask)
360 {
361  return (T1)vec_perm(vec1, vec2, (uint8x16_p)mask);
362 }
363 
364 /// \brief XOR two vectors
365 /// \tparam T1 vector type
366 /// \tparam T2 vector type
367 /// \param vec1 the first vector
368 /// \param vec2 the second vector
369 /// \details VectorXor returns a new vector from vec1 and vec2. The return
370 /// vector is the same type as vec1.
371 /// \since Crypto++ 6.0
372 template <class T1, class T2>
373 inline T1 VectorXor(const T1& vec1, const T2& vec2)
374 {
375  return (T1)vec_xor(vec1, (T1)vec2);
376 }
377 
378 /// \brief Add two vector
379 /// \tparam T1 vector type
380 /// \tparam T2 vector type
381 /// \param vec1 the first vector
382 /// \param vec2 the second vector
383 /// \details VectorAdd returns a new vector from vec1 and vec2.
384 /// vec2 is cast to the same type as vec1. The return vector
385 /// is the same type as vec1.
386 /// \since Crypto++ 6.0
387 template <class T1, class T2>
388 inline T1 VectorAdd(const T1& vec1, const T2& vec2)
389 {
390  return (T1)vec_add(vec1, (T1)vec2);
391 }
392 
393 /// \brief Shift two vectors left
394 /// \tparam C shift byte count
395 /// \tparam T1 vector type
396 /// \tparam T2 vector type
397 /// \param vec1 the first vector
398 /// \param vec2 the second vector
399 /// \details VectorShiftLeft() concatenates vec1 and vec2 and returns a
400 /// new vector after shifting the concatenation by the specified number
401 /// of bytes. Both vec1 and vec2 are cast to uint8x16_p. The return
402 /// vector is the same type as vec1.
403 /// \details On big endian machines VectorShiftLeft() is <tt>vec_sld(a, b,
404 /// c)</tt>. On little endian machines VectorShiftLeft() is translated to
405 /// <tt>vec_sld(b, a, 16-c)</tt>. You should always call the function as
406 /// if on a big endian machine as shown below.
407 /// <pre>
408 /// uint8x16_p r0 = {0};
409 /// uint8x16_p r1 = VectorLoad(ptr);
410 /// uint8x16_p r5 = VectorShiftLeft<12>(r0, r1);
411 /// </pre>
412 /// \sa <A HREF="https://stackoverflow.com/q/46341923/608639">Is vec_sld
413 /// endian sensitive?</A> on Stack Overflow
414 /// \since Crypto++ 6.0
415 template <unsigned int C, class T1, class T2>
416 inline T1 VectorShiftLeft(const T1& vec1, const T2& vec2)
417 {
418 #if defined(CRYPTOPP_LITTLE_ENDIAN)
419  return (T1)vec_sld((uint8x16_p)vec2, (uint8x16_p)vec1, 16-C);
420 #else
421  return (T1)vec_sld((uint8x16_p)vec1, (uint8x16_p)vec2, C);
422 #endif
423 }
424 
425 #endif // CRYPTOPP_POWER7_AVAILABLE
426 
427 #if defined(CRYPTOPP_POWER8_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
428 
429 /// \brief One round of AES encryption
430 /// \tparam T1 vector type
431 /// \tparam T2 vector type
432 /// \param state the state vector
433 /// \param key the subkey vector
434 /// \details VectorEncrypt performs one round of AES encryption of state
435 /// using subkey key. The return vector is the same type as vec1.
436 /// \since Crypto++ 6.0
437 template <class T1, class T2>
438 inline T1 VectorEncrypt(const T1& state, const T2& key)
439 {
440 #if defined(CRYPTOPP_XLC_VERSION)
441  return (T1)__vcipher((uint8x16_p)state, (uint8x16_p)key);
442 #elif defined(CRYPTOPP_GCC_VERSION)
443  return (T1)__builtin_crypto_vcipher((uint64x2_p)state, (uint64x2_p)key);
444 #else
445  CRYPTOPP_ASSERT(0);
446 #endif
447 }
448 
449 /// \brief Final round of AES encryption
450 /// \tparam T1 vector type
451 /// \tparam T2 vector type
452 /// \param state the state vector
453 /// \param key the subkey vector
454 /// \details VectorEncryptLast performs the final round of AES encryption
455 /// of state using subkey key. The return vector is the same type as vec1.
456 /// \since Crypto++ 6.0
457 template <class T1, class T2>
458 inline T1 VectorEncryptLast(const T1& state, const T2& key)
459 {
460 #if defined(CRYPTOPP_XLC_VERSION)
461  return (T1)__vcipherlast((uint8x16_p)state, (uint8x16_p)key);
462 #elif defined(CRYPTOPP_GCC_VERSION)
463  return (T1)__builtin_crypto_vcipherlast((uint64x2_p)state, (uint64x2_p)key);
464 #else
465  CRYPTOPP_ASSERT(0);
466 #endif
467 }
468 
469 /// \brief One round of AES decryption
470 /// \tparam T1 vector type
471 /// \tparam T2 vector type
472 /// \param state the state vector
473 /// \param key the subkey vector
474 /// \details VectorDecrypt performs one round of AES decryption of state
475 /// using subkey key. The return vector is the same type as vec1.
476 /// \since Crypto++ 6.0
477 template <class T1, class T2>
478 inline T1 VectorDecrypt(const T1& state, const T2& key)
479 {
480 #if defined(CRYPTOPP_XLC_VERSION)
481  return (T1)__vncipher((uint8x16_p)state, (uint8x16_p)key);
482 #elif defined(CRYPTOPP_GCC_VERSION)
483  return (T1)__builtin_crypto_vncipher((uint64x2_p)state, (uint64x2_p)key);
484 #else
485  CRYPTOPP_ASSERT(0);
486 #endif
487 }
488 
489 /// \brief Final round of AES decryption
490 /// \tparam T1 vector type
491 /// \tparam T2 vector type
492 /// \param state the state vector
493 /// \param key the subkey vector
494 /// \details VectorDecryptLast performs the final round of AES decryption
495 /// of state using subkey key. The return vector is the same type as vec1.
496 /// \since Crypto++ 6.0
497 template <class T1, class T2>
498 inline T1 VectorDecryptLast(const T1& state, const T2& key)
499 {
500 #if defined(CRYPTOPP_XLC_VERSION)
501  return (T1)__vncipherlast((uint8x16_p)state, (uint8x16_p)key);
502 #elif defined(CRYPTOPP_GCC_VERSION)
503  return (T1)__builtin_crypto_vncipherlast((uint64x2_p)state, (uint64x2_p)key);
504 #else
505  CRYPTOPP_ASSERT(0);
506 #endif
507 }
508 
509 /// \brief SHA256 Sigma functions
510 /// \tparam func function
511 /// \tparam subfunc sub-function
512 /// \tparam T vector type
513 /// \param vec the block to transform
514 /// \details VectorSHA256 selects sigma0, sigma1, Sigma0, Sigma1 based on
515 /// func and subfunc. The return vector is the same type as vec.
516 /// \since Crypto++ 6.0
517 template <int func, int subfunc, class T>
518 inline T VectorSHA256(const T& vec)
519 {
520 #if defined(CRYPTOPP_XLC_VERSION)
521  return (T)__vshasigmaw((uint32x4_p)vec, func, subfunc);
522 #elif defined(CRYPTOPP_GCC_VERSION)
523  return (T)__builtin_crypto_vshasigmaw((uint32x4_p)vec, func, subfunc);
524 #else
525  CRYPTOPP_ASSERT(0);
526 #endif
527 }
528 
529 /// \brief SHA512 Sigma functions
530 /// \tparam func function
531 /// \tparam subfunc sub-function
532 /// \tparam T vector type
533 /// \param vec the block to transform
534 /// \details VectorSHA512 selects sigma0, sigma1, Sigma0, Sigma1 based on
535 /// func and subfunc. The return vector is the same type as vec.
536 /// \since Crypto++ 6.0
537 template <int func, int subfunc, class T>
538 inline T VectorSHA512(const T& vec)
539 {
540 #if defined(CRYPTOPP_XLC_VERSION)
541  return (T)__vshasigmad((uint64x2_p)vec, func, subfunc);
542 #elif defined(CRYPTOPP_GCC_VERSION)
543  return (T)__builtin_crypto_vshasigmad((uint64x2_p)vec, func, subfunc);
544 #else
545  CRYPTOPP_ASSERT(0);
546 #endif
547 }
548 
549 #endif // CRYPTOPP_POWER8_AVAILABLE
550 
551 NAMESPACE_END
552 
553 #endif // CRYPTOPP_PPC_CRYPTO_H
T1 VectorEncrypt(const T1 &state, const T2 &key)
One round of AES encryption.
Definition: ppc-simd.h:438
Utility functions for the Crypto++ library.
T1 VectorShiftLeft(const T1 &vec1, const T2 &vec2)
Shift two vectors left.
Definition: ppc-simd.h:416
void VectorStoreBE(const T &src, uint8_t dest[16])
Stores a vector to a byte array.
Definition: ppc-simd.h:265
T1 VectorEncryptLast(const T1 &state, const T2 &key)
Final round of AES encryption.
Definition: ppc-simd.h:458
Library configuration file.
T1 VectorDecryptLast(const T1 &state, const T2 &key)
Final round of AES decryption.
Definition: ppc-simd.h:498
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
Definition: misc.h:1030
T VectorSHA256(const T &vec)
SHA256 Sigma functions.
Definition: ppc-simd.h:518
T Reverse(const T &src)
Reverse a vector.
Definition: ppc-simd.h:134
T1 VectorAdd(const T1 &vec1, const T2 &vec2)
Add two vector.
Definition: ppc-simd.h:388
void ReverseByteArrayLE(byte src[16])
Reverse a 16-byte array.
Definition: ppc-simd.h:116
uint32x4_p VectorLoad(const byte src[16])
Loads a vector from a byte array.
Definition: ppc-simd.h:188
uint32x4_p VectorLoadKey(const byte src[16])
Loads a vector from a byte array.
Definition: ppc-simd.h:213
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Definition: trap.h:60
T1 VectorPermute(const T1 &vec1, const T1 &vec2, const T2 &mask)
Permutes two vectors.
Definition: ppc-simd.h:359
T VectorSHA512(const T &vec)
SHA512 Sigma functions.
Definition: ppc-simd.h:538
T1 VectorXor(const T1 &vec1, const T2 &vec2)
XOR two vectors.
Definition: ppc-simd.h:373
T1 VectorDecrypt(const T1 &state, const T2 &key)
One round of AES decryption.
Definition: ppc-simd.h:478
Crypto++ library namespace.
void VectorStore(const T &src, byte dest[16])
Stores a vector to a byte array.
Definition: ppc-simd.h:310
uint32x4_p VectorLoadBE(const uint8_t src[16])
Loads a vector from a byte array.
Definition: ppc-simd.h:147