intrin_sequential_enc8.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * intrin_sequential_enc8.h
  3. * Copied and modified from Shay Gueron's code from intrinsic.h
  4. *
  5. * Copyright(c) 2014, Intel Corp.
  6. * Developers and authors: Shay Gueron (1) (2)
  7. * (1) University of Haifa, Israel
  8. * (2) Intel, Israel
  9. * IPG, Architecture, Israel Development Center, Haifa, Israel
  10. */
  11. #include "../constants.h"
  12. #ifndef INTRIN_SEQUENTIAL_ENC8_H_
  13. #define INTRIN_SEQUENTIAL_ENC8_H_
  14. #ifdef USE_PIPELINED_AES_NI
  15. #include <stdint.h>
  16. #include <stdio.h>
  17. #include <wmmintrin.h>
  18. #if !defined (ALIGN16)
  19. #if defined (__GNUC__)
  20. # define ALIGN16 __attribute__ ( (aligned (16)))
  21. # else
  22. # define ALIGN16 __declspec (align (16))
  23. # endif
  24. #endif
  25. #if defined(__INTEL_COMPILER)
  26. # include <ia32intrin.h>
  27. #elif defined(__GNUC__)
  28. # include <emmintrin.h>
  29. # include <smmintrin.h>
  30. #endif
  31. typedef struct KEY_SCHEDULE
  32. {
  33. ALIGN16 unsigned char KEY[16*15];
  34. unsigned int nr;
  35. } ROUND_KEYS;
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. void intrin_sequential_gen_rnd8(unsigned char* ctr_buf, const unsigned long long ctr, unsigned char* CT,
  40. int n_aesiters, int nkeys, ROUND_KEYS* ks);
  41. void intrin_sequential_ks4(ROUND_KEYS* ks, unsigned char* key_bytes, int nkeys);
  42. void intrin_sequential_enc8(const unsigned char* PT, unsigned char* CT, int aes_niters, int nkeys, ROUND_KEYS* ks);
  43. #ifdef __cplusplus
  44. };
  45. #endif
  46. #endif /* USE_PIPELINED_AES_NI */
  47. #endif /* INTRIN_SEQUENTIAL_ENC8_H_ */