ippcpsgx_disp00213.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "ippcp.h"
  2. #define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg
  3. #ifndef NULL
  4. #ifdef __cplusplus
  5. #define NULL 0
  6. #else
  7. #define NULL ((void *)0)
  8. #endif
  9. #endif
  10. #if defined (_M_AMD64) || defined (__x86_64__)
  11. #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ )
  12. #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER )
  13. IPPAPI(IppStatus, y8_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  14. IPPAPI(IppStatus, l9_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  15. IPPFUN(IppStatus,sgx_disp_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  16. {
  17. Ipp64u features;
  18. ippcpGetCpuFeatures( &features );
  19. if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { /* HasweLl ia32=H9, x64=L9 */
  20. return l9_ippsHMACUnpack_rmf( pBuffer, pCtx );
  21. } else
  22. if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { /* Nehalem or Westmer = PenrYn + SSE42 + ?CLMUL + ?AES + ?SHA */
  23. return y8_ippsHMACUnpack_rmf( pBuffer, pCtx );
  24. } else
  25. return ippStsCpuNotSupportedErr;
  26. }
  27. #else
  28. IPPAPI(IppStatus, p8_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  29. IPPAPI(IppStatus, h9_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  30. IPPFUN(IppStatus,sgx_disp_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx))
  31. {
  32. Ipp64u features;
  33. ippcpGetCpuFeatures( &features );
  34. if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { /* HasweLl ia32=H9, x64=L9 */
  35. return h9_ippsHMACUnpack_rmf( pBuffer, pCtx );
  36. } else
  37. if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { /* Nehalem or Westmer = PenrYn + SSE42 + ?CLMUL + ?AES + ?SHA */
  38. return p8_ippsHMACUnpack_rmf( pBuffer, pCtx );
  39. } else
  40. return ippStsCpuNotSupportedErr;
  41. }
  42. #endif