From e7bbc158fa242cf5b5534ecb1fb2668edf5cd887 Mon Sep 17 00:00:00 2001 From: "Li, Xun" Date: Fri, 21 Jul 2023 10:11:26 +0800 Subject: [PATCH] Linux 2.20 Open Source Gold Release Supported the AEX (Asynchronous Enclave Exit) Notify feature. Supported Mbed-TLS Cryptography library (excluding SSL/TLS portion) in Enclave. Applied patches to OpenSSL 1.1.1t, fixed CVE-2023-1255, CVE-2023-0465 and CVE-2023-0466. Upgraded to Intel(R) Integrated Performance Primitives (IPP) Cryptography library version 2021.7. Upgraded Intel SGX Quote Verification Enclave to integrate updated SgxSSL. Enhanced the attestation local cache functionality by giving users the option to provide their own cache file. Enabled QPL/QCNL log in DCAP samples. Fixed bugs. Signed-off-by: Li, Xun --- .gitignore | 2 +- .gitmodules | 5 +- Linux_SGXEclipsePlugin/readme.txt | 2 +- README.md | 3 +- SampleCode/SampleAEXNotify/App/App.cpp | 245 +++++++ SampleCode/SampleAEXNotify/App/App.h | 57 ++ .../Enclave/Enclave.config.xml | 13 + .../SampleAEXNotify/Enclave/Enclave.cpp | 104 +++ .../SampleAEXNotify/Enclave/Enclave.edl | 54 ++ SampleCode/SampleAEXNotify/Enclave/Enclave.h | 48 ++ .../SampleAEXNotify/Enclave/Enclave.lds | 11 + .../SampleAEXNotify/Include/powers_of_two.h | 56 ++ SampleCode/SampleAEXNotify/Makefile | 250 +++++++ SampleCode/SampleAEXNotify/README.txt | 86 +++ .../SampleAttestedTLS/common/utility.cpp | 21 +- .../SampleAttestedTLS/server_tdx/Makefile | 2 +- SampleCode/SampleDNNL/README.txt | 2 + .../SampleEnclave/Enclave/config.01.xml | 4 +- .../SampleEnclave/Enclave/config.02.xml | 4 +- .../SampleEnclave/Enclave/config.03.xml | 4 +- .../SampleEnclave/Enclave/config.04.xml | 4 +- SampleCode/SampleEnclave/README.txt | 18 +- SampleCode/SampleMbedCrypto/App/App.cpp | 232 ++++++ SampleCode/SampleMbedCrypto/App/App.h | 57 ++ .../Enclave/Enclave.config.xml | 12 + .../SampleMbedCrypto/Enclave/Enclave.cpp | 312 ++++++++ .../SampleMbedCrypto/Enclave/Enclave.edl | 57 ++ SampleCode/SampleMbedCrypto/Enclave/Enclave.h | 48 ++ .../SampleMbedCrypto/Enclave/Enclave.lds | 9 + .../Enclave/Enclave_debug.lds | 11 + SampleCode/SampleMbedCrypto/Makefile | 275 +++++++ SampleCode/SampleMbedCrypto/README.txt | 30 + common/inc/internal/arch.h | 7 +- common/inc/internal/global_data.h | 1 + common/inc/internal/inst.h | 3 +- common/inc/internal/linux/linux-regs.h | 1 + common/inc/internal/rts.h | 8 + common/inc/internal/se_version.h | 16 +- common/inc/internal/thread_data.h | 12 +- common/inc/sgx_attributes.h | 8 +- common/inc/sgx_trts_aex.h | 99 +++ common/inc/sgx_trts_exception.h | 10 + docker/build/Dockerfile | 6 +- docker/build/tdx-qgs.dockerfile | 6 +- download_prebuilt.sh | 8 +- external/dcap_source | 2 +- external/dnnl/README | 2 + external/ippcp_internal/Makefile | 6 +- external/ippcp_internal/Makefile.psw_dcap | 4 +- external/ippcp_internal/README.md | 33 +- .../inc/{ippcp21u3.patch => ippcp21u7.patch} | 0 external/ippcp_internal/inc/sgx_ippcp.h | 27 +- external/ippcp_internal/ipp-crypto | 2 +- external/mbedtls/Makefile | 69 ++ external/mbedtls/bypass_to_sgxmbed.h | 43 ++ external/mbedtls/mbedtls_code | 1 + external/mbedtls/sgx_mbedtls.patch | 230 ++++++ external/mbedtls/sgx_mbedtls_utils.c | 39 + external/sgx-emm/Makefile | 6 +- external/sgx-emm/emm_src | 2 +- external/sgxssl/prepare_sgxssl.sh | 5 + external/vtune/linux/include/jitprofiling.h | 694 ------------------ .../vtune/linux/sdk/src/ittnotify/Makefile | 2 +- .../linux/sdk/src/ittnotify/jitprofiling.c | 315 -------- linux/installer/common/sdk/BOMs/sdk_base.txt | 45 ++ .../common/sdk/BOMs/sdk_cve_2020_0551_cf.txt | 1 + .../sdk/BOMs/sdk_cve_2020_0551_load.txt | 1 + linux/installer/common/sdk/BOMs/sdk_x64.txt | 1 + .../common/sgx-aesm-service/Makefile | 2 +- .../deb/local_repo_tool/conf/distributions | 16 + .../sgx-aesm-service-1.0/debian/control | 4 +- linux/installer/rpm/psw-dcap/sanitize.sh | 6 +- linux/installer/rpm/psw-tdx/sanitize.sh | 6 +- .../libsgx-aesm-ecdsa-plugin.spec | 2 +- .../libsgx-aesm-pce-plugin.spec | 2 +- linux/reproducibility/Dockerfile | 2 +- .../build_and_launch_docker.sh | 6 +- psw/ae/Makefile | 4 +- .../aesm_service/source/qcnl/CMakeLists.txt | 13 +- psw/ae/ref_le/ref_le.md | 2 + psw/ae/ref_le/ref_wl_gen/ref_wl.cpp | 9 + psw/enclave_common/sgx_enclave_common.cpp | 106 +-- psw/urts/create_param.h | 2 +- psw/urts/enclave.cpp | 13 + psw/urts/enclave.h | 4 + psw/urts/enclave_creator_hw_com.cpp | 13 +- psw/urts/linux/enter_enclave.S | 1 + psw/urts/linux/sig_handler.cpp | 77 +- psw/urts/parser/update_global_data.hxx | 2 + psw/urts/se_detect.cpp | 16 + psw/urts/se_detect.h | 3 + psw/urts/urts_com.h | 11 + sdk/Makefile | 2 +- sdk/Makefile.source | 8 +- .../linux/gdb-sgx-plugin/gdb_sgx_plugin.py | 7 +- sdk/sample_libcrypto/Makefile | 2 +- sdk/sample_libcrypto/sample_libcrypto.cpp | 5 +- sdk/sign_tool/SignTool/Makefile | 2 +- sdk/sign_tool/SignTool/manage_metadata.cpp | 140 ++-- sdk/sign_tool/SignTool/manage_metadata.h | 3 +- sdk/sign_tool/SignTool/sign_tool.cpp | 3 +- sdk/simulation/trtssim/linux/Makefile | 2 + .../sl_uswitchless_untrusted.c | 6 +- sdk/tlibcrypto/Makefile | 6 +- .../ippcpGetLibVersion.c} | 51 +- .../ippsAESDecryptCBC.c} | 51 +- .../ippsAESDecryptCBC_CS1.c} | 51 +- .../ippsAESDecryptCBC_CS2.c} | 51 +- .../ippsAESDecryptCBC_CS3.c} | 51 +- .../ippsAESDecryptCFB.c} | 51 +- .../ippsAESDecryptCTR.c} | 51 +- .../ippsAESDecryptECB.c} | 51 +- .../ippsAESDecryptOFB.c} | 51 +- .../ippsAESDecryptXTS_Direct.c} | 51 +- .../ippsAESEncryptCBC.c} | 51 +- .../ippsAESEncryptCBC_CS1.c} | 51 +- .../ippsAESEncryptCBC_CS2.c} | 51 +- .../ippsAESEncryptCBC_CS3.c} | 51 +- .../ippsAESEncryptCFB.c} | 51 +- .../ippsAESEncryptCTR.c} | 51 +- .../ippsAESEncryptECB.c} | 51 +- .../ippsAESEncryptOFB.c} | 51 +- .../ippsAESEncryptXTS_Direct.c} | 51 +- .../ippsAESGetSize.c} | 51 +- .../ippsAESInit.c} | 51 +- .../ippsAESPack.c} | 51 +- .../ippsAESSetKey.c} | 51 +- .../ipp/ipp_disp/intel64/ippsAESSetupNoise.c | 82 +++ .../ippsAESUnpack.c} | 51 +- .../ippsAES_CCMDecrypt.c} | 51 +- .../ippsAES_CCMEncrypt.c} | 51 +- .../ippsAES_CCMGetSize.c} | 51 +- .../ippsAES_CCMGetTag.c} | 51 +- .../ippsAES_CCMInit.c} | 51 +- .../ippsAES_CCMMessageLen.c} | 51 +- .../ippsAES_CCMStart.c} | 51 +- .../ippsAES_CCMTagLen.c} | 51 +- .../ippsAES_CMACFinal.c} | 51 +- .../ippsAES_CMACGetSize.c} | 51 +- .../ippsAES_CMACGetTag.c} | 51 +- .../ippsAES_CMACInit.c} | 51 +- .../ipp_disp/intel64/ippsAES_CMACSetupNoise.c | 82 +++ .../ippsAES_CMACUpdate.c} | 51 +- .../ippsAES_EncryptCFB16_MB.c} | 51 +- .../ippsAES_GCMDecrypt.c} | 51 +- .../ippsAES_GCMEncrypt.c} | 51 +- .../ippsAES_GCMGetSize.c} | 51 +- .../ippsAES_GCMGetTag.c} | 51 +- .../ippsAES_GCMInit.c} | 51 +- .../ipp_disp/intel64/ippsAES_GCMProcessAAD.c | 82 +++ .../ippsAES_GCMProcessIV.c} | 51 +- .../ippsAES_GCMReset.c} | 51 +- .../ipp_disp/intel64/ippsAES_GCMSetupNoise.c | 82 +++ .../ippsAES_GCMStart.c} | 51 +- .../ippsAES_S2V_CMAC.c} | 51 +- .../ippsAES_SIVDecrypt.c} | 51 +- .../ippsAES_SIVEncrypt.c} | 51 +- .../ippsAES_XTSDecrypt.c} | 51 +- .../ippsAES_XTSEncrypt.c} | 51 +- .../ippsAES_XTSGetSize.c} | 51 +- .../ippsAES_XTSInit.c} | 51 +- .../ippsARCFourCheckKey.c} | 51 +- .../ippsARCFourDecrypt.c} | 51 +- .../ippsARCFourEncrypt.c} | 51 +- .../ippsARCFourGetSize.c} | 51 +- .../ippsARCFourInit.c} | 51 +- .../ippsARCFourPack.c} | 51 +- .../ippsARCFourReset.c} | 51 +- .../ippsARCFourUnpack.c} | 51 +- .../ippsAdd_BN.c} | 51 +- .../ippsBigNumGetSize.c} | 51 +- .../ippsBigNumInit.c} | 51 +- .../ippsCmpZero_BN.c} | 51 +- .../ippsCmp_BN.c} | 51 +- .../ippsDESGetSize.c} | 51 +- .../ippsDESInit.c} | 51 +- .../ippsDESPack.c} | 51 +- .../ippsDESUnpack.c} | 51 +- .../ippsDLGetResultString.c} | 51 +- .../ippsDLPGenKeyPair.c} | 51 +- .../ippsDLPGenerateDH.c} | 51 +- .../ippsDLPGenerateDSA.c} | 51 +- .../ippsDLPGet.c} | 51 +- .../ippsDLPGetDP.c} | 51 +- .../ippsDLPGetSize.c} | 51 +- .../ippsDLPInit.c} | 51 +- .../ippsDLPPack.c} | 51 +- .../ippsDLPPublicKey.c} | 51 +- .../ippsDLPSet.c} | 51 +- .../ippsDLPSetDP.c} | 51 +- .../ippsDLPSetKeyPair.c} | 51 +- .../ippsDLPSharedSecretDH.c} | 51 +- .../ippsDLPSignDSA.c} | 51 +- .../ippsDLPUnpack.c} | 51 +- .../ippsDLPValidateDH.c} | 51 +- .../ippsDLPValidateDSA.c} | 51 +- .../ippsDLPValidateKeyPair.c} | 51 +- .../ippsDLPVerifyDSA.c} | 51 +- .../ippsDiv_BN.c} | 51 +- .../ippsECCGetResultString.c} | 51 +- .../ippsECCPAddPoint.c} | 51 +- .../ippsECCPBindGxyTblStd192r1.c} | 51 +- .../ippsECCPBindGxyTblStd224r1.c} | 51 +- .../ippsECCPBindGxyTblStd256r1.c} | 51 +- .../ippsECCPBindGxyTblStd384r1.c} | 51 +- .../ippsECCPBindGxyTblStd521r1.c} | 51 +- .../ippsECCPBindGxyTblStdSM2.c} | 51 +- .../ippsECCPCheckPoint.c} | 51 +- .../ippsECCPComparePoint.c} | 51 +- .../ippsECCPGenKeyPair.c} | 51 +- .../ippsECCPGet.c} | 51 +- .../ippsECCPGetOrderBitSize.c} | 51 +- .../ippsECCPGetPoint.c} | 51 +- .../ippsECCPGetSize.c} | 51 +- .../ippsECCPGetSizeStd128r1.c} | 51 +- .../ippsECCPGetSizeStd128r2.c} | 51 +- .../ippsECCPGetSizeStd192r1.c} | 51 +- .../ippsECCPGetSizeStd224r1.c} | 51 +- .../ippsECCPGetSizeStd256r1.c} | 51 +- .../ippsECCPGetSizeStd384r1.c} | 51 +- .../ippsECCPGetSizeStd521r1.c} | 51 +- .../ippsECCPGetSizeStdSM2.c} | 51 +- .../ippsECCPInit.c} | 51 +- .../ippsECCPInitStd128r1.c} | 51 +- .../ippsECCPInitStd128r2.c} | 51 +- .../ippsECCPInitStd192r1.c} | 51 +- .../ippsECCPInitStd224r1.c} | 51 +- .../ippsECCPInitStd256r1.c} | 51 +- .../ippsECCPInitStd384r1.c} | 51 +- .../ippsECCPInitStd521r1.c} | 51 +- .../ippsECCPInitStdSM2.c} | 51 +- .../ippsECCPMulPointScalar.c} | 51 +- .../ippsECCPNegativePoint.c} | 51 +- .../ippsECCPPointGetSize.c} | 51 +- .../ippsECCPPointInit.c} | 51 +- .../ippsECCPPublicKey.c} | 51 +- .../ippsECCPSet.c} | 51 +- .../ippsECCPSetKeyPair.c} | 51 +- .../ippsECCPSetPoint.c} | 51 +- .../ippsECCPSetPointAtInfinity.c} | 51 +- .../ippsECCPSetStd.c} | 51 +- .../ippsECCPSetStd128r1.c} | 51 +- .../ippsECCPSetStd128r2.c} | 51 +- .../ippsECCPSetStd192r1.c} | 51 +- .../ippsECCPSetStd224r1.c} | 51 +- .../ippsECCPSetStd256r1.c} | 51 +- .../ippsECCPSetStd384r1.c} | 51 +- .../ippsECCPSetStd521r1.c} | 51 +- .../ippsECCPSetStdSM2.c} | 51 +- .../ippsECCPSharedSecretDH.c} | 51 +- .../ippsECCPSharedSecretDHC.c} | 51 +- .../ippsECCPSignDSA.c} | 51 +- .../ippsECCPSignNR.c} | 51 +- .../ippsECCPSignSM2.c} | 51 +- .../ippsECCPValidate.c} | 51 +- .../ippsECCPValidateKeyPair.c} | 51 +- .../ippsECCPVerifyDSA.c} | 51 +- .../ippsECCPVerifyNR.c} | 51 +- .../ippsECCPVerifySM2.c} | 51 +- .../ippsExtGet_BN.c} | 51 +- .../ippsGFpAdd.c} | 51 +- .../ippsGFpAdd_PE.c} | 51 +- .../ippsGFpCmpElement.c} | 51 +- .../ippsGFpConj.c} | 51 +- .../ippsGFpCpyElement.c} | 51 +- .../ippsGFpECAddPoint.c} | 51 +- .../ippsGFpECBindGxyTblStd192r1.c} | 51 +- .../ippsGFpECBindGxyTblStd224r1.c} | 51 +- .../ippsGFpECBindGxyTblStd256r1.c} | 51 +- .../ippsGFpECBindGxyTblStd384r1.c} | 51 +- .../ippsGFpECBindGxyTblStd521r1.c} | 51 +- .../ippsGFpECBindGxyTblStdSM2.c} | 51 +- .../ippsGFpECCmpPoint.c} | 51 +- .../ippsGFpECCpyPoint.c} | 51 +- .../intel64/ippsGFpECDecryptSM2_Ext.c | 82 +++ .../ippsGFpECDecryptSM2_Ext_DecMsgSize.c | 82 +++ .../ippsGFpECESDecrypt_SM2.c} | 51 +- .../ippsGFpECESEncrypt_SM2.c} | 51 +- .../ippsGFpECESFinal_SM2.c} | 51 +- .../ippsGFpECESGetBuffersSize_SM2.c} | 51 +- .../ippsGFpECESGetSize_SM2.c} | 51 +- .../ippsGFpECESInit_SM2.c} | 51 +- .../ippsGFpECESSetKey_SM2.c} | 51 +- .../ippsGFpECESStart_SM2.c} | 51 +- .../intel64/ippsGFpECEncryptSM2_Ext.c | 82 +++ .../ippsGFpECEncryptSM2_Ext_EncMsgSize.c | 82 +++ .../ippsGFpECGet.c} | 51 +- .../ippsGFpECGetInfo_GF.c} | 51 +- .../ippsGFpECGetPoint.c} | 51 +- .../ippsGFpECGetPointOctString.c} | 51 +- .../ippsGFpECGetPointRegular.c} | 51 +- .../ippsGFpECGetSize.c} | 51 +- .../ippsGFpECGetSubgroup.c} | 51 +- .../ippsGFpECInit.c} | 51 +- .../ippsGFpECInitStd128r1.c} | 51 +- .../ippsGFpECInitStd128r2.c} | 51 +- .../ippsGFpECInitStd192r1.c} | 51 +- .../ippsGFpECInitStd224r1.c} | 51 +- .../ippsGFpECInitStd256r1.c} | 51 +- .../ippsGFpECInitStd384r1.c} | 51 +- .../ippsGFpECInitStd521r1.c} | 51 +- .../ippsGFpECInitStdBN256.c} | 51 +- .../ippsGFpECInitStdSM2.c} | 51 +- .../intel64/ippsGFpECKeyExchangeSM2_Confirm.c | 82 +++ .../intel64/ippsGFpECKeyExchangeSM2_GetSize.c | 82 +++ .../intel64/ippsGFpECKeyExchangeSM2_Init.c | 82 +++ .../intel64/ippsGFpECKeyExchangeSM2_Setup.c | 82 +++ .../ippsGFpECKeyExchangeSM2_SharedKey.c | 82 +++ .../ippsGFpECMakePoint.c} | 51 +- .../ippsGFpECMessageRepresentationSM2.c | 82 +++ .../ippsGFpECMulPoint.c} | 51 +- .../ippsGFpECNegPoint.c} | 51 +- .../ippsGFpECPointGetSize.c} | 51 +- .../ippsGFpECPointInit.c} | 51 +- .../ippsGFpECPrivateKey.c} | 51 +- .../ippsGFpECPublicKey.c} | 51 +- .../ippsGFpECScratchBufferSize.c} | 51 +- .../ippsGFpECSet.c} | 51 +- .../ippsGFpECSetPoint.c} | 51 +- .../ippsGFpECSetPointAtInfinity.c} | 51 +- .../ippsGFpECSetPointHash.c} | 51 +- .../ippsGFpECSetPointHashBackCompatible.c} | 51 +- ...ippsGFpECSetPointHashBackCompatible_rmf.c} | 51 +- .../ippsGFpECSetPointHash_rmf.c} | 51 +- .../ippsGFpECSetPointOctString.c} | 51 +- .../ippsGFpECSetPointRandom.c} | 51 +- .../ippsGFpECSetPointRegular.c} | 51 +- .../ippsGFpECSetSubgroup.c} | 51 +- .../ippsGFpECSharedSecretDH.c} | 51 +- .../ippsGFpECSharedSecretDHC.c} | 51 +- .../ipp/ipp_disp/intel64/ippsGFpECSignDSA.c | 82 +++ .../ipp/ipp_disp/intel64/ippsGFpECSignNR.c | 82 +++ .../ipp/ipp_disp/intel64/ippsGFpECSignSM2.c | 82 +++ .../ippsGFpECTstKeyPair.c} | 51 +- .../ippsGFpECTstPoint.c} | 51 +- .../ippsGFpECTstPointInSubgroup.c} | 51 +- .../ipp_disp/intel64/ippsGFpECUserIDHashSM2.c | 82 +++ .../ippsGFpECVerify.c} | 51 +- .../ipp/ipp_disp/intel64/ippsGFpECVerifyDSA.c | 82 +++ .../ipp/ipp_disp/intel64/ippsGFpECVerifyNR.c | 82 +++ .../ipp/ipp_disp/intel64/ippsGFpECVerifySM2.c | 82 +++ .../ippsGFpElementGetSize.c} | 51 +- .../ippsGFpElementInit.c} | 51 +- .../ippsGFpExp.c} | 51 +- .../ippsGFpGetElement.c} | 51 +- .../ippsGFpGetElementOctString.c} | 51 +- .../ippsGFpGetInfo.c} | 51 +- .../ippsGFpGetSize.c} | 51 +- .../ippsGFpInit.c} | 51 +- .../ippsGFpInitArbitrary.c} | 51 +- .../ippsGFpInitFixed.c} | 51 +- .../ippsGFpInv.c} | 51 +- .../ippsGFpIsUnityElement.c} | 51 +- .../ippsGFpIsZeroElement.c} | 51 +- .../ippsGFpMethod_p192r1.c} | 51 +- .../ippsGFpMethod_p224r1.c} | 51 +- .../ippsGFpMethod_p256.c} | 51 +- .../ippsGFpMethod_p256bn.c} | 51 +- .../ippsGFpMethod_p256r1.c} | 51 +- .../ippsGFpMethod_p256sm2.c} | 51 +- .../ippsGFpMethod_p384r1.c} | 51 +- .../ippsGFpMethod_p521r1.c} | 51 +- .../ippsGFpMethod_pArb.c} | 51 +- .../ippsGFpMul.c} | 51 +- .../ippsGFpMul_PE.c} | 51 +- .../ippsGFpMultiExp.c} | 51 +- .../ippsGFpNeg.c} | 51 +- .../ippsGFpScratchBufferSize.c} | 51 +- .../ippsGFpSetElement.c} | 51 +- .../ippsGFpSetElementHash.c} | 51 +- .../ippsGFpSetElementHash_rmf.c} | 51 +- .../ippsGFpSetElementOctString.c} | 51 +- .../ippsGFpSetElementRandom.c} | 51 +- .../ippsGFpSetElementRegular.c} | 51 +- .../ippsGFpSqr.c} | 51 +- .../ippsGFpSqrt.c} | 51 +- .../ippsGFpSub.c} | 51 +- .../ippsGFpSub_PE.c} | 51 +- .../ippsGFpxGetSize.c} | 51 +- .../ippsGFpxInit.c} | 51 +- .../ippsGFpxInitBinomial.c} | 51 +- .../ippsGFpxMethod_binom.c} | 51 +- .../ippsGFpxMethod_binom2.c} | 51 +- .../ippsGFpxMethod_binom2_epid2.c} | 51 +- .../ippsGFpxMethod_binom3.c} | 51 +- .../ippsGFpxMethod_binom3_epid2.c} | 51 +- .../ippsGFpxMethod_com.c} | 51 +- .../ippsGcd_BN.c} | 51 +- .../ippsGetOctString_BN.c} | 51 +- .../ippsGetSize_BN.c} | 51 +- .../ippsGet_BN.c} | 51 +- .../ippsHMACDuplicate_rmf.c} | 51 +- .../ippsHMACFinal_rmf.c} | 51 +- .../ippsHMACGetSize_rmf.c} | 51 +- .../ippsHMACGetTag_rmf.c} | 51 +- .../ippsHMACInit_rmf.c} | 51 +- .../ippsHMACMessage_rmf.c} | 51 +- .../ippsHMACPack_rmf.c} | 51 +- .../ippsHMACUnpack_rmf.c} | 51 +- .../ippsHMACUpdate_rmf.c} | 51 +- .../ippsHMAC_Duplicate.c} | 51 +- .../ippsHMAC_Final.c} | 51 +- .../ippsHMAC_GetSize.c} | 51 +- .../ippsHMAC_GetTag.c} | 51 +- .../ippsHMAC_Init.c} | 51 +- .../ippsHMAC_Message.c} | 51 +- .../ippsHMAC_Pack.c} | 51 +- .../ippsHMAC_Unpack.c} | 51 +- .../ippsHMAC_Update.c} | 51 +- .../ippsHashDuplicate.c} | 51 +- .../ippsHashDuplicate_rmf.c} | 51 +- .../ippsHashFinal.c} | 51 +- .../ippsHashFinal_rmf.c} | 51 +- .../ippsHashGetInfo_rmf.c} | 51 +- .../ippsHashGetSize.c} | 51 +- .../ippsHashGetSize_rmf.c} | 51 +- .../ippsHashGetTag.c} | 51 +- .../ippsHashGetTag_rmf.c} | 51 +- .../ippsHashInit.c} | 51 +- .../ippsHashInit_rmf.c} | 51 +- .../ippsHashMessage.c} | 51 +- .../ippsHashMessage_rmf.c} | 51 +- .../ippsHashMethodGetInfo.c} | 51 +- .../ippsHashMethodGetSize.c} | 51 +- .../ippsHashMethodSet_MD5.c} | 51 +- .../ippsHashMethodSet_SHA1.c} | 51 +- .../ippsHashMethodSet_SHA1_NI.c} | 51 +- .../ippsHashMethodSet_SHA1_TT.c} | 51 +- .../ippsHashMethodSet_SHA224.c} | 51 +- .../ippsHashMethodSet_SHA224_NI.c} | 51 +- .../ippsHashMethodSet_SHA224_TT.c} | 51 +- .../ippsHashMethodSet_SHA256.c} | 51 +- .../ippsHashMethodSet_SHA256_NI.c} | 51 +- .../ippsHashMethodSet_SHA256_TT.c} | 51 +- .../ippsHashMethodSet_SHA384.c} | 51 +- .../ippsHashMethodSet_SHA512.c} | 51 +- .../ippsHashMethodSet_SHA512_224.c} | 51 +- .../ippsHashMethodSet_SHA512_256.c} | 51 +- .../ippsHashMethodSet_SM3.c} | 51 +- .../ippsHashMethod_MD5.c} | 51 +- .../ippsHashMethod_SHA1.c} | 51 +- .../ippsHashMethod_SHA1_NI.c} | 51 +- .../ippsHashMethod_SHA1_TT.c} | 51 +- .../ippsHashMethod_SHA224.c} | 51 +- .../ippsHashMethod_SHA224_NI.c} | 51 +- .../ippsHashMethod_SHA224_TT.c} | 51 +- .../ippsHashMethod_SHA256.c} | 51 +- .../ippsHashMethod_SHA256_NI.c} | 51 +- .../ippsHashMethod_SHA256_TT.c} | 51 +- .../ippsHashMethod_SHA384.c} | 51 +- .../ippsHashMethod_SHA512.c} | 51 +- .../ippsHashMethod_SHA512_224.c} | 51 +- .../ippsHashMethod_SHA512_256.c} | 51 +- .../ippsHashMethod_SM3.c} | 51 +- .../ippsHashPack.c} | 51 +- .../ippsHashPack_rmf.c} | 51 +- .../intel64/ippsHashStateMethodSet_SHA224.c | 82 +++ .../ippsHashStateMethodSet_SHA224_NI.c | 82 +++ .../ippsHashStateMethodSet_SHA224_TT.c | 82 +++ .../intel64/ippsHashStateMethodSet_SHA256.c | 82 +++ .../ippsHashStateMethodSet_SHA256_NI.c | 82 +++ .../ippsHashStateMethodSet_SHA256_TT.c | 82 +++ .../intel64/ippsHashStateMethodSet_SHA384.c | 82 +++ .../intel64/ippsHashStateMethodSet_SHA512.c | 82 +++ .../ippsHashStateMethodSet_SHA512_224.c | 82 +++ .../ippsHashStateMethodSet_SHA512_256.c | 82 +++ .../intel64/ippsHashStateMethodSet_SM3.c | 82 +++ .../ippsHashUnpack.c} | 51 +- .../ippsHashUnpack_rmf.c} | 51 +- .../ippsHashUpdate.c} | 51 +- .../ippsHashUpdate_rmf.c} | 51 +- .../ippsMAC_BN_I.c} | 51 +- .../ippsMD5Duplicate.c} | 51 +- .../ippsMD5Final.c} | 51 +- .../ippsMD5GetSize.c} | 51 +- .../ippsMD5GetTag.c} | 51 +- .../ippsMD5Init.c} | 51 +- .../ippsMD5MessageDigest.c} | 51 +- .../ippsMD5Pack.c} | 51 +- .../ippsMD5Unpack.c} | 51 +- .../ippsMD5Update.c} | 51 +- .../ippsMGF.c} | 51 +- .../ippsMGF1_rmf.c} | 51 +- .../ippsMGF2_rmf.c} | 51 +- .../ippsModInv_BN.c} | 51 +- .../ippsMod_BN.c} | 51 +- .../ippsMontExp.c} | 51 +- .../ippsMontForm.c} | 51 +- .../ippsMontGet.c} | 51 +- .../ippsMontGetSize.c} | 51 +- .../ippsMontInit.c} | 51 +- .../ippsMontMul.c} | 51 +- .../ippsMontSet.c} | 51 +- .../ippsMul_BN.c} | 51 +- .../ippsPRNGGetSeed.c} | 51 +- .../ippsPRNGGetSize.c} | 51 +- .../ippsPRNGInit.c} | 51 +- .../ippsPRNGSetAugment.c} | 51 +- .../ippsPRNGSetH0.c} | 51 +- .../ippsPRNGSetModulus.c} | 51 +- .../ippsPRNGSetSeed.c} | 51 +- .../ippsPRNGen.c} | 51 +- .../ippsPRNGenRDRAND.c} | 51 +- .../ippsPRNGenRDRAND_BN.c} | 51 +- .../ippsPRNGen_BN.c} | 51 +- .../ippsPrimeGen.c} | 51 +- .../ippsPrimeGen_BN.c} | 51 +- .../ippsPrimeGet.c} | 51 +- .../ippsPrimeGetSize.c} | 51 +- .../ippsPrimeGet_BN.c} | 51 +- .../ippsPrimeInit.c} | 51 +- .../ippsPrimeSet.c} | 51 +- .../ippsPrimeSet_BN.c} | 51 +- .../ippsPrimeTest.c} | 51 +- .../ippsPrimeTest_BN.c} | 51 +- .../ippsRSADecrypt_OAEP.c} | 51 +- .../ippsRSADecrypt_OAEP_rmf.c} | 51 +- .../ippsRSADecrypt_PKCSv15.c} | 51 +- .../ippsRSAEncrypt_OAEP.c} | 51 +- .../ippsRSAEncrypt_OAEP_rmf.c} | 51 +- .../ippsRSAEncrypt_PKCSv15.c} | 51 +- .../ippsRSASign_PKCS1v15.c} | 51 +- .../ippsRSASign_PKCS1v15_rmf.c} | 51 +- .../ippsRSASign_PSS.c} | 51 +- .../ippsRSASign_PSS_rmf.c} | 51 +- .../ippsRSAVerify_PKCS1v15.c} | 51 +- .../ippsRSAVerify_PKCS1v15_rmf.c} | 51 +- .../ippsRSAVerify_PSS.c} | 51 +- .../ippsRSAVerify_PSS_rmf.c} | 51 +- .../ippsRSA_Decrypt.c} | 51 +- .../ippsRSA_Encrypt.c} | 51 +- .../ippsRSA_GenerateKeys.c} | 51 +- .../ippsRSA_GetBufferSizePrivateKey.c} | 51 +- .../ippsRSA_GetBufferSizePublicKey.c} | 51 +- .../ippsRSA_GetPrivateKeyType1.c} | 51 +- .../ippsRSA_GetPrivateKeyType2.c} | 51 +- .../ippsRSA_GetPublicKey.c} | 51 +- .../ippsRSA_GetSizePrivateKeyType1.c} | 51 +- .../ippsRSA_GetSizePrivateKeyType2.c} | 51 +- .../ippsRSA_GetSizePublicKey.c} | 51 +- .../ippsRSA_InitPrivateKeyType1.c} | 51 +- .../ippsRSA_InitPrivateKeyType2.c} | 51 +- .../ippsRSA_InitPublicKey.c} | 51 +- .../ippsRSA_SetPrivateKeyType1.c} | 51 +- .../ippsRSA_SetPrivateKeyType2.c} | 51 +- .../ippsRSA_SetPublicKey.c} | 51 +- .../ippsRSA_ValidateKeys.c} | 51 +- .../ippsRef_BN.c} | 51 +- .../ippsSHA1Duplicate.c} | 51 +- .../ippsSHA1Final.c} | 51 +- .../ippsSHA1GetSize.c} | 51 +- .../ippsSHA1GetTag.c} | 51 +- .../ippsSHA1Init.c} | 51 +- .../ippsSHA1MessageDigest.c} | 51 +- .../ippsSHA1Pack.c} | 51 +- .../ippsSHA1Unpack.c} | 51 +- .../ippsSHA1Update.c} | 51 +- .../ippsSHA224Duplicate.c} | 51 +- .../ippsSHA224Final.c} | 51 +- .../ippsSHA224GetSize.c} | 51 +- .../ippsSHA224GetTag.c} | 51 +- .../ippsSHA224Init.c} | 51 +- .../ippsSHA224MessageDigest.c} | 51 +- .../ippsSHA224Pack.c} | 51 +- .../ippsSHA224Unpack.c} | 51 +- .../ippsSHA224Update.c} | 51 +- .../ippsSHA256Duplicate.c} | 51 +- .../ippsSHA256Final.c} | 51 +- .../ippsSHA256GetSize.c} | 51 +- .../ippsSHA256GetTag.c} | 51 +- .../ippsSHA256Init.c} | 51 +- .../ippsSHA256MessageDigest.c} | 51 +- .../ippsSHA256Pack.c} | 51 +- .../ippsSHA256Unpack.c} | 51 +- .../ippsSHA256Update.c} | 51 +- .../ippsSHA384Duplicate.c} | 51 +- .../ippsSHA384Final.c} | 51 +- .../ippsSHA384GetSize.c} | 51 +- .../ippsSHA384GetTag.c} | 51 +- .../ippsSHA384Init.c} | 51 +- .../ippsSHA384MessageDigest.c} | 51 +- .../ippsSHA384Pack.c} | 51 +- .../ippsSHA384Unpack.c} | 51 +- .../ippsSHA384Update.c} | 51 +- .../ippsSHA512Duplicate.c} | 51 +- .../ippsSHA512Final.c} | 51 +- .../ippsSHA512GetSize.c} | 51 +- .../ippsSHA512GetTag.c} | 51 +- .../ippsSHA512Init.c} | 51 +- .../ippsSHA512MessageDigest.c} | 51 +- .../ippsSHA512Pack.c} | 51 +- .../ippsSHA512Unpack.c} | 51 +- .../ippsSHA512Update.c} | 51 +- .../ippsSM3Duplicate.c} | 51 +- .../ippsSM3Final.c} | 51 +- .../ippsSM3GetSize.c} | 51 +- .../ippsSM3GetTag.c} | 51 +- .../ippsSM3Init.c} | 51 +- .../ippsSM3MessageDigest.c} | 51 +- .../ippsSM3Pack.c} | 51 +- .../ippsSM3Unpack.c} | 51 +- .../ippsSM3Update.c} | 51 +- .../ippsSMS4DecryptCBC.c} | 51 +- .../ippsSMS4DecryptCBC_CS1.c} | 51 +- .../ippsSMS4DecryptCBC_CS2.c} | 51 +- .../ippsSMS4DecryptCBC_CS3.c} | 51 +- .../ippsSMS4DecryptCFB.c} | 51 +- .../ippsSMS4DecryptCTR.c} | 51 +- .../ippsSMS4DecryptECB.c} | 51 +- .../ippsSMS4DecryptOFB.c} | 51 +- .../ippsSMS4EncryptCBC.c} | 51 +- .../ippsSMS4EncryptCBC_CS1.c} | 51 +- .../ippsSMS4EncryptCBC_CS2.c} | 51 +- .../ippsSMS4EncryptCBC_CS3.c} | 51 +- .../ippsSMS4EncryptCFB.c} | 51 +- .../ippsSMS4EncryptCTR.c} | 51 +- .../ippsSMS4EncryptECB.c} | 51 +- .../ippsSMS4EncryptOFB.c} | 51 +- .../ippsSMS4GetSize.c} | 51 +- .../ippsSMS4Init.c} | 51 +- .../ippsSMS4SetKey.c} | 51 +- .../ippsSMS4_CCMDecrypt.c} | 51 +- .../ippsSMS4_CCMEncrypt.c} | 51 +- .../ippsSMS4_CCMGetSize.c} | 51 +- .../ippsSMS4_CCMGetTag.c} | 51 +- .../ippsSMS4_CCMInit.c} | 51 +- .../ippsSMS4_CCMMessageLen.c} | 51 +- .../ippsSMS4_CCMStart.c} | 51 +- .../ippsSMS4_CCMTagLen.c} | 51 +- .../ippsSetOctString_BN.c} | 51 +- .../ippsSet_BN.c} | 51 +- .../ippsSub_BN.c} | 51 +- .../ippsTDESDecryptCBC.c} | 51 +- .../ippsTDESDecryptCFB.c} | 51 +- .../ippsTDESDecryptCTR.c} | 51 +- .../ippsTDESDecryptECB.c} | 51 +- .../ippsTDESDecryptOFB.c} | 51 +- .../ippsTDESEncryptCBC.c} | 51 +- .../ippsTDESEncryptCFB.c} | 51 +- .../ippsTDESEncryptCTR.c} | 51 +- .../ippsTDESEncryptECB.c} | 51 +- .../ippsTDESEncryptOFB.c} | 51 +- .../ippsTRNGenRDSEED.c} | 51 +- .../ippsTRNGenRDSEED_BN.c} | 51 +- .../ipp/ipp_disp/ippcpsgx_disp00078.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00500.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00501.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00502.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00503.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00504.c | 91 --- .../ipp/ipp_disp/ippcpsgx_disp00505.c | 91 --- sdk/tlibcxx/include/__hash_table | 2 +- sdk/tlibcxx/include/memory | 10 +- sdk/tlibcxx/include/type_traits | 8 +- sdk/tlibcxx/src/include/atomic_support.h | 6 +- sdk/trts/init_enclave.cpp | 10 +- sdk/trts/linux/Makefile | 8 + sdk/trts/linux/trts_mitigation.S | 388 ++++++++++ sdk/trts/linux/trts_pic.S | 51 +- sdk/trts/linux/trts_pic.h | 2 + sdk/trts/trts.cpp | 3 + sdk/trts/trts_add_trim.cpp | 2 +- sdk/trts/trts_aex.cpp | 149 ++++ sdk/trts/trts_ecall.cpp | 11 + sdk/trts/trts_mitigation.h | 37 + sdk/trts/trts_nsp.cpp | 2 +- sdk/trts/trts_ocall.cpp | 11 + sdk/trts/trts_util.cpp | 17 + sdk/trts/trts_util.h | 3 + sdk/trts/trts_veh.cpp | 249 +++++-- sdk/ttls/Makefile | 3 +- sdk/ttls/ttls.cpp | 13 +- 672 files changed, 17208 insertions(+), 17207 deletions(-) create mode 100644 SampleCode/SampleAEXNotify/App/App.cpp create mode 100644 SampleCode/SampleAEXNotify/App/App.h create mode 100644 SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml create mode 100644 SampleCode/SampleAEXNotify/Enclave/Enclave.cpp create mode 100644 SampleCode/SampleAEXNotify/Enclave/Enclave.edl create mode 100644 SampleCode/SampleAEXNotify/Enclave/Enclave.h create mode 100644 SampleCode/SampleAEXNotify/Enclave/Enclave.lds create mode 100644 SampleCode/SampleAEXNotify/Include/powers_of_two.h create mode 100644 SampleCode/SampleAEXNotify/Makefile create mode 100644 SampleCode/SampleAEXNotify/README.txt create mode 100644 SampleCode/SampleMbedCrypto/App/App.cpp create mode 100644 SampleCode/SampleMbedCrypto/App/App.h create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave.edl create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave.h create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave.lds create mode 100644 SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds create mode 100644 SampleCode/SampleMbedCrypto/Makefile create mode 100644 SampleCode/SampleMbedCrypto/README.txt create mode 100644 common/inc/sgx_trts_aex.h rename external/ippcp_internal/inc/{ippcp21u3.patch => ippcp21u7.patch} (100%) create mode 100644 external/mbedtls/Makefile create mode 100644 external/mbedtls/bypass_to_sgxmbed.h create mode 160000 external/mbedtls/mbedtls_code create mode 100644 external/mbedtls/sgx_mbedtls.patch create mode 100644 external/mbedtls/sgx_mbedtls_utils.c delete mode 100644 external/vtune/linux/include/jitprofiling.h delete mode 100644 external/vtune/linux/sdk/src/ittnotify/jitprofiling.c mode change 100755 => 100644 linux/reproducibility/build_and_launch_docker.sh rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00000.c => intel64/ippcpGetLibVersion.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00026.c => intel64/ippsAESDecryptCBC.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00027.c => intel64/ippsAESDecryptCBC_CS1.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00028.c => intel64/ippsAESDecryptCBC_CS2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00029.c => intel64/ippsAESDecryptCBC_CS3.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00031.c => intel64/ippsAESDecryptCFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00035.c => intel64/ippsAESDecryptCTR.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00021.c => intel64/ippsAESDecryptECB.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00033.c => intel64/ippsAESDecryptOFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00037.c => intel64/ippsAESDecryptXTS_Direct.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00022.c => intel64/ippsAESEncryptCBC.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00023.c => intel64/ippsAESEncryptCBC_CS1.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00024.c => intel64/ippsAESEncryptCBC_CS2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00025.c => intel64/ippsAESEncryptCBC_CS3.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00030.c => intel64/ippsAESEncryptCFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00034.c => intel64/ippsAESEncryptCTR.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00020.c => intel64/ippsAESEncryptECB.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00032.c => intel64/ippsAESEncryptOFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00036.c => intel64/ippsAESEncryptXTS_Direct.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00015.c => intel64/ippsAESGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00016.c => intel64/ippsAESInit.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00018.c => intel64/ippsAESPack.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00017.c => intel64/ippsAESSetKey.c} (71%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetupNoise.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00019.c => intel64/ippsAESUnpack.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00072.c => intel64/ippsAES_CCMDecrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00071.c => intel64/ippsAES_CCMEncrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00066.c => intel64/ippsAES_CCMGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00073.c => intel64/ippsAES_CCMGetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00067.c => intel64/ippsAES_CCMInit.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00068.c => intel64/ippsAES_CCMMessageLen.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00070.c => intel64/ippsAES_CCMStart.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00069.c => intel64/ippsAES_CCMTagLen.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00093.c => intel64/ippsAES_CMACFinal.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00090.c => intel64/ippsAES_CMACGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00094.c => intel64/ippsAES_CMACGetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00091.c => intel64/ippsAES_CMACInit.c} (69%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACSetupNoise.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00092.c => intel64/ippsAES_CMACUpdate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00038.c => intel64/ippsAES_EncryptCFB16_MB.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00081.c => intel64/ippsAES_GCMDecrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00080.c => intel64/ippsAES_GCMEncrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00074.c => intel64/ippsAES_GCMGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00082.c => intel64/ippsAES_GCMGetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00075.c => intel64/ippsAES_GCMInit.c} (69%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessAAD.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00077.c => intel64/ippsAES_GCMProcessIV.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00076.c => intel64/ippsAES_GCMReset.c} (72%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMSetupNoise.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00079.c => intel64/ippsAES_GCMStart.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00087.c => intel64/ippsAES_S2V_CMAC.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00089.c => intel64/ippsAES_SIVDecrypt.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00088.c => intel64/ippsAES_SIVEncrypt.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00086.c => intel64/ippsAES_XTSDecrypt.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00085.c => intel64/ippsAES_XTSEncrypt.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00083.c => intel64/ippsAES_XTSGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00084.c => intel64/ippsAES_XTSInit.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00095.c => intel64/ippsARCFourCheckKey.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00102.c => intel64/ippsARCFourDecrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00101.c => intel64/ippsARCFourEncrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00096.c => intel64/ippsARCFourGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00097.c => intel64/ippsARCFourInit.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00099.c => intel64/ippsARCFourPack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00098.c => intel64/ippsARCFourReset.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00100.c => intel64/ippsARCFourUnpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00247.c => intel64/ippsAdd_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00238.c => intel64/ippsBigNumGetSize.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00239.c => intel64/ippsBigNumInit.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00240.c => intel64/ippsCmpZero_BN.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00241.c => intel64/ippsCmp_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00001.c => intel64/ippsDESGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00002.c => intel64/ippsDESInit.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00003.c => intel64/ippsDESPack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00004.c => intel64/ippsDESUnpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00319.c => intel64/ippsDLGetResultString.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00328.c => intel64/ippsDLPGenKeyPair.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00337.c => intel64/ippsDLPGenerateDH.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00335.c => intel64/ippsDLPGenerateDSA.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00325.c => intel64/ippsDLPGet.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00327.c => intel64/ippsDLPGetDP.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00320.c => intel64/ippsDLPGetSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00321.c => intel64/ippsDLPInit.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00322.c => intel64/ippsDLPPack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00329.c => intel64/ippsDLPPublicKey.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00324.c => intel64/ippsDLPSet.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00326.c => intel64/ippsDLPSetDP.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00331.c => intel64/ippsDLPSetKeyPair.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00334.c => intel64/ippsDLPSharedSecretDH.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00332.c => intel64/ippsDLPSignDSA.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00323.c => intel64/ippsDLPUnpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00338.c => intel64/ippsDLPValidateDH.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00336.c => intel64/ippsDLPValidateDSA.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00330.c => intel64/ippsDLPValidateKeyPair.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00333.c => intel64/ippsDLPVerifyDSA.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00251.c => intel64/ippsDiv_BN.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00339.c => intel64/ippsECCGetResultString.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00385.c => intel64/ippsECCPAddPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00368.c => intel64/ippsECCPBindGxyTblStd192r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00369.c => intel64/ippsECCPBindGxyTblStd224r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00370.c => intel64/ippsECCPBindGxyTblStd256r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00371.c => intel64/ippsECCPBindGxyTblStd384r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00372.c => intel64/ippsECCPBindGxyTblStd521r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00373.c => intel64/ippsECCPBindGxyTblStdSM2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00382.c => intel64/ippsECCPCheckPoint.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00383.c => intel64/ippsECCPComparePoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00387.c => intel64/ippsECCPGenKeyPair.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00374.c => intel64/ippsECCPGet.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00375.c => intel64/ippsECCPGetOrderBitSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00381.c => intel64/ippsECCPGetPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00340.c => intel64/ippsECCPGetSize.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00341.c => intel64/ippsECCPGetSizeStd128r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00342.c => intel64/ippsECCPGetSizeStd128r2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00343.c => intel64/ippsECCPGetSizeStd192r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00344.c => intel64/ippsECCPGetSizeStd224r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00345.c => intel64/ippsECCPGetSizeStd256r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00346.c => intel64/ippsECCPGetSizeStd384r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00347.c => intel64/ippsECCPGetSizeStd521r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00348.c => intel64/ippsECCPGetSizeStdSM2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00349.c => intel64/ippsECCPInit.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00350.c => intel64/ippsECCPInitStd128r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00351.c => intel64/ippsECCPInitStd128r2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00352.c => intel64/ippsECCPInitStd192r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00353.c => intel64/ippsECCPInitStd224r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00354.c => intel64/ippsECCPInitStd256r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00355.c => intel64/ippsECCPInitStd384r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00356.c => intel64/ippsECCPInitStd521r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00357.c => intel64/ippsECCPInitStdSM2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00386.c => intel64/ippsECCPMulPointScalar.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00384.c => intel64/ippsECCPNegativePoint.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00377.c => intel64/ippsECCPPointGetSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00378.c => intel64/ippsECCPPointInit.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00388.c => intel64/ippsECCPPublicKey.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00358.c => intel64/ippsECCPSet.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00390.c => intel64/ippsECCPSetKeyPair.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00379.c => intel64/ippsECCPSetPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00380.c => intel64/ippsECCPSetPointAtInfinity.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00359.c => intel64/ippsECCPSetStd.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00360.c => intel64/ippsECCPSetStd128r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00361.c => intel64/ippsECCPSetStd128r2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00362.c => intel64/ippsECCPSetStd192r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00363.c => intel64/ippsECCPSetStd224r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00364.c => intel64/ippsECCPSetStd256r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00365.c => intel64/ippsECCPSetStd384r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00366.c => intel64/ippsECCPSetStd521r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00367.c => intel64/ippsECCPSetStdSM2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00391.c => intel64/ippsECCPSharedSecretDH.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00392.c => intel64/ippsECCPSharedSecretDHC.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00393.c => intel64/ippsECCPSignDSA.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00395.c => intel64/ippsECCPSignNR.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00397.c => intel64/ippsECCPSignSM2.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00376.c => intel64/ippsECCPValidate.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00389.c => intel64/ippsECCPValidateKeyPair.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00394.c => intel64/ippsECCPVerifyDSA.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00396.c => intel64/ippsECCPVerifyNR.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00398.c => intel64/ippsECCPVerifySM2.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00246.c => intel64/ippsExtGet_BN.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00441.c => intel64/ippsGFpAdd.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00446.c => intel64/ippsGFpAdd_PE.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00433.c => intel64/ippsGFpCmpElement.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00436.c => intel64/ippsGFpConj.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00430.c => intel64/ippsGFpCpyElement.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00493.c => intel64/ippsGFpECAddPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00463.c => intel64/ippsGFpECBindGxyTblStd192r1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00464.c => intel64/ippsGFpECBindGxyTblStd224r1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00465.c => intel64/ippsGFpECBindGxyTblStd256r1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00466.c => intel64/ippsGFpECBindGxyTblStd384r1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00467.c => intel64/ippsGFpECBindGxyTblStd521r1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00468.c => intel64/ippsGFpECBindGxyTblStdSM2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00491.c => intel64/ippsGFpECCmpPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00490.c => intel64/ippsGFpECCpyPoint.c} (70%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext_DecMsgSize.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00512.c => intel64/ippsGFpECESDecrypt_SM2.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00511.c => intel64/ippsGFpECESEncrypt_SM2.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00513.c => intel64/ippsGFpECESFinal_SM2.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00514.c => intel64/ippsGFpECESGetBuffersSize_SM2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00507.c => intel64/ippsGFpECESGetSize_SM2.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00508.c => intel64/ippsGFpECESInit_SM2.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00509.c => intel64/ippsGFpECESSetKey_SM2.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00510.c => intel64/ippsGFpECESStart_SM2.c} (72%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext_EncMsgSize.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00469.c => intel64/ippsGFpECGet.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00506.c => intel64/ippsGFpECGetInfo_GF.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00484.c => intel64/ippsGFpECGetPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00487.c => intel64/ippsGFpECGetPointOctString.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00485.c => intel64/ippsGFpECGetPointRegular.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00450.c => intel64/ippsGFpECGetSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00470.c => intel64/ippsGFpECGetSubgroup.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00451.c => intel64/ippsGFpECInit.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00454.c => intel64/ippsGFpECInitStd128r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00455.c => intel64/ippsGFpECInitStd128r2.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00456.c => intel64/ippsGFpECInitStd192r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00457.c => intel64/ippsGFpECInitStd224r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00458.c => intel64/ippsGFpECInitStd256r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00459.c => intel64/ippsGFpECInitStd384r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00460.c => intel64/ippsGFpECInitStd521r1.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00462.c => intel64/ippsGFpECInitStdBN256.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00461.c => intel64/ippsGFpECInitStdSM2.c} (70%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Confirm.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_GetSize.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Init.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Setup.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_SharedKey.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00479.c => intel64/ippsGFpECMakePoint.c} (69%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMessageRepresentationSM2.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00494.c => intel64/ippsGFpECMulPoint.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00492.c => intel64/ippsGFpECNegPoint.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00473.c => intel64/ippsGFpECPointGetSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00474.c => intel64/ippsGFpECPointInit.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00495.c => intel64/ippsGFpECPrivateKey.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00496.c => intel64/ippsGFpECPublicKey.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00471.c => intel64/ippsGFpECScratchBufferSize.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00452.c => intel64/ippsGFpECSet.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00476.c => intel64/ippsGFpECSetPoint.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00475.c => intel64/ippsGFpECSetPointAtInfinity.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00480.c => intel64/ippsGFpECSetPointHash.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00481.c => intel64/ippsGFpECSetPointHashBackCompatible.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00483.c => intel64/ippsGFpECSetPointHashBackCompatible_rmf.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00482.c => intel64/ippsGFpECSetPointHash_rmf.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00486.c => intel64/ippsGFpECSetPointOctString.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00478.c => intel64/ippsGFpECSetPointRandom.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00477.c => intel64/ippsGFpECSetPointRegular.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00453.c => intel64/ippsGFpECSetSubgroup.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00498.c => intel64/ippsGFpECSharedSecretDH.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00499.c => intel64/ippsGFpECSharedSecretDHC.c} (66%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignDSA.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignNR.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignSM2.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00497.c => intel64/ippsGFpECTstKeyPair.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00488.c => intel64/ippsGFpECTstPoint.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00489.c => intel64/ippsGFpECTstPointInSubgroup.c} (68%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECUserIDHashSM2.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00472.c => intel64/ippsGFpECVerify.c} (70%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyDSA.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyNR.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifySM2.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00422.c => intel64/ippsGFpElementGetSize.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00423.c => intel64/ippsGFpElementInit.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00444.c => intel64/ippsGFpExp.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00431.c => intel64/ippsGFpGetElement.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00432.c => intel64/ippsGFpGetElementOctString.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00449.c => intel64/ippsGFpGetInfo.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00399.c => intel64/ippsGFpGetSize.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00402.c => intel64/ippsGFpInit.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00400.c => intel64/ippsGFpInitArbitrary.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00401.c => intel64/ippsGFpInitFixed.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00438.c => intel64/ippsGFpInv.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00435.c => intel64/ippsGFpIsUnityElement.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00434.c => intel64/ippsGFpIsZeroElement.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00403.c => intel64/ippsGFpMethod_p192r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00404.c => intel64/ippsGFpMethod_p224r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00410.c => intel64/ippsGFpMethod_p256.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00409.c => intel64/ippsGFpMethod_p256bn.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00405.c => intel64/ippsGFpMethod_p256r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00408.c => intel64/ippsGFpMethod_p256sm2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00406.c => intel64/ippsGFpMethod_p384r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00407.c => intel64/ippsGFpMethod_p521r1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00411.c => intel64/ippsGFpMethod_pArb.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00443.c => intel64/ippsGFpMul.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00448.c => intel64/ippsGFpMul_PE.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00445.c => intel64/ippsGFpMultiExp.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00437.c => intel64/ippsGFpNeg.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00421.c => intel64/ippsGFpScratchBufferSize.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00424.c => intel64/ippsGFpSetElement.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00428.c => intel64/ippsGFpSetElementHash.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00429.c => intel64/ippsGFpSetElementHash_rmf.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00426.c => intel64/ippsGFpSetElementOctString.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00427.c => intel64/ippsGFpSetElementRandom.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00425.c => intel64/ippsGFpSetElementRegular.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00440.c => intel64/ippsGFpSqr.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00439.c => intel64/ippsGFpSqrt.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00442.c => intel64/ippsGFpSub.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00447.c => intel64/ippsGFpSub_PE.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00412.c => intel64/ippsGFpxGetSize.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00413.c => intel64/ippsGFpxInit.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00414.c => intel64/ippsGFpxInitBinomial.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00419.c => intel64/ippsGFpxMethod_binom.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00417.c => intel64/ippsGFpxMethod_binom2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00415.c => intel64/ippsGFpxMethod_binom2_epid2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00418.c => intel64/ippsGFpxMethod_binom3.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00416.c => intel64/ippsGFpxMethod_binom3_epid2.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00420.c => intel64/ippsGFpxMethod_com.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00253.c => intel64/ippsGcd_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00256.c => intel64/ippsGetOctString_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00242.c => intel64/ippsGetSize_BN.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00244.c => intel64/ippsGet_BN.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00233.c => intel64/ippsHMACDuplicate_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00235.c => intel64/ippsHMACFinal_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00229.c => intel64/ippsHMACGetSize_rmf.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00236.c => intel64/ippsHMACGetTag_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00230.c => intel64/ippsHMACInit_rmf.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00237.c => intel64/ippsHMACMessage_rmf.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00231.c => intel64/ippsHMACPack_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00232.c => intel64/ippsHMACUnpack_rmf.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00234.c => intel64/ippsHMACUpdate_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00224.c => intel64/ippsHMAC_Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00226.c => intel64/ippsHMAC_Final.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00220.c => intel64/ippsHMAC_GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00227.c => intel64/ippsHMAC_GetTag.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00221.c => intel64/ippsHMAC_Init.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00228.c => intel64/ippsHMAC_Message.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00222.c => intel64/ippsHMAC_Pack.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00223.c => intel64/ippsHMAC_Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00225.c => intel64/ippsHMAC_Update.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00170.c => intel64/ippsHashDuplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00210.c => intel64/ippsHashDuplicate_rmf.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00173.c => intel64/ippsHashFinal.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00213.c => intel64/ippsHashFinal_rmf.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00216.c => intel64/ippsHashGetInfo_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00166.c => intel64/ippsHashGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00206.c => intel64/ippsHashGetSize_rmf.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00172.c => intel64/ippsHashGetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00212.c => intel64/ippsHashGetTag_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00167.c => intel64/ippsHashInit.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00207.c => intel64/ippsHashInit_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00174.c => intel64/ippsHashMessage.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00214.c => intel64/ippsHashMessage_rmf.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00215.c => intel64/ippsHashMethodGetInfo.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00190.c => intel64/ippsHashMethodGetSize.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00191.c => intel64/ippsHashMethodSet_MD5.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00193.c => intel64/ippsHashMethodSet_SHA1.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00194.c => intel64/ippsHashMethodSet_SHA1_NI.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00195.c => intel64/ippsHashMethodSet_SHA1_TT.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00199.c => intel64/ippsHashMethodSet_SHA224.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00200.c => intel64/ippsHashMethodSet_SHA224_NI.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00201.c => intel64/ippsHashMethodSet_SHA224_TT.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00196.c => intel64/ippsHashMethodSet_SHA256.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00197.c => intel64/ippsHashMethodSet_SHA256_NI.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00198.c => intel64/ippsHashMethodSet_SHA256_TT.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00203.c => intel64/ippsHashMethodSet_SHA384.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00202.c => intel64/ippsHashMethodSet_SHA512.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00205.c => intel64/ippsHashMethodSet_SHA512_224.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00204.c => intel64/ippsHashMethodSet_SHA512_256.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00192.c => intel64/ippsHashMethodSet_SM3.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00175.c => intel64/ippsHashMethod_MD5.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00177.c => intel64/ippsHashMethod_SHA1.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00178.c => intel64/ippsHashMethod_SHA1_NI.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00179.c => intel64/ippsHashMethod_SHA1_TT.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00183.c => intel64/ippsHashMethod_SHA224.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00184.c => intel64/ippsHashMethod_SHA224_NI.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00185.c => intel64/ippsHashMethod_SHA224_TT.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00180.c => intel64/ippsHashMethod_SHA256.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00181.c => intel64/ippsHashMethod_SHA256_NI.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00182.c => intel64/ippsHashMethod_SHA256_TT.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00187.c => intel64/ippsHashMethod_SHA384.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00186.c => intel64/ippsHashMethod_SHA512.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00189.c => intel64/ippsHashMethod_SHA512_224.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00188.c => intel64/ippsHashMethod_SHA512_256.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00176.c => intel64/ippsHashMethod_SM3.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00168.c => intel64/ippsHashPack.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00208.c => intel64/ippsHashPack_rmf.c} (70%) create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_NI.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_TT.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_NI.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_TT.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA384.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_224.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_256.c create mode 100644 sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SM3.c rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00169.c => intel64/ippsHashUnpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00209.c => intel64/ippsHashUnpack_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00171.c => intel64/ippsHashUpdate.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00211.c => intel64/ippsHashUpdate_rmf.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00250.c => intel64/ippsMAC_BN_I.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00150.c => intel64/ippsMD5Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00155.c => intel64/ippsMD5Final.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00148.c => intel64/ippsMD5GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00154.c => intel64/ippsMD5GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00149.c => intel64/ippsMD5Init.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00156.c => intel64/ippsMD5MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00151.c => intel64/ippsMD5Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00152.c => intel64/ippsMD5Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00153.c => intel64/ippsMD5Update.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00217.c => intel64/ippsMGF.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00218.c => intel64/ippsMGF1_rmf.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00219.c => intel64/ippsMGF2_rmf.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00254.c => intel64/ippsModInv_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00252.c => intel64/ippsMod_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00263.c => intel64/ippsMontExp.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00261.c => intel64/ippsMontForm.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00260.c => intel64/ippsMontGet.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00257.c => intel64/ippsMontGetSize.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00258.c => intel64/ippsMontInit.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00262.c => intel64/ippsMontMul.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00259.c => intel64/ippsMontSet.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00249.c => intel64/ippsMul_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00270.c => intel64/ippsPRNGGetSeed.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00264.c => intel64/ippsPRNGGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00265.c => intel64/ippsPRNGInit.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00268.c => intel64/ippsPRNGSetAugment.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00267.c => intel64/ippsPRNGSetH0.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00266.c => intel64/ippsPRNGSetModulus.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00269.c => intel64/ippsPRNGSetSeed.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00271.c => intel64/ippsPRNGen.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00273.c => intel64/ippsPRNGenRDRAND.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00274.c => intel64/ippsPRNGenRDRAND_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00272.c => intel64/ippsPRNGen_BN.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00279.c => intel64/ippsPrimeGen.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00281.c => intel64/ippsPrimeGen_BN.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00283.c => intel64/ippsPrimeGet.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00277.c => intel64/ippsPrimeGetSize.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00284.c => intel64/ippsPrimeGet_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00278.c => intel64/ippsPrimeInit.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00285.c => intel64/ippsPrimeSet.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00286.c => intel64/ippsPrimeSet_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00280.c => intel64/ippsPrimeTest.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00282.c => intel64/ippsPrimeTest_BN.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00306.c => intel64/ippsRSADecrypt_OAEP.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00308.c => intel64/ippsRSADecrypt_OAEP_rmf.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00310.c => intel64/ippsRSADecrypt_PKCSv15.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00305.c => intel64/ippsRSAEncrypt_OAEP.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00307.c => intel64/ippsRSAEncrypt_OAEP_rmf.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00309.c => intel64/ippsRSAEncrypt_PKCSv15.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00315.c => intel64/ippsRSASign_PKCS1v15.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00317.c => intel64/ippsRSASign_PKCS1v15_rmf.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00311.c => intel64/ippsRSASign_PSS.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00313.c => intel64/ippsRSASign_PSS_rmf.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00316.c => intel64/ippsRSAVerify_PKCS1v15.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00318.c => intel64/ippsRSAVerify_PKCS1v15_rmf.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00312.c => intel64/ippsRSAVerify_PSS.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00314.c => intel64/ippsRSAVerify_PSS_rmf.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00302.c => intel64/ippsRSA_Decrypt.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00301.c => intel64/ippsRSA_Encrypt.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00303.c => intel64/ippsRSA_GenerateKeys.c} (62%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00300.c => intel64/ippsRSA_GetBufferSizePrivateKey.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00299.c => intel64/ippsRSA_GetBufferSizePublicKey.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00294.c => intel64/ippsRSA_GetPrivateKeyType1.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00298.c => intel64/ippsRSA_GetPrivateKeyType2.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00290.c => intel64/ippsRSA_GetPublicKey.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00291.c => intel64/ippsRSA_GetSizePrivateKeyType1.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00295.c => intel64/ippsRSA_GetSizePrivateKeyType2.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00287.c => intel64/ippsRSA_GetSizePublicKey.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00292.c => intel64/ippsRSA_InitPrivateKeyType1.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00296.c => intel64/ippsRSA_InitPrivateKeyType2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00288.c => intel64/ippsRSA_InitPublicKey.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00293.c => intel64/ippsRSA_SetPrivateKeyType1.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00297.c => intel64/ippsRSA_SetPrivateKeyType2.c} (64%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00289.c => intel64/ippsRSA_SetPublicKey.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00304.c => intel64/ippsRSA_ValidateKeys.c} (62%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00245.c => intel64/ippsRef_BN.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00105.c => intel64/ippsSHA1Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00110.c => intel64/ippsSHA1Final.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00103.c => intel64/ippsSHA1GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00109.c => intel64/ippsSHA1GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00104.c => intel64/ippsSHA1Init.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00111.c => intel64/ippsSHA1MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00106.c => intel64/ippsSHA1Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00107.c => intel64/ippsSHA1Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00108.c => intel64/ippsSHA1Update.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00114.c => intel64/ippsSHA224Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00119.c => intel64/ippsSHA224Final.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00112.c => intel64/ippsSHA224GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00118.c => intel64/ippsSHA224GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00113.c => intel64/ippsSHA224Init.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00120.c => intel64/ippsSHA224MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00115.c => intel64/ippsSHA224Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00116.c => intel64/ippsSHA224Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00117.c => intel64/ippsSHA224Update.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00123.c => intel64/ippsSHA256Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00128.c => intel64/ippsSHA256Final.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00121.c => intel64/ippsSHA256GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00127.c => intel64/ippsSHA256GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00122.c => intel64/ippsSHA256Init.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00129.c => intel64/ippsSHA256MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00124.c => intel64/ippsSHA256Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00125.c => intel64/ippsSHA256Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00126.c => intel64/ippsSHA256Update.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00132.c => intel64/ippsSHA384Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00137.c => intel64/ippsSHA384Final.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00130.c => intel64/ippsSHA384GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00136.c => intel64/ippsSHA384GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00131.c => intel64/ippsSHA384Init.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00138.c => intel64/ippsSHA384MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00133.c => intel64/ippsSHA384Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00134.c => intel64/ippsSHA384Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00135.c => intel64/ippsSHA384Update.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00141.c => intel64/ippsSHA512Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00146.c => intel64/ippsSHA512Final.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00139.c => intel64/ippsSHA512GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00145.c => intel64/ippsSHA512GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00140.c => intel64/ippsSHA512Init.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00147.c => intel64/ippsSHA512MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00142.c => intel64/ippsSHA512Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00143.c => intel64/ippsSHA512Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00144.c => intel64/ippsSHA512Update.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00159.c => intel64/ippsSM3Duplicate.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00164.c => intel64/ippsSM3Final.c} (72%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00157.c => intel64/ippsSM3GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00163.c => intel64/ippsSM3GetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00158.c => intel64/ippsSM3Init.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00165.c => intel64/ippsSM3MessageDigest.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00160.c => intel64/ippsSM3Pack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00161.c => intel64/ippsSM3Unpack.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00162.c => intel64/ippsSM3Update.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00048.c => intel64/ippsSMS4DecryptCBC.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00049.c => intel64/ippsSMS4DecryptCBC_CS1.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00050.c => intel64/ippsSMS4DecryptCBC_CS2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00051.c => intel64/ippsSMS4DecryptCBC_CS3.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00053.c => intel64/ippsSMS4DecryptCFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00057.c => intel64/ippsSMS4DecryptCTR.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00043.c => intel64/ippsSMS4DecryptECB.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00055.c => intel64/ippsSMS4DecryptOFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00044.c => intel64/ippsSMS4EncryptCBC.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00045.c => intel64/ippsSMS4EncryptCBC_CS1.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00046.c => intel64/ippsSMS4EncryptCBC_CS2.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00047.c => intel64/ippsSMS4EncryptCBC_CS3.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00052.c => intel64/ippsSMS4EncryptCFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00056.c => intel64/ippsSMS4EncryptCTR.c} (67%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00042.c => intel64/ippsSMS4EncryptECB.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00054.c => intel64/ippsSMS4EncryptOFB.c} (68%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00039.c => intel64/ippsSMS4GetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00040.c => intel64/ippsSMS4Init.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00041.c => intel64/ippsSMS4SetKey.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00064.c => intel64/ippsSMS4_CCMDecrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00063.c => intel64/ippsSMS4_CCMEncrypt.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00058.c => intel64/ippsSMS4_CCMGetSize.c} (73%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00065.c => intel64/ippsSMS4_CCMGetTag.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00059.c => intel64/ippsSMS4_CCMInit.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00060.c => intel64/ippsSMS4_CCMMessageLen.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00062.c => intel64/ippsSMS4_CCMStart.c} (69%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00061.c => intel64/ippsSMS4_CCMTagLen.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00255.c => intel64/ippsSetOctString_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00243.c => intel64/ippsSet_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00248.c => intel64/ippsSub_BN.c} (70%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00008.c => intel64/ippsTDESDecryptCBC.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00010.c => intel64/ippsTDESDecryptCFB.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00014.c => intel64/ippsTDESDecryptCTR.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00006.c => intel64/ippsTDESDecryptECB.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00012.c => intel64/ippsTDESDecryptOFB.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00007.c => intel64/ippsTDESEncryptCBC.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00009.c => intel64/ippsTDESEncryptCFB.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00013.c => intel64/ippsTDESEncryptCTR.c} (65%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00005.c => intel64/ippsTDESEncryptECB.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00011.c => intel64/ippsTDESEncryptOFB.c} (66%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00275.c => intel64/ippsTRNGenRDSEED.c} (71%) rename sdk/tlibcrypto/ipp/ipp_disp/{ippcpsgx_disp00276.c => intel64/ippsTRNGenRDSEED_BN.c} (70%) delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00078.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00500.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00501.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00502.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00503.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00504.c delete mode 100644 sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00505.c create mode 100644 sdk/trts/linux/trts_mitigation.S create mode 100644 sdk/trts/trts_aex.cpp create mode 100644 sdk/trts/trts_mitigation.h diff --git a/.gitignore b/.gitignore index 91108d86e..985d74827 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ /linux/installer/bin/*.bin # files downloaded in preparation phase -Intel redistributable binary.txt +BSD-3-Clause.txt Master_EULA_for_Intel_Sw_Development_Products.pdf external/ippcp_internal/inc/ippcp.h external/ippcp_internal/inc/ippcpdefs.h diff --git a/.gitmodules b/.gitmodules index 9f21e4a0c..d980c15ab 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,7 +12,7 @@ [submodule "ipp-crypto"] path = external/ippcp_internal/ipp-crypto url = https://github.com/intel/ipp-crypto.git - branch = ipp-crypto_2021_3 + branch = ipp-crypto_2021_7 [submodule "external/protobuf/protobuf_code"] path = external/protobuf/protobuf_code url = https://github.com/protocolbuffers/protobuf.git @@ -20,3 +20,6 @@ [submodule "external/sgx-emm/emm_src"] path = external/sgx-emm/emm_src url = https://github.com/intel/sgx-emm.git +[submodule "external/mbedtls/mbedtls_code"] + path = external/mbedtls/mbedtls_code + url = https://github.com/Mbed-TLS/mbedtls.git diff --git a/Linux_SGXEclipsePlugin/readme.txt b/Linux_SGXEclipsePlugin/readme.txt index e602a6868..15e77b0b4 100644 --- a/Linux_SGXEclipsePlugin/readme.txt +++ b/Linux_SGXEclipsePlugin/readme.txt @@ -6,7 +6,7 @@ $DELETE_CURRENT_ECLIPSE - Delete current eclipse or not. Generally this variable The following plugins are pre-requisites to be installed in Eclipse before trying to build the plugin. -1. Eclipse IDE for C/C++ Developers 4.7.3.20180308-1800 (tested_version) +1. Eclipse IDE for C/C++ Developers 4.21.0.20210910-1417 (tested_version) 2. Eclipse PDE Plug-in Developer Resources 3.13.3.v20180301-11 (tested_version) run ./build.sh from command line under current directory. diff --git a/README.md b/README.md index b89b31f6c..4a4cde36c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ The [intel-sgx-ssl](https://github.com/intel/intel-sgx-ssl) project provides a f This repository provides a reference implementation of a Launch Enclave for 'Flexible Launch Control' under [psw/ae/ref_le](psw/ae/ref_le). The reference LE implementation can be used as a basis for enforcing different launch control policy by the platform developer or owner. To build and try it by yourself, please refer to the [ref_le.md](psw/ae/ref_le/ref_le.md) for details. +**NOTE**: The reference LE is only workable with [linux-sgx-driver](https://github.com/intel/linux-sgx-driver) and is planned to be deprecated starting from Intel(R) SGX release 2.20. License ------- @@ -73,7 +74,7 @@ Quick Start with Docker and Docker Compose $ cd docker/build && ./build_compose_run.sh ``` -- Use prebuilt PSW and SDK downloaded from 01.org. See this [README](linux/installer/docker/README.md) for details. +- Build and deploy SGX exclave applications using prebuilt PSW and SDK downloaded from 01.org. See this [README](linux/installer/docker/README.md) for details. ``` $ cd linux/installer/docker && ./build_compose_run.sh ``` diff --git a/SampleCode/SampleAEXNotify/App/App.cpp b/SampleCode/SampleAEXNotify/App/App.cpp new file mode 100644 index 000000000..061634cb8 --- /dev/null +++ b/SampleCode/SampleAEXNotify/App/App.cpp @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include + +# include +# include +# define MAX_PATH FILENAME_MAX +#include +#include "powers_of_two.h" +#include "sgx_urts.h" +#include "App.h" +#include "Enclave_u.h" + +/* Global EID shared by multiple threads */ +sgx_enclave_id_t global_eid = 0; + +typedef struct _sgx_errlist_t { + sgx_status_t err; + const char *msg; + const char *sug; /* Suggestion */ +} sgx_errlist_t; + +/* Error code returned by sgx_create_enclave */ +static sgx_errlist_t sgx_errlist[] = { + { + SGX_ERROR_UNEXPECTED, + "Unexpected error occurred.", + NULL + }, + { + SGX_ERROR_INVALID_PARAMETER, + "Invalid parameter.", + NULL + }, + { + SGX_ERROR_OUT_OF_MEMORY, + "Out of memory.", + NULL + }, + { + SGX_ERROR_ENCLAVE_LOST, + "Power transition occurred.", + "Please refer to the sample \"PowerTransition\" for details." + }, + { + SGX_ERROR_INVALID_ENCLAVE, + "Invalid enclave image.", + NULL + }, + { + SGX_ERROR_INVALID_ENCLAVE_ID, + "Invalid enclave identification.", + NULL + }, + { + SGX_ERROR_INVALID_SIGNATURE, + "Invalid enclave signature.", + NULL + }, + { + SGX_ERROR_OUT_OF_EPC, + "Out of EPC memory.", + NULL + }, + { + SGX_ERROR_NO_DEVICE, + "Invalid SGX device.", + "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards." + }, + { + SGX_ERROR_MEMORY_MAP_CONFLICT, + "Memory map conflicted.", + NULL + }, + { + SGX_ERROR_INVALID_METADATA, + "Invalid enclave metadata.", + NULL + }, + { + SGX_ERROR_DEVICE_BUSY, + "SGX device was busy.", + NULL + }, + { + SGX_ERROR_INVALID_VERSION, + "Enclave version was invalid.", + NULL + }, + { + SGX_ERROR_INVALID_ATTRIBUTE, + "Enclave was not authorized.", + NULL + }, + { + SGX_ERROR_ENCLAVE_FILE_ACCESS, + "Can't open enclave file.", + NULL + }, +}; + +/* Check error conditions for loading enclave */ +void print_error_message(sgx_status_t ret) +{ + size_t idx = 0; + size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; + + for (idx = 0; idx < ttl; idx++) { + if(ret == sgx_errlist[idx].err) { + if(NULL != sgx_errlist[idx].sug) + printf("Info: %s\n", sgx_errlist[idx].sug); + printf("Error: %s\n", sgx_errlist[idx].msg); + break; + } + } + + if (idx == ttl) + printf("Error code is 0x%X. Please refer to the \"Intel SGX SDK Developer Reference\" for more details.\n", ret); +} + +/* Initialize the enclave: + * Call sgx_create_enclave to initialize an enclave instance + */ +int initialize_enclave(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + /* Call sgx_create_enclave to initialize an enclave instance */ + /* Debug Support: set 2nd parameter to 1 */ + ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, NULL, NULL, &global_eid, NULL); + if (ret != SGX_SUCCESS) { + print_error_message(ret); + return -1; + } + + return 0; +} + +/* OCall functions */ +void ocall_print_string(const char *str) +{ + /* Proxy/Bridge will check the length and null-terminate + * the input string to prevent buffer overflow. + */ + printf("%s", str); +} + + +/* Application entry */ +int SGX_CDECL main(int argc, char *argv[]) +{ + (void)(argc); + (void)(argv); + + + /* Initialize the enclave */ + if(initialize_enclave() < 0){ + printf("Enter a character before exit ...\n"); + getchar(); + return -1; + } + + // We want to run a program for a really long time by + // searching for powers of two between 0 and max_value. + // Our initial max_value guess for something that will + // take about 60 seconds is 0xffff. + uint64_t max_value = 0xffff; + time_t t1 = 0, t2 = 0; + uint32_t count = 0; + + // Find out what max value takes more than 60 seconds when running + // outside the enclave. + while ((t2 - t1) < 60) + { + if ((t2 - t1) < 30) + max_value *= 4; + else + max_value *= 2; + + t1 = time(NULL); + count = count_powers_of_two(0, max_value); + t2 = time(NULL); + printf("There are %u powers of two between 0 and %p (calculated outside the enclave)\n", count, (void*)max_value); + printf("\tIt took %u seconds to compute\n", (uint32_t)(t2 - t1)); + fflush(stdout); + } + + // Now we have a good idea of something that should take at least 60 seconds + // Make an ECALL for the same function with AEX Enabled. The function + // will also count the number of times it its AEX handler was called back. + count = 0; + uint64_t aex_count = 0; + t1 = time(NULL); + sgx_status_t status = count_powers_of_two_with_aex(global_eid, 0, max_value, &count, &aex_count); + t2 = time(NULL); + if (status != SGX_SUCCESS) + { + printf("count_powers_of_two_with_aex returned %#x\n", status); + print_error_message(status); + return -1; + } + printf("There are %u powers of two between 0 and %p (calculated inside the enclave)\n", count, (void*)max_value); + printf("\tIt took %u seconds to compute\n", (uint32_t)(t2 - t1)); + printf("\tWe counted %lu async enclave exits during this time period. \n", aex_count); + + /* Destroy the enclave */ + sgx_destroy_enclave(global_eid); + + printf("Info: SampleAEXNotify successfully returned.\n"); + + return 0; +} + diff --git a/SampleCode/SampleAEXNotify/App/App.h b/SampleCode/SampleAEXNotify/App/App.h new file mode 100644 index 000000000..485b47519 --- /dev/null +++ b/SampleCode/SampleAEXNotify/App/App.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _APP_H_ +#define _APP_H_ + +#include +#include +#include +#include + +#include "sgx_error.h" /* sgx_status_t */ +#include "sgx_eid.h" /* sgx_enclave_id_t */ + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +# define TOKEN_FILENAME "enclave.token" +# define ENCLAVE_FILENAME "enclave.signed.so" + +extern sgx_enclave_id_t global_eid; /* global enclave id */ + +#endif /* !_APP_H_ */ diff --git a/SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml b/SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml new file mode 100644 index 000000000..833b1dbbb --- /dev/null +++ b/SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml @@ -0,0 +1,13 @@ + + 0 + 0 + 0x40000 + 0x100000 + 10 + 1 + 1 + + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/SampleAEXNotify/Enclave/Enclave.cpp b/SampleCode/SampleAEXNotify/Enclave/Enclave.cpp new file mode 100644 index 000000000..30ab6f0e3 --- /dev/null +++ b/SampleCode/SampleAEXNotify/Enclave/Enclave.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "Enclave.h" +#include "Enclave_t.h" /* print_string */ +#include +#include /* vsnprintf */ +#include +#include +#include +#include + +#include "powers_of_two.h" + +void count_powers_of_two(uint64_t low, uint64_t high, uint32_t* count) +{ + if(!count) return; + const uint32_t local_count = count_powers_of_two(low,high); + *count = local_count; +} + +/* + * printf: + * Invokes OCALL to display the enclave buffer to the terminal. + */ +int printf(const char* fmt, ...) +{ + char buf[BUFSIZ] = { '\0' }; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, BUFSIZ, fmt, ap); + va_end(ap); + ocall_print_string(buf); + return (int)strnlen(buf, BUFSIZ - 1) + 1; +} + +uint64_t g_aex_count = 0; + +static void my_aex_notify_handler(const sgx_exception_info_t *info, const void * args) +{ + // This sample will not perform any additional mitigations beyond what the trts + // does. It will do some simple counting. + (void)info; + (void)args; + g_aex_count++; +} + +// Count the number of powers of two between [low, high]. +// Also count the number of times our AEX-Notify handler was called. +// If the function runs long enough, normal OS preemptive multitasking +// should generate an AEX. +// You can use additional threads and thread affinity to change the OS +// behavior and induce more async enclave exits as needed. +void count_powers_of_two_with_aex(uint64_t low, uint64_t high, uint32_t* count, uint64_t* aex_count) +{ + if(!count) return; + if(!aex_count) return; + + g_aex_count = 0; + + const char* args = NULL; + sgx_aex_mitigation_node_t node; + + sgx_register_aex_handler(&node, my_aex_notify_handler, (const void*)args); + sgx_set_ssa_aexnotify(1); + + const uint32_t local_count = count_powers_of_two(low,high); + *count = local_count; + + sgx_set_ssa_aexnotify(0); + sgx_unregister_aex_handler(my_aex_notify_handler); + + *aex_count = g_aex_count; +} + + diff --git a/SampleCode/SampleAEXNotify/Enclave/Enclave.edl b/SampleCode/SampleAEXNotify/Enclave/Enclave.edl new file mode 100644 index 000000000..362481fce --- /dev/null +++ b/SampleCode/SampleAEXNotify/Enclave/Enclave.edl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Enclave.edl - Top EDL file. */ + +enclave { + + trusted { + /* + * count_powers_of_two_with_aex - Counts the number of powers of two between low and high, and also + * the number of async enclave exits during this process. + */ + public void count_powers_of_two_with_aex(uint64_t low, uint64_t high, [out] uint32_t* count, [out] uint64_t* aex_count); + }; + + + /* + * ocall_print_string - invokes OCALL to display string buffer inside the enclave. + * [in]: copy the string buffer to App outside. + * [string]: specifies 'str' is a NULL terminated buffer. + */ + untrusted { + void ocall_print_string([in, string] const char *str); + }; + +}; diff --git a/SampleCode/SampleAEXNotify/Enclave/Enclave.h b/SampleCode/SampleAEXNotify/Enclave/Enclave.h new file mode 100644 index 000000000..f6bb82b59 --- /dev/null +++ b/SampleCode/SampleAEXNotify/Enclave/Enclave.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _ENCLAVE_H_ +#define _ENCLAVE_H_ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +int printf(const char* fmt, ...); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_ENCLAVE_H_ */ diff --git a/SampleCode/SampleAEXNotify/Enclave/Enclave.lds b/SampleCode/SampleAEXNotify/Enclave/Enclave.lds new file mode 100644 index 000000000..0d5614f55 --- /dev/null +++ b/SampleCode/SampleAEXNotify/Enclave/Enclave.lds @@ -0,0 +1,11 @@ +enclave.so +{ + global: + g_global_data_sim; + g_global_data; + enclave_entry; + g_peak_heap_used; + g_peak_rsrv_mem_committed; + local: + *; +}; diff --git a/SampleCode/SampleAEXNotify/Include/powers_of_two.h b/SampleCode/SampleAEXNotify/Include/powers_of_two.h new file mode 100644 index 000000000..309e5bd2b --- /dev/null +++ b/SampleCode/SampleAEXNotify/Include/powers_of_two.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#pragma once + +#ifndef _POWERS_OF_TWO_H__ +#define _POWERS_OF_TWO_H__ + +#include + +static bool is_power_of_two(uint64_t x) +{ + return ((x != 0) && !(x & (x - 1))); +} + +// The not fastest way to calculate the number of powers of two between [low, high] +static uint32_t count_powers_of_two(uint64_t low, uint64_t high) +{ + + uint32_t num = 0; + for (uint64_t i = low; i <= high; i++) + { + if (is_power_of_two(i)) + num++; + } + return num; +} + +#endif /* !_POWERS_OF_TWO_H__ */ diff --git a/SampleCode/SampleAEXNotify/Makefile b/SampleCode/SampleAEXNotify/Makefile new file mode 100644 index 000000000..289d8ca79 --- /dev/null +++ b/SampleCode/SampleAEXNotify/Makefile @@ -0,0 +1,250 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +######## SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= HW +SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 + +include $(SGX_SDK)/buildenv.mk + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_FLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_FLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifneq ($(SGX_MODE), HW) +$(error Only support HW mode for AEX Notify!!) +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_FLAGS += -O0 -g +else + SGX_COMMON_FLAGS += -O2 +endif + +SGX_COMMON_FLAGS += -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type \ + -Waddress -Wsequence-point -Wformat-security \ + -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow \ + -Wcast-align -Wcast-qual -Wconversion -Wredundant-decls +SGX_COMMON_CFLAGS := $(SGX_COMMON_FLAGS) -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants +SGX_COMMON_CXXFLAGS := $(SGX_COMMON_FLAGS) -Wnon-virtual-dtor -std=c++11 + +######## App Settings ######## + +Urts_Library_Name := sgx_urts + +App_Cpp_Files := App/App.cpp +App_Include_Paths := -IInclude -IApp -I$(SGX_SDK)/include + +App_C_Flags := -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) +App_Link_Flags := -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) + +App_Name := app + +######## Enclave Settings ######## + +Trts_Library_Name := sgx_trts +Service_Library_Name := sgx_tservice + +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files := Enclave/Enclave.cpp +Enclave_Include_Paths := -IInclude -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx + +Enclave_C_Flags := $(Enclave_Include_Paths) -nostdinc -fvisibility=hidden -fpie -ffunction-sections -fdata-sections $(MITIGATION_CFLAGS) +CC_BELOW_4_9 := $(shell expr "`$(CC) -dumpversion`" \< "4.9") +ifeq ($(CC_BELOW_4_9), 1) + Enclave_C_Flags += -fstack-protector +else + Enclave_C_Flags += -fstack-protector-strong +endif + +Enclave_Cpp_Flags := $(Enclave_C_Flags) -nostdinc++ + +# Enable the security flags +Enclave_Security_Link_Flags := -Wl,-z,relro,-z,now,-z,noexecstack + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. +Enclave_Link_Flags := $(MITIGATION_LDFLAGS) $(Enclave_Security_Link_Flags) \ + -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_TRUSTED_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 -Wl,--gc-sections \ + -Wl,--version-script=Enclave/Enclave.lds + +Enclave_Cpp_Objects := $(sort $(Enclave_Cpp_Files:.cpp=.o)) + +Enclave_Name := enclave.so +Signed_Enclave_Name := enclave.signed.so +Enclave_Config_File := Enclave/Enclave.config.xml +Enclave_Test_Key := Enclave/Enclave_private_test.pem + +ifeq ($(SGX_MODE), HW) +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE +endif +endif + + +.PHONY: all target run +all: .config_$(Build_Mode)_$(SGX_ARCH) + @$(MAKE) target + +ifeq ($(Build_Mode), HW_RELEASE) +target: $(App_Name) $(Enclave_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclave use the command:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" + @echo "You can also sign the enclave using an external signing tool." + +else +target: $(App_Name) $(Signed_Enclave_Name) +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +endif +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/$(App_Name) + @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +.config_$(Build_Mode)_$(SGX_ARCH): + @rm -f .config_* $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* + @touch .config_$(Build_Mode)_$(SGX_ARCH) + +######## App Objects ######## + +App/Enclave_u.h: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave_u.c: App/Enclave_u.h + +App/Enclave_u.o: App/Enclave_u.c + @$(CC) $(SGX_COMMON_CFLAGS) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +App/%.o: App/%.cpp App/Enclave_u.h + @$(CXX) $(SGX_COMMON_CXXFLAGS) $(App_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): App/Enclave_u.o $(App_Cpp_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + +######## Enclave Objects ######## + +Enclave/Enclave_t.h: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd Enclave && $(SGX_EDGER8R) --trusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave/Enclave_t.c: Enclave/Enclave_t.h + +Enclave/Enclave_t.o: Enclave/Enclave_t.c + @$(CC) $(SGX_COMMON_CFLAGS) $(Enclave_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave/%.o: Enclave/%.cpp Enclave/Enclave_t.h + @$(CXX) $(SGX_COMMON_CXXFLAGS) $(Enclave_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) + @$(CXX) $^ -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Signed_Enclave_Name): $(Enclave_Name) +ifeq ($(wildcard $(Enclave_Test_Key)),) + @echo "There is no enclave test key." + @echo "The project will generate a key for test." + @openssl genrsa -out $(Enclave_Test_Key) -3 3072 +endif + @$(SGX_ENCLAVE_SIGNER) sign -key $(Enclave_Test_Key) -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) + @echo "SIGN => $@" + +.PHONY: clean + +clean: + @rm -f .config_* $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* $(Enclave_Test_Key) diff --git a/SampleCode/SampleAEXNotify/README.txt b/SampleCode/SampleAEXNotify/README.txt new file mode 100644 index 000000000..b5751326d --- /dev/null +++ b/SampleCode/SampleAEXNotify/README.txt @@ -0,0 +1,86 @@ +------------------------ +Purpose of SampleAEXNotify +------------------------ +The project demonstrates the AEXNotify mitigation for Intel(R) Software Guard +Extensions (Intel(R) SGX) SDK projects development. + +------------------------------------ +Prerequisite of the Sample Code +------------------------------------ +To enable AEX-Notify feature in an enclave, the hardware must support it +and the in-kernel driver must be v6.2 or later. + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Make sure your environment is set: + $ source ${sgx-sdk-install-path}/environment +3. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + 1) Enclave with no mitigation: + $ make + 2) Enclave with mitigations for indirects and returns only: + $ make MITIGATION-CVE-2020-0551=CF + 3) Enclave with full mitigation: + $ make MITIGATION-CVE-2020-0551=LOAD + b. Hardware Mode, Pre-release build: + 1) Enclave with no mitigation: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 + 2) Enclave with mitigations for indirects and returns only: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 MITIGATION-CVE-2020-0551=CF + 3) Enclave with full mitigation: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 MITIGATION-CVE-2020-0551=LOAD + c. Hardware Mode, Release build: + 1) Enclave with no mitigation: + $ make SGX_DEBUG=0 + 2) Enclave with mitigations for indirects and returns only: + $ make SGX_DEBUG=0 MITIGATION-CVE-2020-0551=CF + 3) Enclave with full mitigation: + $ make SGX_DEBUG=0 MITIGATION-CVE-2020-0551=LOAD +4. Execute the binary directly: + $ ./app +5. Remember to "make clean" before switching build mode + +------------------------------------------ +Explanation about Configuration Parameters +------------------------------------------ +EnableAEXNotify + + Enables the AEX-Notify feature in the enclave. + +TCSMaxNum, TCSNum, TCSMinPool + + These three parameters will determine whether a thread will be created + dynamically when there is no available thread to do the work. + + +StackMaxSize, StackMinSize + + For a dynamically created thread, StackMinSize is the amount of stack available + once the thread is created and StackMaxSize is the total amount of stack that + thread can use. The gap between StackMinSize and StackMaxSize is the stack + dynamically expanded as necessary at runtime. + + For a static thread, only StackMaxSize is relevant which specifies the total + amount of stack available to the thread. + + +HeapMaxSize, HeapInitSize, HeapMinSize + + HeapMinSize is the amount of heap available once the enclave is initialized. + + HeapMaxSize is the total amount of heap an enclave can use. The gap between + HeapMinSize and HeapMaxSize is the heap dynamically expanded as necessary + at runtime. + + HeapInitSize is here for compatibility. + + +------------------------------------------------- +Launch token initialization +------------------------------------------------- +If using libsgx-enclave-common or sgxpsw under version 2.4, an initialized variable launch_token needs to be passed as the 3rd parameter of API sgx_create_enclave. For example, + +sgx_launch_token_t launch_token = {0}; +sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, launch_token, NULL, &global_eid, NULL); diff --git a/SampleCode/SampleAttestedTLS/common/utility.cpp b/SampleCode/SampleAttestedTLS/common/utility.cpp index fd144eb96..688160e7e 100644 --- a/SampleCode/SampleAttestedTLS/common/utility.cpp +++ b/SampleCode/SampleAttestedTLS/common/utility.cpp @@ -53,20 +53,20 @@ int get_pkey_by_rsa(EVP_PKEY *pk) e = BN_new(); if (!e) { PRINT("BN_new failed\n"); - return res; + goto done; } res = BN_set_word(e, (BN_ULONG)RSA_F4); if (!res) { PRINT("BN_set_word failed (%d)\n", res); - return res; + goto done; } rsa = RSA_new(); if (!rsa) { PRINT("RSA_new failed\n"); res = -1; - return res; + goto done; } res = RSA_generate_key_ex( @@ -79,12 +79,15 @@ int get_pkey_by_rsa(EVP_PKEY *pk) if (!res) { PRINT("RSA_generate_key failed (%d)\n", res); - return res; + goto done; } // Assign RSA key to EVP_PKEY structure EVP_PKEY_assign_RSA(pk, rsa); +done: + if (e) + BN_clear_free(e); return res; } @@ -100,14 +103,14 @@ int get_pkey_by_ec(EVP_PKEY *pk) if (res <= 0) { PRINT("EC_generate_key failed (%d)\n", res); - return res; + goto done; } res = EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, NID_secp384r1); if (res <= 0) { PRINT("EC_generate_key failed (%d)\n", res); - return res; + goto done; } /* Generate key */ @@ -115,9 +118,13 @@ int get_pkey_by_ec(EVP_PKEY *pk) if (res <= 0) { PRINT("EC_generate_key failed (%d)\n", res); - return res; + goto done; } +done: + if (ctx) + EVP_PKEY_CTX_free(ctx); + return res; } diff --git a/SampleCode/SampleAttestedTLS/server_tdx/Makefile b/SampleCode/SampleAttestedTLS/server_tdx/Makefile index f640f69ca..314ce2310 100644 --- a/SampleCode/SampleAttestedTLS/server_tdx/Makefile +++ b/SampleCode/SampleAttestedTLS/server_tdx/Makefile @@ -35,7 +35,7 @@ all: server server: $(CXX) -c -DTDX_ENV -DCLIENT_USE_QVL $(App_Cpp_Flags) server.cpp openssl_server.cpp ../common/verify_callback.cpp ../common/utility.cpp ../common/openssl_utility.cpp ../common/err_msg.cpp - $(CXX) -o tls_server server.o openssl_server.o verify_callback.o utility.o openssl_utility.o err_msg.o $(App_Link_Flags) -lssl -ltdx_tls -lsgx_dcap_quoteverify -l:libtdx_attest.so.1 + $(CXX) -o tls_server server.o openssl_server.o verify_callback.o utility.o openssl_utility.o err_msg.o $(App_Link_Flags) -lssl -ltdx_tls -lsgx_dcap_quoteverify -ltdx_attest clean: rm -f tls_server *.o diff --git a/SampleCode/SampleDNNL/README.txt b/SampleCode/SampleDNNL/README.txt index 6e1699526..aa149044f 100644 --- a/SampleCode/SampleDNNL/README.txt +++ b/SampleCode/SampleDNNL/README.txt @@ -3,6 +3,8 @@ Purpose of Deep Neural Network Library (DNNL) -------------------------- The project demonstrates Intel(R) Deep Neural Network Library (DNNL) functions inside Intel(R) SGX environment +**NOTE**: The SampleDNNL project is validated under GNU Compiler Collection Version <= 9.4. High GCC versions are incompatible with the current version. + ------------------------------------ How to Build/Execute the Sample Code ------------------------------------ diff --git a/SampleCode/SampleEnclave/Enclave/config.01.xml b/SampleCode/SampleEnclave/Enclave/config.01.xml index ca652963f..e57be8ae8 100644 --- a/SampleCode/SampleEnclave/Enclave/config.01.xml +++ b/SampleCode/SampleEnclave/Enclave/config.01.xml @@ -23,6 +23,6 @@ 0 - 0 - 0xFFFFFFFF + 1 + 0xFFFFFFFE diff --git a/SampleCode/SampleEnclave/Enclave/config.02.xml b/SampleCode/SampleEnclave/Enclave/config.02.xml index 126eac07b..cc980d5d0 100644 --- a/SampleCode/SampleEnclave/Enclave/config.02.xml +++ b/SampleCode/SampleEnclave/Enclave/config.02.xml @@ -20,6 +20,6 @@ 1 0 - 0 - 0xFFFFFFFF + 1 + 0xFFFFFFFE diff --git a/SampleCode/SampleEnclave/Enclave/config.03.xml b/SampleCode/SampleEnclave/Enclave/config.03.xml index ef642799b..09ca6f231 100644 --- a/SampleCode/SampleEnclave/Enclave/config.03.xml +++ b/SampleCode/SampleEnclave/Enclave/config.03.xml @@ -22,6 +22,6 @@ 0 - 0 - 0xFFFFFFFF + 1 + 0xFFFFFFFE diff --git a/SampleCode/SampleEnclave/Enclave/config.04.xml b/SampleCode/SampleEnclave/Enclave/config.04.xml index a72d611b5..cd5b3fe2d 100644 --- a/SampleCode/SampleEnclave/Enclave/config.04.xml +++ b/SampleCode/SampleEnclave/Enclave/config.04.xml @@ -18,6 +18,6 @@ 0 - 0 - 0xFFFFFFFF + 1 + 0xFFFFFFFE diff --git a/SampleCode/SampleEnclave/README.txt b/SampleCode/SampleEnclave/README.txt index c88739180..9e2ba15d7 100644 --- a/SampleCode/SampleEnclave/README.txt +++ b/SampleCode/SampleEnclave/README.txt @@ -81,10 +81,20 @@ HeapMaxSize, HeapInitSize, HeapMinSize ------------------------------------------------- Sample configuration files for the Sample Enclave ------------------------------------------------- -config.01.xml: There is no dynamic thread, no dynamic heap expansion. -config.02.xml: There is no dynamic thread. But dynamic heap expansion can happen. -config.03.xml: There are dynamic threads. For a dynamic thread, there's no stack expansion. -config.04.xml: There are dynamic threads. For a dynamic thread, stack will expanded as necessary. +Below configurations are applicable on EDMM supported platforms with either EDMM supported +kernels or EDMM unsupported kernels. If the signed enclave is launched on an EDMM supported +platform with an EDMM supported kernel, it will be loaded with EDMM enabled. The following +configuration descriptions are only suitable for the case that the signed enclave is +launched on an EDMM supported platform with an EDMM supported kernel: + + config.01.xml: There is no dynamic thread, no dynamic heap expansion. + config.02.xml: There is no dynamic thread. But dynamic heap expansion can happen. + config.03.xml: There are dynamic threads. For a dynamic thread, there's no stack expansion. + config.04.xml: There are dynamic threads. For a dynamic thread, stack will expanded as necessary. + +Below configuration is only workable on EDMM supported platforms with EDMM supported kernels: + + config.05.xml: There is a user region where users could operate on. ------------------------------------------------- Launch token initialization diff --git a/SampleCode/SampleMbedCrypto/App/App.cpp b/SampleCode/SampleMbedCrypto/App/App.cpp new file mode 100644 index 000000000..421587b78 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/App/App.cpp @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +# include +# include +# define MAX_PATH FILENAME_MAX + +#define FAIL_SHA 0x1 +#define FAIL_AES 0x2 +#define FAIL_ECDSA 0x4 + +#include "sgx_urts.h" +#include "App.h" +#include "Enclave_u.h" + +/* Global EID shared by multiple threads */ +sgx_enclave_id_t global_eid = 0; + +typedef struct _sgx_errlist_t { + sgx_status_t err; + const char *msg; + const char *sug; /* Suggestion */ +} sgx_errlist_t; + +/* Error code returned by sgx_create_enclave */ +static sgx_errlist_t sgx_errlist[] = { + { + SGX_ERROR_UNEXPECTED, + "Unexpected error occurred.", + NULL + }, + { + SGX_ERROR_INVALID_PARAMETER, + "Invalid parameter.", + NULL + }, + { + SGX_ERROR_OUT_OF_MEMORY, + "Out of memory.", + NULL + }, + { + SGX_ERROR_ENCLAVE_LOST, + "Power transition occurred.", + "Please refer to the sample \"PowerTransition\" for details." + }, + { + SGX_ERROR_INVALID_ENCLAVE, + "Invalid enclave image.", + NULL + }, + { + SGX_ERROR_INVALID_ENCLAVE_ID, + "Invalid enclave identification.", + NULL + }, + { + SGX_ERROR_INVALID_SIGNATURE, + "Invalid enclave signature.", + NULL + }, + { + SGX_ERROR_OUT_OF_EPC, + "Out of EPC memory.", + NULL + }, + { + SGX_ERROR_NO_DEVICE, + "Invalid SGX device.", + "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards." + }, + { + SGX_ERROR_MEMORY_MAP_CONFLICT, + "Memory map conflicted.", + NULL + }, + { + SGX_ERROR_INVALID_METADATA, + "Invalid enclave metadata.", + NULL + }, + { + SGX_ERROR_DEVICE_BUSY, + "SGX device was busy.", + NULL + }, + { + SGX_ERROR_INVALID_VERSION, + "Enclave version was invalid.", + NULL + }, + { + SGX_ERROR_INVALID_ATTRIBUTE, + "Enclave was not authorized.", + NULL + }, + { + SGX_ERROR_ENCLAVE_FILE_ACCESS, + "Can't open enclave file.", + NULL + }, + { + SGX_ERROR_NDEBUG_ENCLAVE, + "The enclave is signed as product enclave, and can not be created as debuggable enclave.", + NULL + }, + { + SGX_ERROR_MEMORY_MAP_FAILURE, + "Failed to reserve memory for the enclave.", + NULL + }, +}; + +/* Check error conditions for loading enclave */ +void print_error_message(sgx_status_t ret) +{ + size_t idx = 0; + size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; + + for (idx = 0; idx < ttl; idx++) { + if(ret == sgx_errlist[idx].err) { + if(NULL != sgx_errlist[idx].sug) + printf("Info: %s\n", sgx_errlist[idx].sug); + printf("Error: %s\n", sgx_errlist[idx].msg); + break; + } + } + + if (idx == ttl) + printf("Error: Unexpected error occurred.\n"); +} + +/* Initialize the enclave: + * Call sgx_create_enclave to initialize an enclave instance + */ +int initialize_enclave(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + /* Call sgx_create_enclave to initialize an enclave instance */ + /* Debug Support: set 2nd parameter to 1 */ + ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, NULL, NULL, &global_eid, NULL); + if (ret != SGX_SUCCESS) { + print_error_message(ret); + return -1; + } + + return 0; +} + +/* OCall functions */ +void ocall_print_string(const char *str) +{ + /* Proxy/Bridge will check the length and null-terminate + * the input string to prevent buffer overflow. + */ + printf("%s", str); +} + + +/* Application entry */ +int SGX_CDECL main(int argc, char *argv[]) +{ + (void)(argc); + (void)(argv); + int result = 0xff; + + /* Initialize the enclave */ + if(initialize_enclave() < 0){ + printf("Enter a character before exit ...\n"); + getchar(); + return -1; + } + + sgx_status_t status = ecall_mbedtls_crypto(global_eid, &result); + if (status != SGX_SUCCESS) { + printf("ERROR: ECall failed\n"); + print_error_message(status); + printf("Enter a character before exit ...\n"); + getchar(); + return -1; + } + + /* Destroy the enclave */ + sgx_destroy_enclave(global_eid); + + printf("Info: MbedCrypto Sample completed.\n"); + + if ( 0 == result) { + printf("Info: All test passed.\n"); + } else { + if ( result & FAIL_SHA ) printf("ERROR: SHA256 test failed.\n"); + if ( result & FAIL_AES ) printf("ERROR: AES-CTR test failed.\n"); + if ( result & FAIL_ECDSA ) printf("ERROR: ECDSA test failed.\n"); + } + printf("Enter a character before exit ...\n"); + getchar(); + return 0; +} + diff --git a/SampleCode/SampleMbedCrypto/App/App.h b/SampleCode/SampleMbedCrypto/App/App.h new file mode 100644 index 000000000..c9affe8d3 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/App/App.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _APP_H_ +#define _APP_H_ + +#include +#include +#include +#include + +#include "sgx_error.h" /* sgx_status_t */ +#include "sgx_eid.h" /* sgx_enclave_id_t */ + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +#if defined(__GNUC__) +# define ENCLAVE_FILENAME "enclave.signed.so" +#endif + +extern sgx_enclave_id_t global_eid; /* global enclave id */ + +#endif /* !_APP_H_ */ diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml b/SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml new file mode 100644 index 000000000..a94d12f00 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml @@ -0,0 +1,12 @@ + + + 0 + 0 + 0x40000 + 0x100000 + 10 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp b/SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp new file mode 100644 index 000000000..cfa15520d --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include /* vsnprintf */ +#include + +#include "Enclave.h" +#include "Enclave_t.h" /* print_string */ +#include "mbedtls/aes.h" +#include "mbedtls/cipher.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ctr_drbg.h" +#include "mbedtls/ecdsa.h" +#include "mbedtls/sha256.h" + +#define FAIL_SHA 0x1 +#define FAIL_AES 0x2 +#define FAIL_ECDSA 0x4 + +#define mbedtls_printf printf + +/* + * printf: + * Invokes OCALL to display the enclave buffer to the terminal. + * 'printf' function is required for sgx protobuf logging module. + */ +int printf(const char *fmt, ...) +{ + char buf[BUFSIZ] = {'\0'}; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, BUFSIZ, fmt, ap); + va_end(ap); + ocall_print_string(buf); + return 0; +} + +static int mbedtls_crypto_sha256() +{ + unsigned char output[65]; + memset(output, 0x00, 65); + if (mbedtls_sha256( (const unsigned char*)"", 0, output, 0 ) != 0 ) + { + mbedtls_printf ("SHA256 failed\n"); + return -1; + } else { + for (int i = 0; i < 32; i++) + mbedtls_printf("%02x", output[i]); + } + mbedtls_printf("\nSHA256 PASSED\n"); + return 0; +} + +static int mbedtls_crypto_aes_ctr_enc_dec_buf() +{ + int ret = -1; + size_t length = 49, outlen, total_len, i, block_size, iv_len; + unsigned char key[64]; + unsigned char iv[16]; + unsigned char ad[13]; + unsigned char tag[16]; + unsigned char inbuf[64]; + unsigned char encbuf[64]; + unsigned char decbuf[64]; + + const mbedtls_cipher_info_t *cipher_info; + mbedtls_cipher_context_t ctx_dec; + mbedtls_cipher_context_t ctx_enc; + + /* + * Prepare contexts + */ + mbedtls_cipher_init( &ctx_dec ); + mbedtls_cipher_init( &ctx_enc ); + + memset( key, 0x2a, sizeof( key ) ); + + /* Check and get info structures */ + cipher_info = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_CTR); + if( NULL == cipher_info ) goto exit; + if( mbedtls_cipher_info_from_string( "AES-128-CTR" ) != cipher_info ) goto exit; + if( strcmp( mbedtls_cipher_info_get_name( cipher_info ), + "AES-128-CTR" ) != 0 ) goto exit; + + /* Initialise enc and dec contexts */ + if( 0 != mbedtls_cipher_setup( &ctx_dec, cipher_info ) ) goto exit; + if( 0 != mbedtls_cipher_setup( &ctx_enc, cipher_info ) ) goto exit; + + if( 0 != mbedtls_cipher_setkey( &ctx_dec, key, 128, MBEDTLS_DECRYPT ) ) goto exit; + if( 0 != mbedtls_cipher_setkey( &ctx_enc, key, 128, MBEDTLS_ENCRYPT ) ) goto exit; + + /* + * Do a few encode/decode cycles + */ + for( i = 0; i < 3; i++ ) + { + memset( iv , 0x00 + (int)i, sizeof( iv ) ); + memset( ad, 0x10 + (int)i, sizeof( ad ) ); + memset( inbuf, 0x20 + (int)i, sizeof( inbuf ) ); + + memset( encbuf, 0, sizeof( encbuf ) ); + memset( decbuf, 0, sizeof( decbuf ) ); + memset( tag, 0, sizeof( tag ) ); + + iv_len = sizeof(iv); + + if( 0 != mbedtls_cipher_set_iv( &ctx_dec, iv, iv_len ) ) goto exit; + if( 0 != mbedtls_cipher_set_iv( &ctx_enc, iv, iv_len ) ) goto exit; + + if( 0 != mbedtls_cipher_reset( &ctx_dec ) ) goto exit; + if( 0 != mbedtls_cipher_reset( &ctx_enc ) ) goto exit; + + block_size = mbedtls_cipher_get_block_size( &ctx_enc ); + if( 0 == block_size ) goto exit; + + /* encode length number of bytes from inbuf */ + if( 0 != mbedtls_cipher_update( &ctx_enc, inbuf, length, encbuf, &outlen ) ) goto exit; + total_len = outlen; + + if( total_len != length || + ( total_len % block_size == 0 && + total_len < length && + total_len + block_size > length ) ) goto exit; + + if( 0 != mbedtls_cipher_finish( &ctx_enc, encbuf + outlen, &outlen ) ) goto exit; + total_len += outlen; + + if( total_len != length || + ( total_len % block_size == 0 && + total_len > length && + total_len <= length + block_size ) ) goto exit; + + /* decode the previously encoded string */ + if( 0 != mbedtls_cipher_update( &ctx_dec, encbuf, total_len, decbuf, &outlen ) ) goto exit; + total_len = outlen; + + if( total_len != length || + ( total_len % block_size == 0 && + total_len < length && + total_len + block_size >= length ) ) goto exit; + + if( 0 != mbedtls_cipher_finish( &ctx_dec, decbuf + outlen, &outlen ) ) goto exit; + total_len += outlen; + + /* check result */ + if( total_len != length ) goto exit; + if( 0 != memcmp(inbuf, decbuf, length) ) goto exit; + } + mbedtls_printf("AES-CTR PASSED\n"); + ret = 0; +exit: + mbedtls_cipher_free( &ctx_dec ); + mbedtls_cipher_free( &ctx_enc ); + return ret; +} + +#define ECPARAMS MBEDTLS_ECP_DP_SECP192R1 + +static int mbedtls_crypto_ecdsa() +{ + int ret = 1; + mbedtls_ecdsa_context ctx_sign, ctx_verify; + mbedtls_entropy_context entropy; + mbedtls_ctr_drbg_context ctr_drbg; + unsigned char message[100]; + unsigned char hash[32]; + unsigned char sig[MBEDTLS_ECDSA_MAX_LEN]; + size_t sig_len; + const char *pers = "ecdsa"; + + mbedtls_ecdsa_init( &ctx_sign ); + mbedtls_ecdsa_init( &ctx_verify ); + mbedtls_ctr_drbg_init( &ctr_drbg ); + + memset( sig, 0, sizeof( sig ) ); + memset( message, 0x25, sizeof( message ) ); + + /* + * Generate a key pair for signing + */ + mbedtls_printf( " . Seeding the random number generator..." ); + + mbedtls_entropy_init( &entropy ); + if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, + (const unsigned char *) pers, + strlen( pers ) ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret ); + goto exit; + } + + mbedtls_printf( " ok\n . Generating key pair..." ); + + if( ( ret = mbedtls_ecdsa_genkey( &ctx_sign, ECPARAMS, + mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ecdsa_genkey returned %d\n", ret ); + goto exit; + } + + mbedtls_printf( " ok (key size: %d bits)\n", (int) ctx_sign.MBEDTLS_PRIVATE(grp).pbits ); + + /* + * Compute message hash + */ + mbedtls_printf( " . Computing message hash..." ); + + if( ( ret = mbedtls_sha256( message, sizeof( message ), hash, 0 ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_sha256 returned %d\n", ret ); + goto exit; + } + + mbedtls_printf( " ok\n" ); + + /* + * Sign message hash + */ + mbedtls_printf( " . Signing message hash..." ); + + if( ( ret = mbedtls_ecdsa_write_signature( &ctx_sign, MBEDTLS_MD_SHA256, + hash, sizeof( hash ), + sig, sizeof( sig ), &sig_len, + mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ecdsa_write_signature returned %d\n", ret ); + goto exit; + } + mbedtls_printf( " ok (signature length = %u)\n", (unsigned int) sig_len ); + + /* + * Transfer public information to verifying context + * + * We could use the same context for verification and signatures, but we + * chose to use a new one in order to make it clear that the verifying + * context only needs the public key (Q), and not the private key (d). + */ + mbedtls_printf( " . Preparing verification context..." ); + + if( ( ret = mbedtls_ecp_group_copy( &ctx_verify.MBEDTLS_PRIVATE(grp), &ctx_sign.MBEDTLS_PRIVATE(grp) ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ecp_group_copy returned %d\n", ret ); + goto exit; + } + + if( ( ret = mbedtls_ecp_copy( &ctx_verify.MBEDTLS_PRIVATE(Q), &ctx_sign.MBEDTLS_PRIVATE(Q) ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ecp_copy returned %d\n", ret ); + goto exit; + } + + /* + * Verify signature + */ + mbedtls_printf( " ok\n . Verifying signature..." ); + + if( ( ret = mbedtls_ecdsa_read_signature( &ctx_verify, + hash, sizeof( hash ), + sig, sig_len ) ) != 0 ) + { + mbedtls_printf( " failed\n ! mbedtls_ecdsa_read_signature returned %d\n", ret ); + goto exit; + } + + mbedtls_printf( " ok\nECDSA PASSED\n" ); + +exit: + + mbedtls_ecdsa_free( &ctx_verify ); + mbedtls_ecdsa_free( &ctx_sign ); + mbedtls_ctr_drbg_free( &ctr_drbg ); + mbedtls_entropy_free( &entropy ); + return ret; +} + +int ecall_mbedtls_crypto() +{ + int ret = 0; + if ( 0 != mbedtls_crypto_sha256()) ret |= FAIL_SHA; + if ( 0 != mbedtls_crypto_aes_ctr_enc_dec_buf()) ret |= FAIL_AES; + if ( 0 != mbedtls_crypto_ecdsa()) ret |= FAIL_ECDSA; + return ret; + +} diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave.edl b/SampleCode/SampleMbedCrypto/Enclave/Enclave.edl new file mode 100644 index 000000000..97e974eb6 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave.edl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Enclave.edl - Top EDL file. */ + +enclave { + + + /* Import ECALL/OCALL from sub-directory EDLs. + * [from]: specifies the location of EDL file. + * [import]: specifies the functions to import, + * [*]: implies to import all functions. + */ + + from "sgx_tstdc.edl" import *; + trusted { + public int ecall_mbedtls_crypto(); + }; + + /* + * ocall_print_string - invokes OCALL to display string buffer inside the enclave. + * [in]: copy the string buffer to App outside. + * [string]: specifies 'str' is a NULL terminated buffer. + */ + untrusted { + void ocall_print_string([in, string] const char *str); + }; + +}; diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave.h b/SampleCode/SampleMbedCrypto/Enclave/Enclave.h new file mode 100644 index 000000000..ea8be2c71 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _ENCLAVE_H_ +#define _ENCLAVE_H_ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +int printf(const char *fmt, ...); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_ENCLAVE_H_ */ diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave.lds b/SampleCode/SampleMbedCrypto/Enclave/Enclave.lds new file mode 100644 index 000000000..e3d9d0ee0 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave.lds @@ -0,0 +1,9 @@ +enclave.so +{ + global: + g_global_data_sim; + g_global_data; + enclave_entry; + local: + *; +}; diff --git a/SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds b/SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds new file mode 100644 index 000000000..0d5614f55 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds @@ -0,0 +1,11 @@ +enclave.so +{ + global: + g_global_data_sim; + g_global_data; + enclave_entry; + g_peak_heap_used; + g_peak_rsrv_mem_committed; + local: + *; +}; diff --git a/SampleCode/SampleMbedCrypto/Makefile b/SampleCode/SampleMbedCrypto/Makefile new file mode 100644 index 000000000..13a30ce36 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/Makefile @@ -0,0 +1,275 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +######## SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= HW +SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_FLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_FLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_FLAGS += -O0 -g +else + SGX_COMMON_FLAGS += -O2 +endif + +SGX_COMMON_FLAGS += -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type \ + -Waddress -Wsequence-point -Wformat-security \ + -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow \ + -Wcast-align -Wcast-qual -Wconversion -Wredundant-decls +SGX_COMMON_CFLAGS := $(SGX_COMMON_FLAGS) -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants +SGX_COMMON_CXXFLAGS := $(SGX_COMMON_FLAGS) -Wnon-virtual-dtor -std=c++11 + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_Cpp_Files := App/App.cpp +App_Include_Paths := -IApp -I$(SGX_SDK)/include + +App_C_Flags := -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) +App_Link_Flags := -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) + +App_Name := app + +######## Enclave Settings ######## + +Enclave_Version_Script := Enclave/Enclave_debug.lds +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) + # Choose to use 'Enclave.lds' for HW release mode + Enclave_Version_Script = Enclave/Enclave.lds +endif +endif +endif + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files := Enclave/Enclave.cpp +Enclave_Include_Paths := -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/include/tlibc + +Enclave_C_Flags := -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) -DPB_ENABLE_SGX +Enclave_Cpp_Flags := $(Enclave_C_Flags) -nostdinc++ + +# Enable the security flags +Enclave_Security_Link_Flags := -Wl,-z,relro,-z,now,-z,noexecstack + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. +Enclave_Link_Flags := $(Enclave_Security_Link_Flags) \ + -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_mbedcrypto -lsgx_pthread -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=$(Enclave_Version_Script) + +Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) + +Enclave_Name := enclave.so +Signed_Enclave_Name := enclave.signed.so +Enclave_Config_File := Enclave/Enclave.config.xml +Enclave_Test_Key := Enclave/Enclave_private_test.pem + +ifeq ($(SGX_MODE), HW) +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE +endif +else +ifeq ($(SGX_DEBUG), 1) + Build_Mode = SIM_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = SIM_PRERELEASE +else + Build_Mode = SIM_RELEASE +endif +endif + + +.PHONY: all run target +all: .config_$(Build_Mode)_$(SGX_ARCH) + @$(MAKE) target + +ifeq ($(Build_Mode), HW_RELEASE) +target: $(App_Name) $(Enclave_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclave use the command:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" + @echo "You can also sign the enclave using an external signing tool." + @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." +else +target: $(App_Name) $(Signed_Enclave_Name) +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), SIM_DEBUG) + @echo "The project has been built in debug simulation mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +else ifeq ($(Build_Mode), SIM_PRERELEASE) + @echo "The project has been built in pre-release simulation mode." +else + @echo "The project has been built in release simulation mode." +endif +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/$(App_Name) + @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +.config_$(Build_Mode)_$(SGX_ARCH): + @rm -f .config_* $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* + @touch .config_$(Build_Mode)_$(SGX_ARCH) + +######## App Objects ######## + +App/Enclave_u.h: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave_u.c: App/Enclave_u.h + +App/Enclave_u.o: App/Enclave_u.c + @$(CC) $(SGX_COMMON_CFLAGS) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +App/%.o: App/%.cpp App/Enclave_u.h + @$(CXX) $(SGX_COMMON_CXXFLAGS) $(App_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): App/Enclave_u.o $(App_Cpp_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + +######## Enclave Objects ######## + +Enclave/Enclave_t.h: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd Enclave && $(SGX_EDGER8R) --trusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave/Enclave_t.c: Enclave/Enclave_t.h + +Enclave/Enclave_t.o: Enclave/Enclave_t.c + @$(CC) $(SGX_COMMON_CFLAGS) $(Enclave_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave/%.o: Enclave/%.cpp + @$(CXX) $(SGX_COMMON_CXXFLAGS) $(Enclave_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +Enclave/%.o: Enclave/%.cc + @$(CXX) $(SGX_COMMON_CXXFLAGS) $(Enclave_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(Enclave_Cpp_Objects): Enclave/Enclave_t.h + +$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) + @$(CXX) $^ -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Signed_Enclave_Name): $(Enclave_Name) +ifeq ($(wildcard $(Enclave_Test_Key)),) + @echo "There is no enclave test key." + @echo "The project will generate a key for test." + @openssl genrsa -out $(Enclave_Test_Key) -3 3072 +endif + @$(SGX_ENCLAVE_SIGNER) sign -key $(Enclave_Test_Key) -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) + @echo "SIGN => $@" + +.PHONY: clean + +clean: + @rm -f .config_* $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* $(Enclave_Test_Key) diff --git a/SampleCode/SampleMbedCrypto/README.txt b/SampleCode/SampleMbedCrypto/README.txt new file mode 100644 index 000000000..6970e6429 --- /dev/null +++ b/SampleCode/SampleMbedCrypto/README.txt @@ -0,0 +1,30 @@ +--------------------------- +Purpose of SampleMbedCrypto +--------------------------- +The project demonstrates how to use Mbedtls cryptographic APIs inside SGX Enclaves. + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Enclave test key(two options): + a. Install openssl first, then the project will generate a test key automatically when you build the project. + b. Rename your test key(3072-bit RSA private key) to and put it under the folder. +3. Make sure your environment is set: + $ source ${sgx-sdk-install-path}/environment +4. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + $ make SGX_MODE=HW SGX_DEBUG=1 + b. Hardware Mode, Pre-release build: + $ make SGX_MODE=HW SGX_PRERELEASE=1 + c. Hardware Mode, Release build: + $ make SGX_MODE=HW + d. Simulation Mode, Debug build: + $ make SGX_MODE=SIM + e. Simulation Mode, Pre-release build: + $ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0 + f. Simulation Mode, Release build: + $ make SGX_MODE=SIM SGX_DEBUG=0 +5. Execute the binary directly: + $ ./app +6. Remember to "make clean" before switching build mode diff --git a/common/inc/internal/arch.h b/common/inc/internal/arch.h index 8cfa683e6..ba8206212 100644 --- a/common/inc/internal/arch.h +++ b/common/inc/internal/arch.h @@ -92,7 +92,7 @@ flags definitions typedef struct _tcs_t { uint64_t reserved0; /* (0) */ - uint64_t flags; /* (8)bit 0: DBGOPTION */ + uint64_t flags; /* (8)bit 0: DBGOPTION, bit 1: AEXNOTIFY */ uint64_t ossa; /* (16)State Save Area */ uint32_t cssa; /* (24)Current SSA slot */ uint32_t nssa; /* (28)Number of SSA slots */ @@ -130,6 +130,8 @@ typedef struct _exit_info_t #define SE_VECTOR_AC 17 #define SE_VECTOR_XM 19 +#define SSA_AEXNOTIFY_MASK 0x1U /* Only set the first bit */ + typedef struct _ssa_gpr_t { REGISTER( ax); /* (0) */ @@ -153,7 +155,8 @@ typedef struct _ssa_gpr_t REGISTER( sp_u); /* (144) untrusted stack pointer. saved by EENTER */ REGISTER( bp_u); /* (152) untrusted frame pointer. saved by EENTER */ exit_info_t exit_info; /* (160) contain information for exits */ - uint32_t reserved; /* (164) padding to multiple of 8 bytes */ + uint8_t reserved[3]; /* (164) padding */ + uint8_t aex_notify; /* (167) AEX Notify */ uint64_t fs; /* (168) FS register */ uint64_t gs; /* (176) GS register */ } ssa_gpr_t; diff --git a/common/inc/internal/global_data.h b/common/inc/internal/global_data.h index 21fc56e1f..d3ae5e867 100644 --- a/common/inc/internal/global_data.h +++ b/common/inc/internal/global_data.h @@ -65,6 +65,7 @@ typedef struct _global_data_t uint64_t enclave_image_address; /* the base address of the enclave image */ uint64_t elrange_start_address; /* the base address provided in the enclave's SECS (SECS.BASEADDR) */ uint64_t elrange_size; /* the size of the enclave address range provided in the enclave's SECS (SECS.SIZE) */ + sys_word_t edmm_bk_overhead; /* memory overhead used by edmm bookkeeping */ } global_data_t; #define ENCLAVE_INIT_NOT_STARTED 0 diff --git a/common/inc/internal/inst.h b/common/inc/internal/inst.h index 84b7b2261..87ddd9ff8 100644 --- a/common/inc/internal/inst.h +++ b/common/inc/internal/inst.h @@ -49,7 +49,8 @@ typedef enum { SE_EMODPE, SE_EACCEPTCOPY, SE_EVERIFYREPORT2 = 0x8, - SE_LAST_RING3, + SE_EDECCSSA = 0x9, + SE_LAST_RING3, SE_ECREATE = 0x0, SE_EADD, diff --git a/common/inc/internal/linux/linux-regs.h b/common/inc/internal/linux/linux-regs.h index 8741edc2e..02c578879 100644 --- a/common/inc/internal/linux/linux-regs.h +++ b/common/inc/internal/linux/linux-regs.h @@ -90,6 +90,7 @@ #define SE_EMODPE 6 #define SE_EACCEPTCOPY 7 #define SE_EVERIFYREPORT2 8 +#define SE_EDECCSSA 9 #define SE_ECREATE 0 diff --git a/common/inc/internal/rts.h b/common/inc/internal/rts.h index 612cd8454..6c7bd45f2 100644 --- a/common/inc/internal/rts.h +++ b/common/inc/internal/rts.h @@ -90,6 +90,14 @@ typedef struct _system_features #define SYS_FEATURE_MSb 63 #define SYS_FEATURE_EXTEND 62 +// feature bit in system_feature_set: +// bit0 - EDMM +// bit1 - AEXNOTIFY +#define EDMM_BIT 0 +#define AEXNOTIFY_BIT 1 +#define EDMM_ENABLE_BIT 0x1ULL + + #define OCALL_FLAG 0x4F434944 #define BUILTIN_OCALL_1 -2 diff --git a/common/inc/internal/se_version.h b/common/inc/internal/se_version.h index c44d03d52..3fa066f33 100644 --- a/common/inc/internal/se_version.h +++ b/common/inc/internal/se_version.h @@ -31,21 +31,21 @@ #ifndef _SE_VERSION_H_ #define _SE_VERSION_H_ -#define STRFILEVER "2.19.100.3" +#define STRFILEVER "2.20.100.4" #define SGX_MAJOR_VERSION 2 -#define SGX_MINOR_VERSION 19 +#define SGX_MINOR_VERSION 20 #define SGX_REVISION_VERSION 100 #define MAKE_VERSION_UINT(major,minor,rev) (((uint64_t)major)<<32 | ((uint64_t)minor) << 16 | rev) #define VERSION_UINT MAKE_VERSION_UINT(SGX_MAJOR_VERSION, SGX_MINOR_VERSION, SGX_REVISION_VERSION) #define COPYRIGHT "Copyright (C) 2023 Intel Corporation" -#define UAE_SERVICE_VERSION "2.3.218.3" -#define URTS_VERSION "2.0.102.3" -#define ENCLAVE_COMMON_VERSION "1.2.102.3" -#define LAUNCH_VERSION "1.0.120.3" -#define EPID_VERSION "1.0.120.3" -#define QUOTE_EX_VERSION "1.1.120.3" +#define UAE_SERVICE_VERSION "2.3.219.4" +#define URTS_VERSION "2.0.103.4" +#define ENCLAVE_COMMON_VERSION "1.2.103.4" +#define LAUNCH_VERSION "1.0.121.4" +#define EPID_VERSION "1.0.121.4" +#define QUOTE_EX_VERSION "1.1.121.4" #define PCE_VERSION "1.19.100.1" #define LE_VERSION "1.19.100.1" diff --git a/common/inc/internal/thread_data.h b/common/inc/internal/thread_data.h index e0a5cf5aa..27d4b0e65 100644 --- a/common/inc/internal/thread_data.h +++ b/common/inc/internal/thread_data.h @@ -85,6 +85,9 @@ typedef size_t sys_word_t; */ #define SGX_UTILITY_THREAD 0x1 +#define TCS_FLAG_DBGOPTIN 0x1 +#define TCS_FLAG_AEXNOTIFY 0x2 + typedef struct _thread_data_t { sys_word_t self_addr; @@ -94,10 +97,14 @@ typedef struct _thread_data_t sys_word_t first_ssa_gpr; /* set by urts, relative to TCS */ sys_word_t stack_guard; /* GCC expects start_guard at 0x14 on x86 and 0x28 on x64 */ - sys_word_t flags; + sys_word_t flags; /* indicate whether it is for utility thread or not.*/ sys_word_t xsave_size; /* in bytes (se_ptrace.c needs to know its offset).*/ sys_word_t last_error; /* init to be 0. Used by trts. */ + sys_word_t aex_mitigation_list; /* AEX Notify mitigation handler list */ + sys_word_t aex_notify_flag; /* Used to record the aexnotify status last time */ + sys_word_t first_ssa_xsave; /* set by urts, relative to TCS */ + #ifdef TD_SUPPORT_MULTI_PLATFORM sys_word_t m_next; /* next TD used by trusted thread library (of type "struct _thread_data *") */ #else @@ -112,6 +119,9 @@ typedef struct _thread_data_t #endif sys_word_t cxx_thread_info[6]; sys_word_t stack_commit_addr; + + uint32_t aex_notify_entropy_cache; + int32_t aex_notify_entropy_remaining; } thread_data_t; #ifdef __cplusplus diff --git a/common/inc/sgx_attributes.h b/common/inc/sgx_attributes.h index 523d22ebb..5de45376f 100644 --- a/common/inc/sgx_attributes.h +++ b/common/inc/sgx_attributes.h @@ -40,7 +40,9 @@ #define SGX_FLAGS_MODE64BIT 0x0000000000000004ULL /* If set, then the enclave is 64 bit */ #define SGX_FLAGS_PROVISION_KEY 0x0000000000000010ULL /* If set, then the enclave has access to provision key */ #define SGX_FLAGS_EINITTOKEN_KEY 0x0000000000000020ULL /* If set, then the enclave has access to EINITTOKEN key */ -#define SGX_FLAGS_KSS 0x0000000000000080ULL /* If set enclave uses KSS */ +#define SGX_FLAGS_KSS 0x0000000000000080ULL /* If set, then the enclave uses KSS */ +#define SGX_FLAGS_AEX_NOTIFY 0x0000000000000400ULL /* If set, then the enclave enables AEX Notify */ + #define SGX_FLAGS_NON_CHECK_BITS 0x00FF000000000000ULL /* BIT[55-48] will not be checked */ @@ -60,7 +62,9 @@ typedef struct _attributes_t uint64_t xfrm; } sgx_attributes_t; -/* define MISCSELECT - all bits are currently reserved */ +/* Define MISCSELECT + * bit 0: EXINFO + * bit 31-1: reserved(0) */ typedef uint32_t sgx_misc_select_t; typedef struct _sgx_misc_attribute_t { diff --git a/common/inc/sgx_trts_aex.h b/common/inc/sgx_trts_aex.h new file mode 100644 index 000000000..ea28ffc0a --- /dev/null +++ b/common/inc/sgx_trts_aex.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * File: sgx_trts_aex.h + * Description: + * Header file for aex notify handling APIs. + */ + +#ifndef _SGX_TRTS_AEX_H_ +#define _SGX_TRTS_AEX_H_ + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts_exception.h" +#include "sgx_error.h" + +typedef void (*sgx_aex_mitigation_fn_t)(const sgx_exception_info_t *info, const void * args); + +typedef struct _aex_mitigation_node_t +{ + sgx_aex_mitigation_fn_t handler; + const void *args; + struct _aex_mitigation_node_t * next; +} sgx_aex_mitigation_node_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +/* sgx_set_ssa_aexnotify() + * Parameters: + * flag - 0 to disable AEX-Notify + * non-zero to enable AEX-Notify + * Return Value: + * SGX_SUCCESS - success + * SGX_ERROR_UNEXPECTED - unexpected error + */ +sgx_status_t SGXAPI sgx_set_ssa_aexnotify(int flag); + + +/* sgx_register_aex_handler() + * Parameters: + * aex_node - A pointer to an AEX mitigation node. The mitigation node must exist and be valid until it is unregistered. + * handler - A function handler to call after being notified of an AEX + * args - Arguments to pass to the handler + * Return Value: + * SGX_SUCCESS - success + * SGX_ERROR_INVALID_PARAMETER - aex_node or handler are NULL + */ +sgx_status_t SGXAPI sgx_register_aex_handler(sgx_aex_mitigation_node_t *aex_node, sgx_aex_mitigation_fn_t handler, const void *args); + +/* sgx_unregister_aex_handler() + * Parameters: + * handler - A function handler that was previously registered + * Return Value: + * SGX_SUCCESS - success + * SGX_ERROR_INVALID_PARAMETER - handler was NULL or has not been previously registered + * SGX_ERROR_UNEXPECTED - There currently are no registered handlers + */ +sgx_status_t SGXAPI sgx_unregister_aex_handler(sgx_aex_mitigation_fn_t handler); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_trts_exception.h b/common/inc/sgx_trts_exception.h index bd66e5e4b..da8146cf5 100644 --- a/common/inc/sgx_trts_exception.h +++ b/common/inc/sgx_trts_exception.h @@ -112,12 +112,22 @@ typedef struct _exinfo_t uint32_t reserved; }sgx_misc_exinfo_t; + __attribute__((aligned(64))) typedef struct _exception_info_t { sgx_cpu_context_t cpu_context; sgx_exception_vector_t exception_vector; sgx_exception_type_t exception_type; sgx_misc_exinfo_t exinfo; + uint32_t exception_valid; + uint32_t do_aex_mitigation; + uint64_t xsave_size; +#if defined (_M_X64) || defined (__x86_64__) + uint64_t reserved[1]; +#else + uint64_t reserved[6]; +#endif + uint8_t xsave_area[0]; // 64-byte aligned } sgx_exception_info_t; typedef int (*sgx_exception_handler_t)(sgx_exception_info_t *info); diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile index 92f842cea..6bc4630d8 100644 --- a/docker/build/Dockerfile +++ b/docker/build/Dockerfile @@ -46,9 +46,10 @@ RUN apt-get update && apt-get install -y \ ocaml \ ocamlbuild \ protobuf-compiler \ - python \ + python3 \ reprepro \ wget +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 # We assume this docker file is invoked with root at the top of linux-sgx repo, see shell scripts for example. WORKDIR /linux-sgx @@ -63,7 +64,8 @@ ENV SGX_SDK=/opt/intel/sgxsdk WORKDIR /linux-sgx RUN make psw_install_pkg -RUN make deb_local_repo +ENV BUILD_PLATFORM="docker" +RUN make deb_local_repo FROM ubuntu:18.04 as aesm RUN apt-get update && apt-get install -y \ diff --git a/docker/build/tdx-qgs.dockerfile b/docker/build/tdx-qgs.dockerfile index 35a57be2b..461f132e9 100644 --- a/docker/build/tdx-qgs.dockerfile +++ b/docker/build/tdx-qgs.dockerfile @@ -31,7 +31,7 @@ FROM quay.io/centos/centos:stream8 as qgs-builder RUN dnf -y groupinstall 'Development Tools' -RUN dnf -y install --enablerepo=powertools ocaml ocaml-ocamlbuild wget python2 \ +RUN dnf -y install --enablerepo=powertools ocaml ocaml-ocamlbuild wget python3 \ openssl-devel libcurl-devel protobuf-devel cmake createrepo yum-utils \ dos2unix pkgconf boost-devel protobuf-c-compiler protobuf-c-devel \ protobuf-lite-devel @@ -39,13 +39,14 @@ RUN dnf -y install --enablerepo=powertools ocaml ocaml-ocamlbuild wget python2 \ # We assume this docker file is invoked with root at the top of linux-sgx repo, see shell scripts for example. WORKDIR /linux-sgx COPY . . -RUN alternatives --set python /usr/bin/python2 +RUN alternatives --set python /usr/bin/python3 RUN make sdk_install_pkg_no_mitigation WORKDIR /opt/intel RUN sh -c 'echo yes | /linux-sgx/linux/installer/bin/sgx_linux_x64_sdk_*.bin' WORKDIR /linux-sgx +ENV BUILD_PLATFORM="docker" RUN make rpm_local_repo @@ -54,6 +55,7 @@ FROM quay.io/centos/centos:stream8 as qgs WORKDIR /installer COPY --from=qgs-builder /linux-sgx/linux/installer/rpm/sgx_rpm_local_repo/ . +RUN dnf install -y dnf-plugins-core RUN dnf config-manager --add-repo file:///installer RUN dnf -y install --setopt=install_weak_deps=False --nogpgcheck tdx-qgs \ libsgx-dcap-default-qpl diff --git a/download_prebuilt.sh b/download_prebuilt.sh index 76e528685..2f019a0b7 100755 --- a/download_prebuilt.sh +++ b/download_prebuilt.sh @@ -33,11 +33,11 @@ top_dir=`dirname $0` out_dir=$top_dir -optlib_name=optimized_libs_2.19.tar.gz -ae_file_name=prebuilt_ae_2.19.tar.gz +optlib_name=optimized_libs_2.20.tar.gz +ae_file_name=prebuilt_ae_2.20.tar.gz binutils_file_name=as.ld.objdump.r4.tar.gz -checksum_file=SHA256SUM_prebuilt_2.19.cfg -server_url_path=https://download.01.org/intel-sgx/sgx-linux/2.19 +checksum_file=SHA256SUM_prebuilt_2.20.cfg +server_url_path=https://download.01.org/intel-sgx/sgx-linux/2.20 server_optlib_url=$server_url_path/$optlib_name server_ae_url=$server_url_path/$ae_file_name server_binutils_url=$server_url_path/$binutils_file_name diff --git a/external/dcap_source b/external/dcap_source index 71557c7d1..0443ae263 160000 --- a/external/dcap_source +++ b/external/dcap_source @@ -1 +1 @@ -Subproject commit 71557c7d1d869b6bd6f95566c051cbd098549509 +Subproject commit 0443ae263818a78afeeaf50ca29fc2cff02cb829 diff --git a/external/dnnl/README b/external/dnnl/README index de60e10c3..c891dd6d1 100644 --- a/external/dnnl/README +++ b/external/dnnl/README @@ -1,5 +1,7 @@ The Intel(R) Software Guard Extensions (Intel(R) SGX) Deep Neural Network Library (DNNL) is based on Intel(R) DNNL v1.1.1 (https://github.com/intel/mkl-dnn/tree/v1.1.1). +**NOTE**: The SGX DNNL library is validated under GNU Compiler Collection Version <= 9.4. High GCC versions are incompatible with the current version. + Build Intel(R) SGX DNNL 1.Enter: linux-trunk/external/dnnl 2.Execute: make diff --git a/external/ippcp_internal/Makefile b/external/ippcp_internal/Makefile index faea09734..1b6831d5c 100644 --- a/external/ippcp_internal/Makefile +++ b/external/ippcp_internal/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2020 Intel Corporation. All rights reserved. +# Copyright (C) 2011-2023 Intel Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -75,7 +75,7 @@ all: build_ipp $(MKDIR) $(OUT_DIR) $(CP) ipp-crypto/build/.build/RELEASE/lib/libippcp.a $(OUT_DIR) $(CP) ipp-crypto/include/* ./inc/ - patch ipp-crypto/include/ippcp.h -i ./inc/ippcp21u3.patch -o ./inc/ippcp.h + patch ipp-crypto/include/ippcp.h -i ./inc/ippcp21u7.patch -o ./inc/ippcp.h $(MKDIR) license $(CP) ipp-crypto/LICENSE ./license/ @@ -87,7 +87,7 @@ ifeq ($(shell git rev-parse --is-inside-work-tree), true) git submodule update -f --init --recursive --remote -- $(IPP_SOURCE) else $(RM) -rf $(IPP_SOURCE) - git clone -b ippcp_2021.3 https://github.com/intel/ipp-crypto.git --depth 1 $(IPP_SOURCE) + git clone -b ippcp_2021.7 https://github.com/intel/ipp-crypto.git --depth 1 $(IPP_SOURCE) endif cd $(IPP_SOURCE) && git apply ../0001-IPP-crypto-for-SGX.patch mkdir -p $(IPP_SOURCE)/build diff --git a/external/ippcp_internal/Makefile.psw_dcap b/external/ippcp_internal/Makefile.psw_dcap index 3f526996c..2bb2e4c60 100644 --- a/external/ippcp_internal/Makefile.psw_dcap +++ b/external/ippcp_internal/Makefile.psw_dcap @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2020 Intel Corporation. All rights reserved. +# Copyright (C) 2011-2023 Intel Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -61,7 +61,7 @@ all: build_ipp $(MKDIR) $(OUT_DIR) $(CP) ipp-crypto/build/.build/RELEASE/lib/libippcp.a $(OUT_DIR) $(CP) ipp-crypto/include/* ./inc/ - patch ipp-crypto/include/ippcp.h -i ./inc/ippcp21u3.patch -o ./inc/ippcp.h + patch ipp-crypto/include/ippcp.h -i ./inc/ippcp21u7.patch -o ./inc/ippcp.h $(MKDIR) license $(CP) ipp-crypto/LICENSE ./license/ diff --git a/external/ippcp_internal/README.md b/external/ippcp_internal/README.md index da775fc58..7ec65d8c9 100644 --- a/external/ippcp_internal/README.md +++ b/external/ippcp_internal/README.md @@ -1,19 +1,30 @@ -The ippcp library is built based on the Open Source project ipp-crypto: +The ippcp library is built based on the IPP Cryptography open source project: * https://github.com/intel/ipp-crypto/ - * tag: [ippcp_2021.3](https://github.com/intel/ipp-crypto/tree/ippcp_2021.3) + * tag: [ippcp_2021.7](https://github.com/intel/ipp-crypto/tree/ippcp_2021.7) In order to build your own IPP crypto, please follow below steps: 1. Download the prebuilt mitigation tools package `as.ld.objdump.{ver}.tar.gz` from [01.org](https://download.01.org/intel-sgx/latest/linux-latest/), extract the package and copy the tools to `/usr/local/bin`. 2. Read the ipp-crypto README to prepare your build environment. -3. Make sure ipp-crypto source code are prepared. +3. Make sure ipp-crypto source code is prepared. 4. Build the target ippcp library with the prepared Makefile: - a. Build the target ippcp library with All-Loads-Mitigation: - $ make MITIGATION-CVE-2020-0551=LOAD - b. Build the target ippcp library with Branch-Mitigation: - $ make MITIGATION-CVE-2020-0551=CF - c. Build the target ippcp library with No-Mitigation: - $ make -The built-out static library `libippcp.a` and header files will be copied into the right place. + 1. Build the target ippcp library with All-Loads-Mitigation: + $ make MITIGATION-CVE-2020-0551=LOAD + 2. Build the target ippcp library with Branch-Mitigation: + $ make MITIGATION-CVE-2020-0551=CF + 3. Build the target ippcp library with No-Mitigation: + $ make +The built static library `libippcp.a` and header files will be copied into the right place. Remember to "make clean" before switching the build. -For IPP crypto reproducible build, please follow the instructions in [reproducibility README.md](../../linux/reproducibility/README.md) to reproduce the prebuilt IPP crypto. +For the IPP crypto reproducible build, please follow the instructions in [reproducibility README.md](../../linux/reproducibility/README.md) to reproduce the prebuilt IPP crypto. + +These are the steps to build the IPP Crypto-based dispatcher code after you built the library: +1. `cd ./ipp-crypto/tools/ipp_custom_library_tool_python` +2. `awk -F\, '/IPPAPI\(/ {print $2}' ../../../inc/ippcp.h | awk '{print $1}' >functions.txt` +3. `python3 main.py -c -g -p ./ -ff functions.txt -arch intel64 -d sse42 avx2 avx512ifma -root ../../build/.build/RELEASE/ --prefix sgx_disp_` +`Intel(R) Custom Library Tool console version is on...` +`Current package: Intel(R) Integrated Performance Primitives Cryptography Version 2021.7.0 (11.5 )` +`Generation completed!` +4. `./build_custom_library_intel64.sh` +`Build completed!` +5. `cp custom_dispatcher/intel64/* ../../../../../sdk/tlibcrypto/ipp/ipp_disp/intel64/` diff --git a/external/ippcp_internal/inc/ippcp21u3.patch b/external/ippcp_internal/inc/ippcp21u7.patch similarity index 100% rename from external/ippcp_internal/inc/ippcp21u3.patch rename to external/ippcp_internal/inc/ippcp21u7.patch diff --git a/external/ippcp_internal/inc/sgx_ippcp.h b/external/ippcp_internal/inc/sgx_ippcp.h index 18d452794..db4b7bca9 100644 --- a/external/ippcp_internal/inc/sgx_ippcp.h +++ b/external/ippcp_internal/inc/sgx_ippcp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * Copyright (C) 2011-2023 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -84,6 +84,9 @@ extern "C" { #define ippsAESDecryptCTR sgx_disp_ippsAESDecryptCTR #define ippsAESEncryptXTS_Direct sgx_disp_ippsAESEncryptXTS_Direct #define ippsAESDecryptXTS_Direct sgx_disp_ippsAESDecryptXTS_Direct + #define ippsAESSetupNoise sgx_disp_ippsAESSetupNoise + #define ippsAES_GCMSetupNoise sgx_disp_ippsAES_GCMSetupNoise + #define ippsAES_CMACSetupNoise sgx_disp_ippsAES_CMACSetupNoise #define ippsAES_EncryptCFB16_MB sgx_disp_ippsAES_EncryptCFB16_MB #define ippsSMS4GetSize sgx_disp_ippsSMS4GetSize #define ippsSMS4Init sgx_disp_ippsSMS4Init @@ -239,19 +242,30 @@ extern "C" { #define ippsHashMethodGetSize sgx_disp_ippsHashMethodGetSize #define ippsHashMethodSet_MD5 sgx_disp_ippsHashMethodSet_MD5 #define ippsHashMethodSet_SM3 sgx_disp_ippsHashMethodSet_SM3 + #define ippsHashStateMethodSet_SM3 sgx_disp_ippsHashStateMethodSet_SM3 #define ippsHashMethodSet_SHA1 sgx_disp_ippsHashMethodSet_SHA1 #define ippsHashMethodSet_SHA1_NI sgx_disp_ippsHashMethodSet_SHA1_NI #define ippsHashMethodSet_SHA1_TT sgx_disp_ippsHashMethodSet_SHA1_TT #define ippsHashMethodSet_SHA256 sgx_disp_ippsHashMethodSet_SHA256 #define ippsHashMethodSet_SHA256_NI sgx_disp_ippsHashMethodSet_SHA256_NI #define ippsHashMethodSet_SHA256_TT sgx_disp_ippsHashMethodSet_SHA256_TT + #define ippsHashStateMethodSet_SHA256 sgx_disp_ippsHashStateMethodSet_SHA256 + #define ippsHashStateMethodSet_SHA256_NI sgx_disp_ippsHashStateMethodSet_SHA256_NI + #define ippsHashStateMethodSet_SHA256_TT sgx_disp_ippsHashStateMethodSet_SHA256_TT #define ippsHashMethodSet_SHA224 sgx_disp_ippsHashMethodSet_SHA224 #define ippsHashMethodSet_SHA224_NI sgx_disp_ippsHashMethodSet_SHA224_NI #define ippsHashMethodSet_SHA224_TT sgx_disp_ippsHashMethodSet_SHA224_TT + #define ippsHashStateMethodSet_SHA224 sgx_disp_ippsHashStateMethodSet_SHA224 + #define ippsHashStateMethodSet_SHA224_NI sgx_disp_ippsHashStateMethodSet_SHA224_NI + #define ippsHashStateMethodSet_SHA224_TT sgx_disp_ippsHashStateMethodSet_SHA224_TT #define ippsHashMethodSet_SHA512 sgx_disp_ippsHashMethodSet_SHA512 #define ippsHashMethodSet_SHA384 sgx_disp_ippsHashMethodSet_SHA384 #define ippsHashMethodSet_SHA512_256 sgx_disp_ippsHashMethodSet_SHA512_256 #define ippsHashMethodSet_SHA512_224 sgx_disp_ippsHashMethodSet_SHA512_224 + #define ippsHashStateMethodSet_SHA512 sgx_disp_ippsHashStateMethodSet_SHA512 + #define ippsHashStateMethodSet_SHA384 sgx_disp_ippsHashStateMethodSet_SHA384 + #define ippsHashStateMethodSet_SHA512_256 sgx_disp_ippsHashStateMethodSet_SHA512_256 + #define ippsHashStateMethodSet_SHA512_224 sgx_disp_ippsHashStateMethodSet_SHA512_224 #define ippsHashGetSize_rmf sgx_disp_ippsHashGetSize_rmf #define ippsHashInit_rmf sgx_disp_ippsHashInit_rmf #define ippsHashPack_rmf sgx_disp_ippsHashPack_rmf @@ -546,12 +560,19 @@ extern "C" { #define ippsGFpECTstKeyPair sgx_disp_ippsGFpECTstKeyPair #define ippsGFpECSharedSecretDH sgx_disp_ippsGFpECSharedSecretDH #define ippsGFpECSharedSecretDHC sgx_disp_ippsGFpECSharedSecretDHC + #define ippsGFpECMessageRepresentationSM2 sgx_disp_ippsGFpECMessageRepresentationSM2 #define ippsGFpECSignDSA sgx_disp_ippsGFpECSignDSA #define ippsGFpECVerifyDSA sgx_disp_ippsGFpECVerifyDSA #define ippsGFpECSignNR sgx_disp_ippsGFpECSignNR #define ippsGFpECVerifyNR sgx_disp_ippsGFpECVerifyNR #define ippsGFpECSignSM2 sgx_disp_ippsGFpECSignSM2 #define ippsGFpECVerifySM2 sgx_disp_ippsGFpECVerifySM2 + #define ippsGFpECUserIDHashSM2 sgx_disp_ippsGFpECUserIDHashSM2 + #define ippsGFpECKeyExchangeSM2_GetSize sgx_disp_ippsGFpECKeyExchangeSM2_GetSize + #define ippsGFpECKeyExchangeSM2_Init sgx_disp_ippsGFpECKeyExchangeSM2_Init + #define ippsGFpECKeyExchangeSM2_Setup sgx_disp_ippsGFpECKeyExchangeSM2_Setup + #define ippsGFpECKeyExchangeSM2_SharedKey sgx_disp_ippsGFpECKeyExchangeSM2_SharedKey + #define ippsGFpECKeyExchangeSM2_Confirm sgx_disp_ippsGFpECKeyExchangeSM2_Confirm #define ippsGFpECGetInfo_GF sgx_disp_ippsGFpECGetInfo_GF #define ippsGFpECESGetSize_SM2 sgx_disp_ippsGFpECESGetSize_SM2 #define ippsGFpECESInit_SM2 sgx_disp_ippsGFpECESInit_SM2 @@ -561,6 +582,10 @@ extern "C" { #define ippsGFpECESDecrypt_SM2 sgx_disp_ippsGFpECESDecrypt_SM2 #define ippsGFpECESFinal_SM2 sgx_disp_ippsGFpECESFinal_SM2 #define ippsGFpECESGetBuffersSize_SM2 sgx_disp_ippsGFpECESGetBuffersSize_SM2 + #define ippsGFpECEncryptSM2_Ext_EncMsgSize sgx_disp_ippsGFpECEncryptSM2_Ext_EncMsgSize + #define ippsGFpECEncryptSM2_Ext sgx_disp_ippsGFpECEncryptSM2_Ext + #define ippsGFpECDecryptSM2_Ext_DecMsgSize sgx_disp_ippsGFpECDecryptSM2_Ext_DecMsgSize + #define ippsGFpECDecryptSM2_Ext sgx_disp_ippsGFpECDecryptSM2_Ext #ifdef __cplusplus diff --git a/external/ippcp_internal/ipp-crypto b/external/ippcp_internal/ipp-crypto index d9d13aaaf..48d0e528c 160000 --- a/external/ippcp_internal/ipp-crypto +++ b/external/ippcp_internal/ipp-crypto @@ -1 +1 @@ -Subproject commit d9d13aaaf8889753fb58a13c2652c39b67c2076b +Subproject commit 48d0e528cf948f32a0ed6e734e6e211470e5971a diff --git a/external/mbedtls/Makefile b/external/mbedtls/Makefile new file mode 100644 index 000000000..bda8918df --- /dev/null +++ b/external/mbedtls/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2011-2019 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +current_dir := $(patsubst %/,%,$(dir $(mkfile_path))) + +include ../../buildenv.mk + +LIB_NAME= libsgx_mbedcrypto.a +SRC_DIR = mbedtls_code + +CFLAGS := -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc + +CFLAGS += $(ENCLAVE_CFLAGS) $(SGX_COMMON_CFLAGS) -Werror -fno-exceptions -fPIC + +.PHONY: all clean library/libmbedcrypto.a +all: library/libmbedcrypto.a sgx_mbedtls_utils.o | $(BUILD_DIR) + @$(RM) -rf .libs && mkdir .libs + @cd .libs && $(AR) x ../$(SRC_DIR)/build/library/libmbedcrypto.a + @$(AR) rsD $(LIB_NAME) .libs/*.o sgx_mbedtls_utils.o + @$(CP) $(LIB_NAME) $(BUILD_DIR)/ + +$(BUILD_DIR): + @$(MKDIR) $@ + +library/libmbedcrypto.a: +ifeq ($(shell grep -c sgx mbedtls_code/library/rsa.c), 0) + @echo "Apply patch for SGX..." + @cd $(SRC_DIR) && git apply ../sgx_mbedtls.patch + @echo "Done." +endif + @rm -rf $(SRC_DIR)/build && mkdir $(SRC_DIR)/build + @cd $(SRC_DIR)/build && cmake -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} $(CFLAGS) -include$(current_dir)/bypass_to_sgxmbed.h " -DGEN_FILES=OFF -DCMAKE_C_COMPILER_WORKS=TRUE .. && make mbedcrypto + +sgx_mbedtls_utils.o: sgx_mbedtls_utils.c + @$(CC) $(CFLAGS) -c $< -o $@ + @echo "CC <= $<" + +clean: + @$(RM) -rf *.a *.o .libs $(BUILD_DIR)/$(LIB_NAME) $(SRC_DIR)/build diff --git a/external/mbedtls/bypass_to_sgxmbed.h b/external/mbedtls/bypass_to_sgxmbed.h new file mode 100644 index 000000000..a9a326de5 --- /dev/null +++ b/external/mbedtls/bypass_to_sgxmbed.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include + +#ifndef _BYPASS_TO_SGXMBED_ +#define _BYPASS_TO_SGXMBED_ + +int sgxmbed_printf(const char* fmt, ...); + +#define printf sgxmbed_printf + +#endif // _BYPASS_TO_SGXMBED_ + diff --git a/external/mbedtls/mbedtls_code b/external/mbedtls/mbedtls_code new file mode 160000 index 000000000..1873d3bfc --- /dev/null +++ b/external/mbedtls/mbedtls_code @@ -0,0 +1 @@ +Subproject commit 1873d3bfc2da771672bd8e7e8f41f57e0af77f33 diff --git a/external/mbedtls/sgx_mbedtls.patch b/external/mbedtls/sgx_mbedtls.patch new file mode 100644 index 000000000..d62c36f3c --- /dev/null +++ b/external/mbedtls/sgx_mbedtls.patch @@ -0,0 +1,230 @@ +diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h +index 4292b493b..a0fd173f4 100644 +--- a/include/mbedtls/mbedtls_config.h ++++ b/include/mbedtls/mbedtls_config.h +@@ -89,7 +89,7 @@ + * example, if double-width division is implemented in software, disabling + * it can reduce code size in some embedded targets. + */ +-//#define MBEDTLS_NO_UDBL_DIVISION ++#define MBEDTLS_NO_UDBL_DIVISION + + /** + * \def MBEDTLS_NO_64BIT_MULTIPLICATION +@@ -120,7 +120,7 @@ + * + * Uncomment if the CPU supports SSE2 (IA-32 specific). + */ +-//#define MBEDTLS_HAVE_SSE2 ++#define MBEDTLS_HAVE_SSE2 + + /** + * \def MBEDTLS_HAVE_TIME +@@ -140,7 +140,7 @@ + * regardless of the setting of MBEDTLS_HAVE_TIME, unless + * MBEDTLS_TIMING_ALT is used. See timing.c for more information. + */ +-#define MBEDTLS_HAVE_TIME ++//#define MBEDTLS_HAVE_TIME + + /** + * \def MBEDTLS_HAVE_TIME_DATE +@@ -161,7 +161,7 @@ + * mbedtls_platform_gmtime_r() at compile-time by using the macro + * MBEDTLS_PLATFORM_GMTIME_R_ALT. + */ +-#define MBEDTLS_HAVE_TIME_DATE ++//#define MBEDTLS_HAVE_TIME_DATE + + /** + * \def MBEDTLS_PLATFORM_MEMORY +@@ -264,7 +264,7 @@ + * + * Uncomment to get errors on using deprecated functions and features. + */ +-//#define MBEDTLS_DEPRECATED_REMOVED ++#define MBEDTLS_DEPRECATED_REMOVED + + /** \} name SECTION: System support */ + +@@ -477,7 +477,7 @@ + * + * Uncomment to use your own hardware entropy collector. + */ +-//#define MBEDTLS_ENTROPY_HARDWARE_ALT ++#define MBEDTLS_ENTROPY_HARDWARE_ALT + + /** + * \def MBEDTLS_AES_ROM_TABLES +@@ -1045,7 +1045,7 @@ + * + * Enable functions that use the filesystem. + */ +-#define MBEDTLS_FS_IO ++//#define MBEDTLS_FS_IO + + /** + * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES +@@ -1068,7 +1068,7 @@ + * + * Uncomment this macro to disable the built-in platform entropy functions. + */ +-//#define MBEDTLS_NO_PLATFORM_ENTROPY ++#define MBEDTLS_NO_PLATFORM_ENTROPY + + /** + * \def MBEDTLS_ENTROPY_FORCE_SHA256 +@@ -1917,7 +1917,7 @@ + * + * Uncomment this to enable pthread mutexes. + */ +-//#define MBEDTLS_THREADING_PTHREAD ++#define MBEDTLS_THREADING_PTHREAD + + /** + * \def MBEDTLS_USE_PSA_CRYPTO +@@ -2778,7 +2778,7 @@ + * + * This modules adds support for the VIA PadLock on x86. + */ +-#define MBEDTLS_PADLOCK_C ++//#define MBEDTLS_PADLOCK_C + + /** + * \def MBEDTLS_PEM_PARSE_C +@@ -2994,7 +2994,7 @@ + * either MBEDTLS_PSA_ITS_FILE_C or a native implementation of + * the PSA ITS interface + */ +-#define MBEDTLS_PSA_CRYPTO_STORAGE_C ++//#define MBEDTLS_PSA_CRYPTO_STORAGE_C + + /** + * \def MBEDTLS_PSA_ITS_FILE_C +@@ -3006,7 +3006,7 @@ + * + * Requires: MBEDTLS_FS_IO + */ +-#define MBEDTLS_PSA_ITS_FILE_C ++//#define MBEDTLS_PSA_ITS_FILE_C + + /** + * \def MBEDTLS_RIPEMD160_C +@@ -3312,7 +3312,7 @@ + * + * Enable this layer to allow use of mutexes within mbed TLS + */ +-//#define MBEDTLS_THREADING_C ++#define MBEDTLS_THREADING_C + + /** + * \def MBEDTLS_TIMING_C +@@ -3336,7 +3336,7 @@ + * + * Module: library/timing.c + */ +-#define MBEDTLS_TIMING_C ++//#define MBEDTLS_TIMING_C + + /** + * \def MBEDTLS_VERSION_C +diff --git a/library/aesni.c b/library/aesni.c +index a23c5b595..db1cf1ccd 100644 +--- a/library/aesni.c ++++ b/library/aesni.c +@@ -23,6 +23,7 @@ + */ + + #include "common.h" ++#include "sgx_cpuid.h" + + #if defined(MBEDTLS_AESNI_C) + +@@ -48,21 +49,11 @@ int mbedtls_aesni_has_support(unsigned int what) + static unsigned int c = 0; + + if (!done) { +-#if MBEDTLS_AESNI_HAVE_CODE == 2 +- static unsigned info[4] = { 0, 0, 0, 0 }; +-#if defined(_MSC_VER) +- __cpuid(info, 1); +-#else +- __cpuid(1, info[0], info[1], info[2], info[3]); +-#endif +- c = info[2]; +-#else /* AESNI using asm */ +- asm ("movl $1, %%eax \n\t" +- "cpuid \n\t" +- : "=c" (c) +- : +- : "eax", "ebx", "edx"); +-#endif /* MBEDTLS_AESNI_HAVE_CODE */ ++ int cpuinfo[4] = { -1 }; ++ int status = sgx_cpuid(cpuinfo, 1); ++ if ( 0 != status ) { ++ c = cpuinfo[2]; ++ } + done = 1; + } + +diff --git a/library/entropy.c b/library/entropy.c +index e55410c76..0853577ae 100644 +--- a/library/entropy.c ++++ b/library/entropy.c +@@ -16,6 +16,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ ++#include "sgx_trts.h" + + #include "common.h" + +@@ -548,6 +549,19 @@ static int entropy_dummy_source(void *data, unsigned char *output, + + #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT) + ++int mbedtls_hardware_poll( void *Data, unsigned char *Output, size_t Len, size_t *oLen ) ++{ ++ int ret = 0; ++ (void)Data; ++ ++ if (sgx_read_rand(Output, Len) != SGX_SUCCESS) { ++ ret = 1; ++ } ++ *oLen = Len; ++ ++ return ret; ++} ++ + static int mbedtls_entropy_source_self_test_gather(unsigned char *buf, size_t buf_len) + { + int ret = 0; +diff --git a/library/rsa.c b/library/rsa.c +index 01159dfa2..a1978d106 100644 +--- a/library/rsa.c ++++ b/library/rsa.c +@@ -34,6 +34,7 @@ + * https://arxiv.org/abs/1702.08719v2 + * + */ ++#include "sgx_trts.h" + + #include "common.h" + +@@ -2404,15 +2405,12 @@ void mbedtls_rsa_free(mbedtls_rsa_context *ctx) + static int myrand(void *rng_state, unsigned char *output, size_t len) + { + #if !defined(__OpenBSD__) && !defined(__NetBSD__) +- size_t i; + + if (rng_state != NULL) { + rng_state = NULL; + } + +- for (i = 0; i < len; ++i) { +- output[i] = rand(); +- } ++ if (sgx_read_rand(output, len) != SGX_SUCCESS) return 1; + #else + if (rng_state != NULL) { + rng_state = NULL; diff --git a/external/mbedtls/sgx_mbedtls_utils.c b/external/mbedtls/sgx_mbedtls_utils.c new file mode 100644 index 000000000..4743fba85 --- /dev/null +++ b/external/mbedtls/sgx_mbedtls_utils.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +int sgxmbed_printf(const char* fmt, ...) +{ + return 0; +} diff --git a/external/sgx-emm/Makefile b/external/sgx-emm/Makefile index ab644aa92..e04122240 100644 --- a/external/sgx-emm/Makefile +++ b/external/sgx-emm/Makefile @@ -35,8 +35,6 @@ CPPFLAGS += -I$(EMM_DIR)/include \ -Wno-missing-braces \ -Wno-unused-parameter -EMMFLAGS := -mno-sse - C_Files := $(EMM_DIR)/bit_array.c \ $(EMM_DIR)/ema.c \ $(EMM_DIR)/emalloc.c \ @@ -62,7 +60,7 @@ $(LIB_NAME): $(CHECK_SOURCE) $(OBJS) $(AR) rcs $@ $(OBJS) $(OBJS): %.o: %.c - $(CC) -c $(COMMON_FLAGS) $(ENCLAVE_CFLAGS) $(CPPFLAGS) $(EMMFLAGS) $< -o $@ + $(CC) -c $(COMMON_FLAGS) $(ENCLAVE_CFLAGS) $(CPPFLAGS) $< -o $@ $(BUILD_DIR): @$(MKDIR) $@ @@ -72,7 +70,7 @@ ifeq ($(shell git rev-parse --is-inside-work-tree 2> /dev/null), true) git submodule update -f --init --recursive -- $(EMM_DIR) else $(RM) -rf $(EMM_DIR) - git clone -b sgx-emm-1.0.1 https://github.com/intel/sgx-emm.git --depth 1 $(EMM_DIR) + git clone -b sgx-emm-1.0.2 https://github.com/intel/sgx-emm.git --depth 1 $(EMM_DIR) endif clean: diff --git a/external/sgx-emm/emm_src b/external/sgx-emm/emm_src index 222b9d8cd..eb4d16c45 160000 --- a/external/sgx-emm/emm_src +++ b/external/sgx-emm/emm_src @@ -1 +1 @@ -Subproject commit 222b9d8cd246809cc8da041241824b0d0469000f +Subproject commit eb4d16c459a27b1aa4e77fa4b2104dc537e2d001 diff --git a/external/sgxssl/prepare_sgxssl.sh b/external/sgxssl/prepare_sgxssl.sh index 4e2d9c919..39a443290 100755 --- a/external/sgxssl/prepare_sgxssl.sh +++ b/external/sgxssl/prepare_sgxssl.sh @@ -70,6 +70,11 @@ if [ ! -f $openssl_out_dir/$openssl_ver_name.tar.gz ]; then fi pushd $top_dir/Linux/ +patched=$(grep -c x509 build_openssl.sh) +if [ '0' -eq $patched ]; then + sed -i '140a cp ../../../dcap_source/prebuilt/openssl/OpenSSL_1.1.1u_files/pcy_*.* crypto/x509v3/.' build_openssl.sh + sed -i '140a cp ../../../dcap_source/prebuilt/openssl/OpenSSL_1.1.1u_files/x509_vfy.c crypto/x509/.' build_openssl.sh +fi if [ "$MITIGATION" != "" ]; then make clean all LINUX_SGX_BUILD=1 DEBUG=$DEBUG else diff --git a/external/vtune/linux/include/jitprofiling.h b/external/vtune/linux/include/jitprofiling.h deleted file mode 100644 index 6c656cc5e..000000000 --- a/external/vtune/linux/include/jitprofiling.h +++ /dev/null @@ -1,694 +0,0 @@ -/* - This file is provided under a dual BSD/GPLv2 license. When using or - redistributing this file, you may do so under either license. - - GPL LICENSE SUMMARY - - Copyright (c) 2005-2014 Intel Corporation. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - The full GNU General Public License is included in this distribution - in the file called LICENSE.GPL. - - Contact Information: - http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ - - BSD LICENSE - - Copyright (c) 2005-2014 Intel Corporation. All rights reserved. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __JITPROFILING_H__ -#define __JITPROFILING_H__ - -/** - * @brief JIT Profiling APIs - * - * The JIT Profiling API is used to report information about just-in-time - * generated code that can be used by performance tools. The user inserts - * calls in the code generator to report information before JIT-compiled - * code goes to execution. This information is collected at runtime and used - * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics - * associated with JIT-compiled code. - * - * These APIs can be used to\n - * - **Profile trace-based and method-based JIT-compiled - * code**. Some examples of environments that you can profile with these APIs: - * dynamic JIT compilation of JavaScript code traces, JIT execution in OpenCL(TM) - * software technology, Java/.NET managed execution environments, and custom - * ISV JIT engines. - * @code - * #include - * - * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) { - * return; - * } - * - * iJIT_Method_Load jmethod = {0}; - * jmethod.method_id = iJIT_GetNewMethodID(); - * jmethod.method_name = "method_name"; - * jmethod.class_file_name = "class_name"; - * jmethod.source_file_name = "source_file_name"; - * jmethod.method_load_address = code_addr; - * jmethod.method_size = code_size; - * - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod); - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL); - * @endcode - * - * * Expected behavior: - * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an - * already reported method, then such a method becomes invalid and its - * memory region is treated as unloaded. VTune Amplifier displays the metrics - * collected by the method until it is overwritten. - * * If supplied line number information contains multiple source lines for - * the same assembly instruction (code location), then VTune Amplifier picks up - * the first line number. - * * Dynamically generated code can be associated with a module name. - * Use the iJIT_Method_Load_V2 structure.\n - * Clarification of some cases: - * * If you register a function with the same method ID multiple times, - * specifying different module names, then the VTune Amplifier picks up - * the module name registered first. If you want to distinguish the same - * function between different JIT engines, supply different method IDs for - * each function. Other symbolic information (for example, source file) - * can be identical. - * - * - **Analyze split functions** (multiple joint or disjoint code regions - * belonging to the same function) **including re-JIT** - * with potential overlapping of code regions in time, which is common in - * resource-limited environments. - * @code - * #include - * - * unsigned int method_id = iJIT_GetNewMethodID(); - * - * iJIT_Method_Load a = {0}; - * a.method_id = method_id; - * a.method_load_address = 0x100; - * a.method_size = 0x20; - * - * iJIT_Method_Load b = {0}; - * b.method_id = method_id; - * b.method_load_address = 0x200; - * b.method_size = 0x30; - * - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b); - * @endcode - * - * * Expected behaviour: - * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an - * already reported method, then such a method becomes invalid and - * its memory region is treated as unloaded. - * * All code regions reported with the same method ID are considered as - * belonging to the same method. Symbolic information (method name, - * source file name) will be taken from the first notification, and all - * subsequent notifications with the same method ID will be processed - * only for line number table information. So, the VTune Amplifier will map - * samples to a source line using the line number table from the current - * notification while taking the source file name from the very first one.\n - * Clarification of some cases:\n - * * If you register a second code region with a different source file - * name and the same method ID, then this information will be saved and - * will not be considered as an extension of the first code region, but - * VTune Amplifier will use the source file of the first code region and map - * performance metrics incorrectly. - * * If you register a second code region with the same source file as - * for the first region and the same method ID, then the source file will be - * discarded but VTune Amplifier will map metrics to the source file correctly. - * * If you register a second code region with a null source file and - * the same method ID, then provided line number info will be associated - * with the source file of the first code region. - * - * - **Explore inline functions** including multi-level hierarchy of - * nested inline methods which shows how performance metrics are distributed through them. - * @code - * #include - * - * // method_id parent_id - * // [-- c --] 3000 2000 - * // [---- d -----] 2001 1000 - * // [---- b ----] 2000 1000 - * // [------------ a ----------------] 1000 n/a - * - * iJIT_Method_Load a = {0}; - * a.method_id = 1000; - * - * iJIT_Method_Inline_Load b = {0}; - * b.method_id = 2000; - * b.parent_method_id = 1000; - * - * iJIT_Method_Inline_Load c = {0}; - * c.method_id = 3000; - * c.parent_method_id = 2000; - * - * iJIT_Method_Inline_Load d = {0}; - * d.method_id = 2001; - * d.parent_method_id = 1000; - * - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b); - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c); - * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d); - * @endcode - * - * * Requirements: - * * Each inline (iJIT_Method_Inline_Load) method should be associated - * with two method IDs: one for itself; one for its immediate parent. - * * Address regions of inline methods of the same parent method cannot - * overlap each other. - * * Execution of the parent method must not be started until it and all - * its inline methods are reported. - * * Expected behaviour: - * * In case of nested inline methods an order of - * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important. - * * If any event overwrites either inline method or top parent method, - * then the parent, including inline methods, becomes invalid and its memory - * region is treated as unloaded. - * - * **Life time of allocated data**\n - * The client sends an event notification to the agent with event-specific - * data, which is a structure. The pointers in the structure refer to memory - * allocated by the client, which responsible for releasing it. The pointers are - * used by the iJIT_NotifyEvent method to copy client's data in a trace file, - * and they are not used after the iJIT_NotifyEvent method returns. - */ - -/** - * @defgroup jitapi JIT Profiling - * @ingroup internal - * @{ - */ - -/** - * @brief Enumerator for the types of notifications - */ -typedef enum iJIT_jvm_event -{ - iJVM_EVENT_TYPE_SHUTDOWN = 2, /**<\brief Send this to shutdown the agent. - * Use NULL for event data. */ - - iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**<\brief Send when dynamic code is - * JIT compiled and loaded into - * memory by the JIT engine, but - * before the code is executed. - * Use iJIT_Method_Load as event - * data. */ -/** @cond exclude_from_documentation */ - iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**<\brief Send when compiled dynamic - * code is being unloaded from memory. - * Use iJIT_Method_Load as event data.*/ -/** @endcond */ - - iJVM_EVENT_TYPE_METHOD_UPDATE, /**<\brief Send to provide new content for - * a previously reported dynamic code. - * The previous content will be invalidated - * starting from the time of the notification. - * Use iJIT_Method_Load as event data but - * required fields are following: - * - method_id identify the code to update. - * - method_load_address specify start address - * within identified code range - * where update should be started. - * - method_size specify length of updated code - * range. */ - - - iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**<\brief Send when an inline dynamic - * code is JIT compiled and loaded - * into memory by the JIT engine, - * but before the parent code region - * starts executing. - * Use iJIT_Method_Inline_Load as event data.*/ - -/** @cond exclude_from_documentation */ - iJVM_EVENT_TYPE_METHOD_UPDATE_V2, -/** @endcond */ - - iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 = 21, /**<\brief Send when a dynamic code is - * JIT compiled and loaded into - * memory by the JIT engine, but - * before the code is executed. - * Use iJIT_Method_Load_V2 as event data. */ - - iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 /**<\brief Send when a dynamic code is - * JIT compiled and loaded into - * memory by the JIT engine, but - * before the code is executed. - * Use iJIT_Method_Load_V3 as event data. */ -} iJIT_JVM_EVENT; - -/** - * @brief Enumerator for the agent's mode - */ -typedef enum _iJIT_IsProfilingActiveFlags -{ - iJIT_NOTHING_RUNNING = 0x0000, /**<\brief The agent is not running; - * iJIT_NotifyEvent calls will - * not be processed. */ - iJIT_SAMPLING_ON = 0x0001, /**<\brief The agent is running and - * ready to process notifications. */ -} iJIT_IsProfilingActiveFlags; - -/** - * @brief Description of a single entry in the line number information of a code region. - * @details A table of line number entries gives information about how the reported code region - * is mapped to source file. - * Intel(R) VTune(TM) Amplifier uses line number information to attribute - * the samples (virtual address) to a line number. \n - * It is acceptable to report different code addresses for the same source line: - * @code - * Offset LineNumber - * 1 2 - * 12 4 - * 15 2 - * 18 1 - * 21 30 - * - * VTune Amplifier constructs the following table using the client data - * - * Code subrange Line number - * 0-1 2 - * 1-12 4 - * 12-15 2 - * 15-18 1 - * 18-21 30 - * @endcode - */ -typedef struct _LineNumberInfo -{ - unsigned int Offset; /**<\brief Offset from the begining of the code region. */ - unsigned int LineNumber; /**<\brief Matching source line number offset (from beginning of source file). */ - -} *pLineNumberInfo, LineNumberInfo; - -/** - * @brief Enumerator for the code architecture. - */ -typedef enum _iJIT_CodeArchitecture -{ - iJIT_CA_NATIVE = 0, /**<\brief Native to the process architecture that is calling it. */ - - iJIT_CA_32, /**<\brief 32-bit machine code. */ - - iJIT_CA_64 /**<\brief 64-bit machine code. */ - -} iJIT_CodeArchitecture; - -#pragma pack(push, 8) - -/** - * @brief Description of a JIT-compiled method - * @details When you use the iJIT_Method_Load structure to describe - * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED - * as an event type to report it. - */ -typedef struct _iJIT_Method_Load -{ - unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. - * You must either use the API function - * iJIT_GetNewMethodID to get a valid and unique - * method ID, or else manage ID uniqueness - * and correct range by yourself.\n - * You must use the same method ID for all code - * regions of the same method, otherwise different - * method IDs specify different methods. */ - - char* method_name; /**<\brief The name of the method. It can be optionally - * prefixed with its class name and appended with - * its complete signature. Can't be NULL. */ - - void* method_load_address; /**<\brief The start virtual address of the method code - * region. If NULL, data provided with - * event are not accepted. */ - - unsigned int method_size; /**<\brief The code size of the method in memory. - * If 0, then data provided with the event are not - * accepted. */ - - unsigned int line_number_size; /**<\brief The number of entries in the line number - * table.0 if none. */ - - pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info - * array. Can be NULL if - * line_number_size is 0. See - * LineNumberInfo Structure for a - * description of a single entry in - * the line number info array */ - - unsigned int class_id; /**<\brief This field is obsolete. */ - - char* class_file_name; /**<\brief Class name. Can be NULL.*/ - - char* source_file_name; /**<\brief Source file name. Can be NULL.*/ - -} *piJIT_Method_Load, iJIT_Method_Load; - -/** - * @brief Description of a JIT-compiled method - * @details When you use the iJIT_Method_Load_V2 structure to describe - * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 - * as an event type to report it. - */ -typedef struct _iJIT_Method_Load_V2 -{ - unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. - * You must either use the API function - * iJIT_GetNewMethodID to get a valid and unique - * method ID, or else manage ID uniqueness - * and correct range by yourself.\n - * You must use the same method ID for all code - * regions of the same method, otherwise different - * method IDs specify different methods. */ - - char* method_name; /**<\brief The name of the method. It can be optionally - * prefixed with its class name and appended with - * its complete signature. Can't be NULL. */ - - void* method_load_address; /**<\brief The start virtual address of the method code - * region. If NULL, then data provided with the - * event are not accepted. */ - - unsigned int method_size; /**<\brief The code size of the method in memory. - * If 0, then data provided with the event are not - * accepted. */ - - unsigned int line_number_size; /**<\brief The number of entries in the line number - * table. 0 if none. */ - - pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info - * array. Can be NULL if - * line_number_size is 0. See - * LineNumberInfo Structure for a - * description of a single entry in - * the line number info array. */ - - char* class_file_name; /**<\brief Class name. Can be NULL. */ - - char* source_file_name; /**<\brief Source file name. Can be NULL. */ - - char* module_name; /**<\brief Module name. Can be NULL. - The module name can be useful for distinguishing among - different JIT engines. VTune Amplifier will display - reported methods grouped by specific module. */ - -} *piJIT_Method_Load_V2, iJIT_Method_Load_V2; - -/** - * @brief Description of a JIT-compiled method - * @details The iJIT_Method_Load_V3 structure is the same as iJIT_Method_Load_V2 - * with a newly introduced 'arch' field that specifies architecture of the code region. - * When you use the iJIT_Method_Load_V3 structure to describe - * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 - * as an event type to report it. - */ -typedef struct _iJIT_Method_Load_V3 -{ - unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. - * You must either use the API function - * iJIT_GetNewMethodID to get a valid and unique - * method ID, or manage ID uniqueness - * and correct range by yourself.\n - * You must use the same method ID for all code - * regions of the same method, otherwise they are - * treated as regions of different methods. */ - - char* method_name; /**<\brief The name of the method. It can be optionally - * prefixed with its class name and appended with - * its complete signature. Cannot be NULL. */ - - void* method_load_address; /**<\brief The start virtual address of the method code - * region. If NULL, then data provided with the - * event are not accepted. */ - - unsigned int method_size; /**<\brief The code size of the method in memory. - * If 0, then data provided with the event are not - * accepted. */ - - unsigned int line_number_size; /**<\brief The number of entries in the line number - * table. 0 if none. */ - - pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info - * array. Can be NULL if - * line_number_size is 0. See - * LineNumberInfo Structure for a - * description of a single entry in - * the line number info array. */ - - char* class_file_name; /**<\brief Class name. Can be NULL. */ - - char* source_file_name; /**<\brief Source file name. Can be NULL. */ - - char* module_name; /**<\brief Module name. Can be NULL. - * The module name can be useful for distinguishing among - * different JIT engines. VTune Amplifier will display - * reported methods grouped by specific module. */ - - iJIT_CodeArchitecture module_arch; /**<\brief Architecture of the method's code region. - * By default, it is the same as the process - * architecture that is calling it. - * For example, you can use it if your 32-bit JIT - * engine generates 64-bit code. - * - * If JIT engine reports both 32-bit and 64-bit types - * of methods then VTune Amplifier splits the methods - * with the same module name but with different - * architectures in two different modules. VTune Amplifier - * modifies the original name provided with a 64-bit method - * version by ending it with '(64)' */ - -} *piJIT_Method_Load_V3, iJIT_Method_Load_V3; - -/** - * @brief Description of an inline JIT-compiled method - * @details When you use the_iJIT_Method_Inline_Load structure to describe - * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED - * as an event type to report it. - */ -typedef struct _iJIT_Method_Inline_Load -{ - unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. - * You must either use the API function - * iJIT_GetNewMethodID to get a valid and unique - * method ID, or else manage ID uniqueness - * and correct range by yourself. */ - - unsigned int parent_method_id; /**<\brief Unique immediate parent's method ID. - * Cannot be 0. - * You must either use the API function - * iJIT_GetNewMethodID to get a valid and unique - * method ID, or else manage ID uniqueness - * and correct range by yourself. */ - - char* method_name; /**<\brief The name of the method. It can be optionally - * prefixed with its class name and appended with - * its complete signature. Can't be NULL. */ - - void* method_load_address; /** <\brief The virtual address on which the method - * is inlined. If NULL, then data provided with - * the event are not accepted. */ - - unsigned int method_size; /**<\brief The code size of the method in memory. - * If 0, then data provided with the event are not - * accepted. */ - - unsigned int line_number_size; /**<\brief The number of entries in the line number - * table. 0 if none. */ - - pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info - * array. Can be NULL if - * line_number_size is 0. See - * LineNumberInfo Structure for a - * description of a single entry in - * the line number info array */ - - char* class_file_name; /**<\brief Class name. Can be NULL.*/ - - char* source_file_name; /**<\brief Source file name. Can be NULL.*/ - -} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load; - -/** @cond exclude_from_documentation */ -/** - * @brief Description of a segment type - * @details Use the segment type to specify a type of data supplied - * with the iJVM_EVENT_TYPE_METHOD_UPDATE_V2 event to be applied to - * a certain code trace. - */ -typedef enum _iJIT_SegmentType -{ - iJIT_CT_UNKNOWN = 0, - - iJIT_CT_CODE, /**<\brief Executable code. */ - - iJIT_CT_DATA, /**<\brief Data (not executable code). - * VTune Amplifier uses the format string - * (see iJIT_Method_Update) to represent - * this data in the VTune Amplifier GUI */ - - iJIT_CT_KEEP, /**<\brief Use the previous markup for the trace. - * Can be used for the following - * iJVM_EVENT_TYPE_METHOD_UPDATE_V2 events, - * if the type of the previously reported segment - * type is the same. */ - iJIT_CT_EOF -} iJIT_SegmentType; - -/** - * @brief Description of a dynamic update of the content within JIT-compiled method - * @details The JIT engine may generate the methods that are updated at runtime - * partially by mixed (data + executable code) content. When you use the iJIT_Method_Update - * structure to describe the update of the content within a JIT-compiled method, - * use iJVM_EVENT_TYPE_METHOD_UPDATE_V2 as an event type to report it. - * - * On the first Update event, VTune Amplifier copies the original code range reported by - * the iJVM_EVENT_TYPE_METHOD_LOAD event, then modifies it with the supplied bytes and - * adds the modified range to the original method. For next update events, VTune Amplifier - * does the same but it uses the latest modified version of a code region for update. - * Eventually, VTune Amplifier GUI displays multiple code ranges for the method reported by - * the iJVM_EVENT_TYPE_METHOD_LOAD event. - * Notes: - * - Multiple update events with different types for the same trace are allowed - * but they must be reported for the same code ranges. - * Example, - * @code - * [-- data---] Allowed - * [-- code --] Allowed - * [code] Ignored - * [-- data---] Allowed - * [-- code --] Allowed - * [------------ trace ---------] - * @endcode - * - The types of previously reported events can be changed but they must be reported - * for the same code ranges. - * Example, - * @code - * [-- data---] Allowed - * [-- code --] Allowed - * [-- data---] Allowed - * [-- code --] Allowed - * [------------ trace ---------] - * @endcode - */ - -typedef struct _iJIT_Method_Update -{ - void* load_address; /**<\brief Start address of the update within a method */ - - unsigned int size; /**<\brief The update size */ - - iJIT_SegmentType type; /**<\brief Type of the update */ - - const char* data_format; /**<\brief C string that contains a format string - * that follows the same specifications as format in printf. - * The format string is used for iJIT_CT_CODE only - * and cannot be NULL. - * Format can be changed on the fly. */ -} *piJIT_Method_Update, iJIT_Method_Update; - -/** @endcond */ - -#pragma pack(pop) - -/** @cond exclude_from_documentation */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef CDECL -# if defined WIN32 || defined _WIN32 -# define CDECL __cdecl -# else /* defined WIN32 || defined _WIN32 */ -# if defined _M_IX86 || defined __i386__ -# define CDECL __attribute__ ((cdecl)) -# else /* _M_IX86 || __i386__ */ -# define CDECL /* actual only on x86_64 platform */ -# endif /* _M_IX86 || __i386__ */ -# endif /* defined WIN32 || defined _WIN32 */ -#endif /* CDECL */ - -#define JITAPI CDECL -/** @endcond */ - -/** - * @brief Generates a new unique method ID. - * - * You must use this API to obtain unique and valid method IDs for methods or - * traces reported to the agent if you don't have your own mechanism to generate - * unique method IDs. - * - * @return a new unique method ID. When out of unique method IDs, this API - * returns 0, which is not an accepted value. - */ -unsigned int JITAPI iJIT_GetNewMethodID(void); - -/** - * @brief Returns the current mode of the agent. - * - * @return iJIT_SAMPLING_ON, indicating that agent is running, or - * iJIT_NOTHING_RUNNING if no agent is running. - */ -iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); - -/** - * @brief Reports infomation about JIT-compiled code to the agent. - * - * The reported information is used to attribute samples obtained from any - * Intel(R) VTune(TM) Amplifier collector. This API needs to be called - * after JIT compilation and before the first entry into the JIT-compiled - * code. - * - * @param[in] event_type - type of the data sent to the agent - * @param[in] EventSpecificData - pointer to event-specific data - * - * @returns 1 on success, otherwise 0. - */ -int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -/** @endcond */ - -/** @} jitapi group */ - -#endif /* __JITPROFILING_H__ */ diff --git a/external/vtune/linux/sdk/src/ittnotify/Makefile b/external/vtune/linux/sdk/src/ittnotify/Makefile index ce1432d0a..bc30cf44c 100644 --- a/external/vtune/linux/sdk/src/ittnotify/Makefile +++ b/external/vtune/linux/sdk/src/ittnotify/Makefile @@ -1,4 +1,4 @@ -OBJ := ittnotify_static.o jitprofiling.o +OBJ := ittnotify_static.o LIBNAME := libittnotify.a diff --git a/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c b/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c deleted file mode 100644 index 7993af39f..000000000 --- a/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - This file is provided under a dual BSD/GPLv2 license. When using or - redistributing this file, you may do so under either license. - - GPL LICENSE SUMMARY - - Copyright (c) 2005-2014 Intel Corporation. All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - The full GNU General Public License is included in this distribution - in the file called LICENSE.GPL. - - Contact Information: - http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ - - BSD LICENSE - - Copyright (c) 2005-2014 Intel Corporation. All rights reserved. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ittnotify_config.h" - -#if ITT_PLATFORM==ITT_PLATFORM_WIN -#include -#pragma optimize("", off) -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ -#if ITT_PLATFORM != ITT_PLATFORM_MAC && ITT_PLATFORM != ITT_PLATFORM_FREEBSD -#include -#endif -#include - -#include "jitprofiling.h" - -static const char rcsid[] = "\n@(#) $Revision: 398909 $\n"; - -#define DLL_ENVIRONMENT_VAR "VS_PROFILER" - -#ifndef NEW_DLL_ENVIRONMENT_VAR -#if ITT_ARCH==ITT_ARCH_IA32 -#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER32" -#else -#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER64" -#endif -#endif /* NEW_DLL_ENVIRONMENT_VAR */ - -#if ITT_PLATFORM==ITT_PLATFORM_WIN -#define DEFAULT_DLLNAME "JitPI.dll" -HINSTANCE m_libHandle = NULL; -#elif ITT_PLATFORM==ITT_PLATFORM_MAC -#define DEFAULT_DLLNAME "libJitPI.dylib" -void* m_libHandle = NULL; -#else -#define DEFAULT_DLLNAME "libJitPI.so" -void* m_libHandle = NULL; -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - -/* default location of JIT profiling agent on Android */ -#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so" - -/* the function pointers */ -typedef unsigned int(*TPInitialize)(void); -static TPInitialize FUNC_Initialize=NULL; - -typedef unsigned int(*TPNotify)(unsigned int, void*); -static TPNotify FUNC_NotifyEvent=NULL; - -static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING; - -/* end collector dll part. */ - -/* loadiJIT_Funcs() : this function is called just in the beginning - * and is responsible to load the functions from BistroJavaCollector.dll - * result: - * on success: the functions loads, iJIT_DLL_is_missing=0, return value = 1 - * on failure: the functions are NULL, iJIT_DLL_is_missing=1, return value = 0 - */ -static int loadiJIT_Funcs(void); - -/* global representing whether the collector can't be loaded */ -static int iJIT_DLL_is_missing = 0; - -ITT_EXTERN_C int JITAPI -iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData) -{ - int ReturnValue; - - /* initialization part - the collector has not been loaded yet. */ - if (!FUNC_NotifyEvent) - { - if (iJIT_DLL_is_missing) - return 0; - - if (!loadiJIT_Funcs()) - return 0; - } - - if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED || - event_type == iJVM_EVENT_TYPE_METHOD_UPDATE) - { - if (((piJIT_Method_Load)EventSpecificData)->method_id == 0) - return 0; - } - else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2) - { - if (((piJIT_Method_Load_V2)EventSpecificData)->method_id == 0) - return 0; - } - else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3) - { - if (((piJIT_Method_Load_V3)EventSpecificData)->method_id == 0) - return 0; - } - else if (event_type == iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED) - { - if (((piJIT_Method_Inline_Load)EventSpecificData)->method_id == 0 || - ((piJIT_Method_Inline_Load)EventSpecificData)->parent_method_id == 0) - return 0; - } - - ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData); - - return ReturnValue; -} - -ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive() -{ - if (!iJIT_DLL_is_missing) - { - loadiJIT_Funcs(); - } - - return executionMode; -} - -/* This function loads the collector dll and the relevant functions. - * on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1 - * on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0 - */ -static int loadiJIT_Funcs() -{ - static int bDllWasLoaded = 0; - char *dllName = (char*)rcsid; /* !! Just to avoid unused code elimination */ -#if ITT_PLATFORM==ITT_PLATFORM_WIN - DWORD dNameLength = 0; -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - - if(bDllWasLoaded) - { - /* dll was already loaded, no need to do it for the second time */ - return 1; - } - - /* Assumes that the DLL will not be found */ - iJIT_DLL_is_missing = 1; - FUNC_NotifyEvent = NULL; - - if (m_libHandle) - { -#if ITT_PLATFORM==ITT_PLATFORM_WIN - FreeLibrary(m_libHandle); -#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - dlclose(m_libHandle); -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - m_libHandle = NULL; - } - - /* Try to get the dll name from the environment */ -#if ITT_PLATFORM==ITT_PLATFORM_WIN - dNameLength = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, NULL, 0); - if (dNameLength) - { - DWORD envret = 0; - dllName = (char*)malloc(sizeof(char) * (dNameLength + 1)); - if(dllName != NULL) - { - envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, - dllName, dNameLength); - if (envret) - { - /* Try to load the dll from the PATH... */ - m_libHandle = LoadLibraryExA(dllName, - NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - } - free(dllName); - } - } else { - /* Try to use old VS_PROFILER variable */ - dNameLength = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, NULL, 0); - if (dNameLength) - { - DWORD envret = 0; - dllName = (char*)malloc(sizeof(char) * (dNameLength + 1)); - if(dllName != NULL) - { - envret = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, - dllName, dNameLength); - if (envret) - { - /* Try to load the dll from the PATH... */ - m_libHandle = LoadLibraryA(dllName); - } - free(dllName); - } - } - } -#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - dllName = getenv(NEW_DLL_ENVIRONMENT_VAR); - if (!dllName) - dllName = getenv(DLL_ENVIRONMENT_VAR); -#if defined(__ANDROID__) || defined(ANDROID) - if (!dllName) - dllName = ANDROID_JIT_AGENT_PATH; -#endif - if (dllName) - { - /* Try to load the dll from the PATH... */ - m_libHandle = dlopen(dllName, RTLD_LAZY); - } -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - - if (!m_libHandle) - { -#if ITT_PLATFORM==ITT_PLATFORM_WIN - m_libHandle = LoadLibraryA(DEFAULT_DLLNAME); -#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY); -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - } - - /* if the dll wasn't loaded - exit. */ - if (!m_libHandle) - { - iJIT_DLL_is_missing = 1; /* don't try to initialize - * JIT agent the second time - */ - return 0; - } - -#if ITT_PLATFORM==ITT_PLATFORM_WIN - FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent"); -#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - FUNC_NotifyEvent = (TPNotify)dlsym(m_libHandle, "NotifyEvent"); -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - if (!FUNC_NotifyEvent) - { - FUNC_Initialize = NULL; - return 0; - } - -#if ITT_PLATFORM==ITT_PLATFORM_WIN - FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize"); -#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - FUNC_Initialize = (TPInitialize)dlsym(m_libHandle, "Initialize"); -#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ - if (!FUNC_Initialize) - { - FUNC_NotifyEvent = NULL; - return 0; - } - - executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize(); - - bDllWasLoaded = 1; - iJIT_DLL_is_missing = 0; /* DLL is ok. */ - - return 1; -} - -ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID() -{ - static unsigned int methodID = 1; - - if (methodID == 0) - return 0; /* ERROR : this is not a valid value */ - - return methodID++; -} diff --git a/linux/installer/common/sdk/BOMs/sdk_base.txt b/linux/installer/common/sdk/BOMs/sdk_base.txt index 068339596..3c178f318 100644 --- a/linux/installer/common/sdk/BOMs/sdk_base.txt +++ b/linux/installer/common/sdk/BOMs/sdk_base.txt @@ -41,6 +41,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /common/inc/sgx_secure_align.h /package/include/./sgx_secure_align.h 0 main STP /common/inc/sgx_secure_align_api.h /package/include/./sgx_secure_align_api.h 0 main STP /common/inc/sgx_rsrv_mem_mngr.h /package/include/sgx_rsrv_mem_mngr.h 0 main STP +/common/inc/sgx_trts_aex.h /package/include/sgx_trts_aex.h 0 main STP /common/inc/stdc++/exception /package/include/stdc++/exception 0 main STP /common/inc/stdc++/linux/exception /package/include/stdc++/linux/exception 0 main STP /common/inc/stdc++/linux/typeinfo /package/include/stdc++/linux/typeinfo 0 main STP @@ -396,6 +397,26 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /SampleCode/ProtobufSGXDemo/Enclave/Enclave.lds /package/SampleCode/ProtobufSGXDemo/Enclave/Enclave.lds 0 N/A N/A /SampleCode/ProtobufSGXDemo/Enclave/person.proto /package/SampleCode/ProtobufSGXDemo/Enclave/person.proto 0 N/A N/A /SampleCode/ProtobufSGXDemo/Makefile /package/SampleCode/ProtobufSGXDemo/Makefile 0 N/A N/A +/SampleCode/SampleMbedCrypto/App/App.cpp /package/SampleCode/SampleMbedCrypto/App/App.cpp 0 N/A N/A +/SampleCode/SampleMbedCrypto/App/App.h /package/SampleCode/SampleMbedCrypto/App/App.h 0 N/A N/A +/SampleCode/SampleMbedCrypto/Makefile /package/SampleCode/SampleMbedCrypto/Makefile 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp /package/SampleCode/SampleMbedCrypto/Enclave/Enclave.cpp 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave.lds /package/SampleCode/SampleMbedCrypto/Enclave/Enclave.lds 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds /package/SampleCode/SampleMbedCrypto/Enclave/Enclave_debug.lds 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave.h /package/SampleCode/SampleMbedCrypto/Enclave/Enclave.h 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave.edl /package/SampleCode/SampleMbedCrypto/Enclave/Enclave.edl 0 N/A N/A +/SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml /package/SampleCode/SampleMbedCrypto/Enclave/Enclave.config.xml 0 N/A N/A +/SampleCode/SampleMbedCrypto/README.txt /package/SampleCode/SampleMbedCrypto/README.txt 0 N/A N/A +/SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml /package/SampleCode/SampleAEXNotify/Enclave/Enclave.config.xml 0 N/A N/A +/SampleCode/SampleAEXNotify/Enclave/Enclave.cpp /package/SampleCode/SampleAEXNotify/Enclave/Enclave.cpp 0 N/A N/A +/SampleCode/SampleAEXNotify/Enclave/Enclave.edl /package/SampleCode/SampleAEXNotify/Enclave/Enclave.edl 0 N/A N/A +/SampleCode/SampleAEXNotify/Enclave/Enclave.h /package/SampleCode/SampleAEXNotify/Enclave/Enclave.h 0 N/A N/A +/SampleCode/SampleAEXNotify/Enclave/Enclave.lds /package/SampleCode/SampleAEXNotify/Enclave/Enclave.lds 0 N/A N/A +/SampleCode/SampleAEXNotify/Include/powers_of_two.h /package/SampleCode/SampleAEXNotify/Include/powers_of_two.h 0 N/A N/A +/SampleCode/SampleAEXNotify/App/App.h /package/SampleCode/SampleAEXNotify/App/App.h 0 N/A N/A +/SampleCode/SampleAEXNotify/App/App.cpp /package/SampleCode/SampleAEXNotify/App/App.cpp 0 N/A N/A +/SampleCode/SampleAEXNotify/Makefile /package/SampleCode/SampleAEXNotify/Makefile 0 N/A N/A +/SampleCode/SampleAEXNotify/README.txt /package/SampleCode/SampleAEXNotify/README.txt 0 N/A N/A /build/linux/gdb-sgx-plugin/sgx-gdb /package/bin/sgx-gdb 0 main STP /sdk/sample_libcrypto/sample_libcrypto.h /package/SampleCode/RemoteAttestation/sample_libcrypto/sample_libcrypto.h 0 main STP /sdk/tlibcxx/include/CMakeLists.txt /package/include/libcxx/CMakeLists.txt 0 main STP @@ -666,4 +687,28 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /external/protobuf/protobuf_code/src/google/protobuf/struct.proto /package/include/tprotobuf/google/protobuf/struct.proto 0 main STP /external/protobuf/protobuf_code/src/google/protobuf/type.proto /package/include/tprotobuf/google/protobuf/type.proto 0 main STP /external/protobuf/protobuf_code/src/google/protobuf/wrappers.proto /package/include/tprotobuf/google/protobuf/wrappers.proto 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/aes.h /package/include/mbedtls/aes.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/bignum.h /package/include/mbedtls/bignum.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/build_info.h /package/include/mbedtls/build_info.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/check_config.h /package/include/mbedtls/check_config.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/cipher.h /package/include/mbedtls/cipher.h 0 main STP + +/external/mbedtls/mbedtls_code/include/mbedtls/config_psa.h /package/include/mbedtls/config_psa.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/ctr_drbg.h /package/include/mbedtls/ctr_drbg.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/ecdsa.h /package/include/mbedtls/ecdsa.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/ecp.h /package/include/mbedtls/ecp.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/entropy.h /package/include/mbedtls/entropy.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/mbedtls_config.h /package/include/mbedtls/mbedtls_config.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/md.h /package/include/mbedtls/md.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/platform_util.h /package/include/mbedtls/platform_util.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/private_access.h /package/include/mbedtls/private_access.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/sha1.h /package/include/mbedtls/sha1.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/sha256.h /package/include/mbedtls/sha256.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/sha512.h /package/include/mbedtls/sha512.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/threading.h /package/include/mbedtls/threading.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/platform.h /package/include/mbedtls/platform.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/ecdh.h /package/include/mbedtls/ecdh.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/cmac.h /package/include/mbedtls/cmac.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/rsa.h /package/include/mbedtls/rsa.h 0 main STP +/external/mbedtls/mbedtls_code/include/mbedtls/gcm.h /package/include/mbedtls/gcm.h 0 main STP /common/buildenv.mk /package/buildenv.mk 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_cf.txt b/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_cf.txt index 79f772b50..d494deba9 100644 --- a/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_cf.txt +++ b/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_cf.txt @@ -15,4 +15,5 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linuxCF/libsgx_ttls.a /package/lib64/cve_2020_0551_cf/libsgx_ttls.a 0 main STP /build/linuxCF/libtdx_tls.a /package/lib64/cve_2020_0551_cf/libtdx_tls.a 0 main STP /build/linuxCF/libsgx_utls.a /package/lib64/cve_2020_0551_cf/libsgx_utls.a 0 main STP +/build/linuxCF/libsgx_mbedcrypto.a /package/lib64/cve_2020_0551_cf/libsgx_mbedcrypto.a 0 main STP /external/dcap_source/QuoteGeneration/build/linuxCF/libsgx_dcap_tvl.a /package/lib64/cve_2020_0551_cf/libsgx_dcap_tvl.a 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_load.txt b/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_load.txt index 978202bf4..53c9cfc61 100644 --- a/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_load.txt +++ b/linux/installer/common/sdk/BOMs/sdk_cve_2020_0551_load.txt @@ -15,4 +15,5 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linuxLOAD/libsgx_ttls.a /package/lib64/cve_2020_0551_load/libsgx_ttls.a 0 main STP /build/linuxLOAD/libtdx_tls.a /package/lib64/cve_2020_0551_load/libtdx_tls.a 0 main STP /build/linuxLOAD/libsgx_utls.a /package/lib64/cve_2020_0551_load/libsgx_utls.a 0 main STP +/build/linuxLOAD/libsgx_mbedcrypto.a /package/lib64/cve_2020_0551_load/libsgx_mbedcrypto.a 0 main STP /external/dcap_source/QuoteGeneration/build/linuxLOAD/libsgx_dcap_tvl.a /package/lib64/cve_2020_0551_load/libsgx_dcap_tvl.a 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_x64.txt b/linux/installer/common/sdk/BOMs/sdk_x64.txt index a59ae24b8..629492c18 100644 --- a/linux/installer/common/sdk/BOMs/sdk_x64.txt +++ b/linux/installer/common/sdk/BOMs/sdk_x64.txt @@ -46,6 +46,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linux/libsgx_ttls.a /package/lib64/libsgx_ttls.a 0 main STP /build/linux/libtdx_tls.a /package/lib64/libtdx_tls.a 0 main STP /build/linux/libsgx_utls.a /package/lib64/libsgx_utls.a 0 main STP +/build/linux/libsgx_mbedcrypto.a /package/lib64/libsgx_mbedcrypto.a 0 main STP /external/dcap_source/QuoteGeneration/build/linux/libsgx_dcap_tvl.a /package/lib64/libsgx_dcap_tvl.a 0 main STP /linux/installer/common/sdk/installConfig.x64 /scripts/installConfig 0 main STP /linux/installer/common/sdk/pkgconfig/x64/libsgx_uae_service_sim.pc /package/pkgconfig/libsgx_uae_service_sim.pc 0 main STP diff --git a/linux/installer/common/sgx-aesm-service/Makefile b/linux/installer/common/sgx-aesm-service/Makefile index 384ec9f55..6edfb31c4 100644 --- a/linux/installer/common/sgx-aesm-service/Makefile +++ b/linux/installer/common/sgx-aesm-service/Makefile @@ -42,7 +42,7 @@ AESMD_CONF_DEL=$(if $(wildcard /run/systemd/system/.*),aesmd.conf,$(if $(wildcar AESMD_CONF_PATH=$(if $(wildcard /run/systemd/system/.*),$(if $(wildcard /lib/systemd/system/.*),/lib/systemd/system,/usr/lib/systemd/system),$(if $(wildcard /etc/init/.*),/etc/init/)) ifeq ($(AESMD_CONF_NAME),) -ifneq ($(shell awk -F/ '$$2 == "docker"' /proc/self/cgroup),) +ifeq ($(BUILD_PLATFORM),docker) AESMD_CONF_NAME=aesmd.service AESMD_CONF_DEL=aesmd.conf AESMD_CONF_PATH=/lib/systemd/system diff --git a/linux/installer/deb/local_repo_tool/conf/distributions b/linux/installer/deb/local_repo_tool/conf/distributions index ace56a940..df10f428a 100644 --- a/linux/installer/deb/local_repo_tool/conf/distributions +++ b/linux/installer/deb/local_repo_tool/conf/distributions @@ -38,6 +38,14 @@ Components: main Description: ubuntu/jammy repository for SGX PSW DebIndices: Packages . +Origin: Intel Corporation +Label: Intel Corporation +Codename: lunar +Architectures: amd64 +Components: main +Description: ubuntu/lunar repository for SGX PSW +DebIndices: Packages . + Origin: Intel Corporation Label: Intel Corporation Codename: buster @@ -45,3 +53,11 @@ Architectures: amd64 Components: main Description: debian/buster repository for SGX PSW DebIndices: Packages . + +Origin: Intel Corporation +Label: Intel Corporation +Codename: bullseye +Architectures: amd64 +Components: main +Description: debian/bullseye repository for SGX PSW +DebIndices: Packages . diff --git a/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control b/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control index 3d4d83136..b50c23347 100644 --- a/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control +++ b/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control @@ -37,12 +37,12 @@ Description: Unified Quote Plugin for Intel(R) Software Guard Extensions AESM Se Package: libsgx-aesm-ecdsa-plugin Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-qe3-logic(>= 1.16), libsgx-aesm-pce-plugin(>= @dep_version@) +Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-qe3-logic(>= 1.17), libsgx-aesm-pce-plugin(>= @dep_version@) Description: ECDSA Quote Plugin for Intel(R) Software Guard Extensions AESM Service Package: libsgx-aesm-pce-plugin Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-pce-logic(>= 1.16), libsgx-ae-pce(>= @dep_version@) +Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-pce-logic(>= 1.17), libsgx-ae-pce(>= @dep_version@) Description: PCE Plugin for Intel(R) Software Guard Extensions AESM Service Package: libsgx-ae-pce diff --git a/linux/installer/rpm/psw-dcap/sanitize.sh b/linux/installer/rpm/psw-dcap/sanitize.sh index 7ab53df3f..5c4b9d5ad 100755 --- a/linux/installer/rpm/psw-dcap/sanitize.sh +++ b/linux/installer/rpm/psw-dcap/sanitize.sh @@ -47,7 +47,11 @@ make -C ${root_dir} preparation # Prepare ipp-crypto source pushd ${root_dir}/external/ippcp_internal/ -cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +# cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +# TODO - Need to remove below lines and enable the above content when opensource +rm -rf ipp-crypto +git clone -b ippcp_2021.7 https://github.com/intel/ipp-crypto.git --depth 1 ipp-crypto +cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch popd diff --git a/linux/installer/rpm/psw-tdx/sanitize.sh b/linux/installer/rpm/psw-tdx/sanitize.sh index 83aeec190..ae47225f6 100755 --- a/linux/installer/rpm/psw-tdx/sanitize.sh +++ b/linux/installer/rpm/psw-tdx/sanitize.sh @@ -47,7 +47,11 @@ make -C ${root_dir} preparation # Prepare ipp-crypto source pushd ${root_dir}/external/ippcp_internal/ -cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +# cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +# TODO - Need to remove below lines and enable the above content when opensource +rm -rf ipp-crypto +git clone -b ippcp_2021.7 https://github.com/intel/ipp-crypto.git --depth 1 ipp-crypto +cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch popd diff --git a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec index 202f73e8d..76919833b 100644 --- a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec +++ b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec @@ -38,7 +38,7 @@ Version: @version@ Release: 1%{?dist} Summary: ECDSA Quote Plugin for Intel(R) Software Guard Extensions AESM Service Group: Development/System -Requires: sgx-aesm-service >= %{version}-%{release} libsgx-qe3-logic >= 1.16 libsgx-aesm-pce-plugin >= %{version}-%{release} +Requires: sgx-aesm-service >= %{version}-%{release} libsgx-qe3-logic >= 1.17 libsgx-aesm-pce-plugin >= %{version}-%{release} License: BSD License URL: https://github.com/intel/linux-sgx diff --git a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec index 22490064a..87e832fa1 100644 --- a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec +++ b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec @@ -38,7 +38,7 @@ Version: @version@ Release: 1%{?dist} Summary: PCE Plugin for Intel(R) Software Guard Extensions AESM Service Group: Development/System -Requires: sgx-aesm-service >= %{version}-%{release} libsgx-pce-logic >= 1.16 +Requires: sgx-aesm-service >= %{version}-%{release} libsgx-pce-logic >= 1.17 License: BSD License URL: https://github.com/intel/linux-sgx diff --git a/linux/reproducibility/Dockerfile b/linux/reproducibility/Dockerfile index 99c554dfa..c7ae0f6d9 100644 --- a/linux/reproducibility/Dockerfile +++ b/linux/reproducibility/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:20.04 RUN apt-get update \ - && apt-get install -y curl python perl git \ + && apt-get install -y curl python-is-python3 perl git \ && mkdir -p /nix /etc/nix \ && chmod a+rwx /nix \ && echo 'sandbox = false' > /etc/nix/nix.conf \ diff --git a/linux/reproducibility/build_and_launch_docker.sh b/linux/reproducibility/build_and_launch_docker.sh old mode 100755 new mode 100644 index 816ab0fef..b3986e028 --- a/linux/reproducibility/build_and_launch_docker.sh +++ b/linux/reproducibility/build_and_launch_docker.sh @@ -75,8 +75,8 @@ mount_dir="/linux-sgx" sdk_installer="" sgx_src="" -default_sdk_installer=sgx_linux_x64_sdk_reproducible_2.19.100.1.bin -default_sdk_installer_url=https://download.01.org/intel-sgx/sgx-linux/2.19/distro/nix_reproducibility/$default_sdk_installer +default_sdk_installer=sgx_linux_x64_sdk_reproducible_2.20.100.1.bin +default_sdk_installer_url=https://download.01.org/intel-sgx/sgx-linux/2.20/distro/nix_reproducibility/$default_sdk_installer usage() @@ -177,7 +177,7 @@ prepare_sgx_src() if [ "$sgx_src" != "" ]; then mkdir -p "$sgx_repo" && cp -a "$sgx_src/." "$sgx_repo" else - git clone -b sgx_2.19_reproducible https://github.com/intel/linux-sgx.git $sgx_repo + git clone -b sgx_2.20_reproducible https://github.com/intel/linux-sgx.git $sgx_repo fi cd "$sgx_repo" && make preparation diff --git a/psw/ae/Makefile b/psw/ae/Makefile index bf1bffffb..a810d6b92 100644 --- a/psw/ae/Makefile +++ b/psw/ae/Makefile @@ -87,10 +87,10 @@ cmake_check_fail: @echo or @echo yum install cmake @echo with root account - @exit 2 + @exit 3 .PHONY: prebuilt_check_fail prebuilt_check_fail: @echo "ERROR: Please run 'download_prebuilt.sh' to download the prebuilt AEs before compiling." @echo "Exiting......" - @exit -2 + @exit 3 diff --git a/psw/ae/aesm_service/source/qcnl/CMakeLists.txt b/psw/ae/aesm_service/source/qcnl/CMakeLists.txt index f4c59a2af..c8e9509f8 100644 --- a/psw/ae/aesm_service/source/qcnl/CMakeLists.txt +++ b/psw/ae/aesm_service/source/qcnl/CMakeLists.txt @@ -41,6 +41,7 @@ add_library(sgx_default_qcnl_wrapper SHARED ${_srcs}) link_directories( ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/prebuilt/openssl/lib/linux64 + ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/static_out ) target_include_directories(sgx_default_qcnl_wrapper PRIVATE @@ -51,14 +52,24 @@ target_include_directories(sgx_default_qcnl_wrapper PRIVATE ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/common/inc/internal ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/QuoteVerification/QVL/Src/ThirdParty/rapidjson/include/rapidjson ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/prebuilt/openssl/inc + ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/include ) +add_custom_target(PCKCertSelectionLib + COMMAND make -f ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/PCKCertSelectionLib/Makefile.static_lib + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/PCKCertSelectionLib +) + +add_library(PCKCertSelectionStaticLib STATIC IMPORTED ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/static_out/libPCKCertSelection.a) +set_target_properties(PCKCertSelectionStaticLib PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/tools/PCKCertSelection/static_out/libPCKCertSelection.a) +add_dependencies(PCKCertSelectionStaticLib PCKCertSelectionLib) + set_property(TARGET sgx_default_qcnl_wrapper APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-z,defs") set_property(TARGET sgx_default_qcnl_wrapper APPEND_STRING PROPERTY LINK_DEPENDS ${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/qcnl/linux/sgx_default_qcnl.lds ) target_link_libraries(sgx_default_qcnl_wrapper - ${CURL_LIBRARIES} crypto + ${CURL_LIBRARIES} crypto PCKCertSelectionStaticLib ) diff --git a/psw/ae/ref_le/ref_le.md b/psw/ae/ref_le/ref_le.md index 73e317cf6..125444f6d 100644 --- a/psw/ae/ref_le/ref_le.md +++ b/psw/ae/ref_le/ref_le.md @@ -1,5 +1,7 @@ # Intel(R) SGX Reference Launch Enclave +**NOTE**: The reference LE is only workable with [linux-sgx-driver](https://github.com/intel/linux-sgx-driver) and is planned to be deprecated starting from Intel(R) SGX release 2.20. + ## Introduction A Launch Enclave (LE) is a special type of enclave, generates a Launch Token for other enclave to be initialized. The generated Launch Token is used by the Platform Software as part of the data passed to the driver on EINIT flow. The Launch Enclave role is divided to two parts: diff --git a/psw/ae/ref_le/ref_wl_gen/ref_wl.cpp b/psw/ae/ref_le/ref_wl_gen/ref_wl.cpp index bd08e848f..26896e4d5 100644 --- a/psw/ae/ref_le/ref_wl_gen/ref_wl.cpp +++ b/psw/ae/ref_le/ref_wl_gen/ref_wl.cpp @@ -29,10 +29,19 @@ * */ +#pragma weak ippcpInit #include "ref_wl_gen.h" +#include "ippcp.h" + + int main(int argc, char* argv[]) { + if (ippcpInit != NULL) + { + ippcpInit(); + } + CRefWLGen ref_le_gen; if (ref_le_gen.run(argc, argv) == false) return -1; diff --git a/psw/enclave_common/sgx_enclave_common.cpp b/psw/enclave_common/sgx_enclave_common.cpp index 9662a2779..fa351dd5b 100644 --- a/psw/enclave_common/sgx_enclave_common.cpp +++ b/psw/enclave_common/sgx_enclave_common.cpp @@ -77,6 +77,7 @@ static int s_driver_type = SGX_DRIVER_UNKNOWN; //driver which is opened static se_file_handle_t s_hdevice = -1; //used for driver_type of SGX_DRIVER_OUT_OF_TREE or SGX_DRIVER_DCAP static std::map s_hfile; //enclave file handles for driver_type of SGX_DRIVER_IN_KERNEL +static std::vector s_enclave_base_address; static std::map s_enclave_size; static std::map s_enclave_init; static std::map s_secs_attr; @@ -137,24 +138,17 @@ static void close_device(void) s_driver_type = SGX_DRIVER_UNKNOWN; //this may not be needed - can it change on the platform? } -static int get_file_handle_from_address(void* target_address) +static int get_file_handle_from_base_address(void* base_address) { int hfile = -1; //find the enclave file handle from the target address LockGuard lock(&s_enclave_mutex); - for (auto rec : s_enclave_size) { - if ((uint64_t)target_address >= (uint64_t)rec.first && (uint64_t)target_address < (uint64_t)rec.first + (uint64_t)rec.second) - { - if (s_hfile.count(rec.first) == 1) - { - hfile = s_hfile[rec.first]; - } - break; - } + if(s_hfile.count(base_address) != 0) + { + hfile = s_hfile[base_address]; } - - return hfile; + return hfile; } static void* get_enclave_base_address_from_address(void* target_address) @@ -163,15 +157,35 @@ static void* get_enclave_base_address_from_address(void* target_address) //find the enclave file handle from the target address LockGuard lock(&s_enclave_mutex); - for (auto rec : s_enclave_size) { - if ((uint64_t)target_address >= (uint64_t)rec.first && (uint64_t)target_address < (uint64_t)rec.first + (uint64_t)rec.second) - { - base_addr = rec.first; - break; - } + if(s_enclave_base_address.empty()) + { + return base_addr; } - - return base_addr; + auto upper = std::upper_bound(s_enclave_base_address.begin(), s_enclave_base_address.end(), (uint64_t)target_address); + if(upper == s_enclave_base_address.begin()) + { + return base_addr; + } + else if (upper == s_enclave_base_address.end()) + { + base_addr = (void*)s_enclave_base_address.back(); + } + else + { + auto index = upper - s_enclave_base_address.begin(); + base_addr = (void*)s_enclave_base_address[index - 1]; + } + if(s_enclave_size.count(base_addr) == 0) + { + return NULL; + } + //validate the target_address is within the enclave range + if((uint64_t)target_address < (uint64_t)base_addr || + ((uint64_t)target_address >= ((uint64_t)base_addr + s_enclave_size[base_addr]))) + { + return NULL; + } + return base_addr; } @@ -772,6 +786,8 @@ extern "C" void* COMM_API enclave_create_ex( s_hfile[enclave_base] = hdevice_temp; } s_enclave_size[enclave_base] = virtual_size; + s_enclave_base_address.push_back((uint64_t)enclave_base); + std::sort(s_enclave_base_address.begin(), s_enclave_base_address.end()); sgx_attributes_t secs_attr; memset(&secs_attr, 0, sizeof(sgx_attributes_t)); @@ -817,9 +833,8 @@ extern "C" void* COMM_API enclave_create( return enclave_create_ex(base_address, virtual_size, initial_commit, type, info, info_size, 0 , NULL, enclave_error); } -static bool enclave_do_mprotect_region(void* target_address, size_t target_size, int prot, uint32_t* enclave_error) +static bool enclave_do_mprotect_region(int hfile, void* target_address, size_t target_size, int prot, uint32_t* enclave_error) { - int hfile = -1; // find the enclave base void* enclave_base = get_enclave_base_address_from_address(target_address); if (enclave_base == NULL) { @@ -828,11 +843,6 @@ static bool enclave_do_mprotect_region(void* target_address, size_t target_size, return false; } - if (s_driver_type == SGX_DRIVER_IN_KERNEL) - { - hfile = get_file_handle_from_address(target_address); - } - auto enclave_mem_region = &s_enclave_mem_region[enclave_base]; //if target_size =0, means mprotect the last region if(target_size != 0) @@ -936,12 +946,8 @@ extern "C" size_t COMM_API enclave_load_data( size_t pages = target_size / SE_PAGE_SIZE; if (s_driver_type == SGX_DRIVER_IN_KERNEL) { - hfile = get_file_handle_from_address(target_address); - - //todo - may need to check EADD parameters for better error reporting since the driver - // may not do this (the driver will just take a fault on EADD) - - if (hfile == -1) + void* enclave_base_addr = get_enclave_base_address_from_address(target_address); + if (enclave_base_addr == NULL) { SE_TRACE(SE_TRACE_WARNING, "\nAdd Page FAILED - %p is not in a valid enclave \n", target_address); if (enclave_error != NULL) @@ -949,8 +955,11 @@ extern "C" size_t COMM_API enclave_load_data( return 0; } - void* enclave_base_addr = get_enclave_base_address_from_address(target_address); - if (enclave_base_addr == NULL) + hfile = get_file_handle_from_base_address(enclave_base_addr); + + //todo - may need to check EADD parameters for better error reporting since the driver + // may not do this (the driver will just take a fault on EADD) + if (hfile == -1) { SE_TRACE(SE_TRACE_WARNING, "\nAdd Page FAILED - %p is not in a valid enclave \n", target_address); if (enclave_error != NULL) @@ -1060,7 +1069,7 @@ extern "C" size_t COMM_API enclave_load_data( prot = (int)(SI_FLAGS_RW & SI_MASK_MEM_ATTRIBUTE); } - if(enclave_do_mprotect_region(target_address, target_size, prot, enclave_error) == false) + if(enclave_do_mprotect_region(hfile, target_address, target_size, prot, enclave_error) == false) { return 0; } @@ -1097,7 +1106,7 @@ extern "C" bool COMM_API enclave_initialize( int hfile = -1; if (s_driver_type == SGX_DRIVER_IN_KERNEL) { - hfile = get_file_handle_from_address(base_address); + hfile = get_file_handle_from_base_address(base_address); if (hfile == -1) { SE_TRACE(SE_TRACE_WARNING, "\nSGX_IOC_ENCLAVE_INIT failed - %p is not a valid enclave \n", base_address); @@ -1115,7 +1124,7 @@ extern "C" bool COMM_API enclave_initialize( } //mprotect the last region - if(enclave_do_mprotect_region(base_address, 0, 0, enclave_error) == false) + if(enclave_do_mprotect_region(hfile, base_address, 0, 0, enclave_error) == false) { return false; } @@ -1237,6 +1246,9 @@ extern "C" bool COMM_API enclave_delete( } enclave_size = it->second; + s_enclave_base_address.erase(std::remove(s_enclave_base_address.begin(), s_enclave_base_address.end(), (uint64_t)base_address), + s_enclave_base_address.end()); + s_enclave_size.erase(base_address); s_enclave_init.erase(base_address); s_enclave_mem_region.erase(base_address); @@ -1388,7 +1400,15 @@ uint32_t COMM_API enclave_alloc( } return ENCLAVE_ERROR_SUCCESS; } - int enclave_fd = get_file_handle_from_address(target_addr); + + void* enclave_base = get_enclave_base_address_from_address(target_addr); + if (enclave_base == NULL) + { + if (enclave_error != NULL) + *enclave_error = ENCLAVE_INVALID_ADDRESS; + return ENCLAVE_INVALID_ADDRESS; + } + int enclave_fd = get_file_handle_from_base_address(enclave_base); if (enclave_fd == -1) { if (enclave_error != NULL) @@ -1458,11 +1478,11 @@ static int emodt(int fd, void *addr, size_t length, uint64_t type) return err; } //for recoverable partial errors - length -= ioc.count; + ioc.length -= ioc.count; ioc.offset += ioc.count; ioc.result = 0; ioc.count = 0; - } while (length != 0); + } while (ioc.length != 0); return 0; } @@ -1641,8 +1661,8 @@ uint32_t COMM_API enclave_modify( function _trim = trim; function _trim_accept = trim_accept; function _mktcs = mktcs; - function _emodpr = emodpr; - int fd = get_file_handle_from_address(target_addr); + function _emodpr = emodpr; + int fd = get_file_handle_from_base_address((void*)enclave_base); if (s_driver_type == SGX_DRIVER_OUT_OF_TREE) { _trim = trim_legacy; diff --git a/psw/urts/create_param.h b/psw/urts/create_param.h index 235427e66..5e20b5db7 100644 --- a/psw/urts/create_param.h +++ b/psw/urts/create_param.h @@ -51,7 +51,7 @@ typedef struct _create_param_t uint64_t rsrv_init_size; uint64_t rsrv_offset; uint64_t rsrv_executable; - uint64_t user_region_offset; + uint64_t edmm_bk_overhead; uint64_t user_region_size; uint64_t first_ssa_gpr; uint64_t td_addr; diff --git a/psw/urts/enclave.cpp b/psw/urts/enclave.cpp index d753b03ab..820e5ffc8 100644 --- a/psw/urts/enclave.cpp +++ b/psw/urts/enclave.cpp @@ -66,6 +66,7 @@ CEnclave::CEnclave() , m_sealed_key(NULL) , m_switchless(NULL) , m_first_ecall(true) + , m_aex_notify(false) , m_dynamic_tcs_list_size(0) { memset(&m_enclave_info, 0, sizeof(debug_enclave_info_t)); @@ -273,6 +274,18 @@ void CEnclave::set_sealed_key(uint8_t *sealed_key) m_sealed_key = sealed_key; } +bool CEnclave::set_aex_notify(bool flag) +{ + m_aex_notify = flag; + return true; +} + +bool CEnclave::get_aex_notify() +{ + return m_aex_notify; +} + + sgx_status_t CEnclave::error_trts2urts(unsigned int trts_error) { if(trts_error == (unsigned int)SE_ERROR_READ_LOCK_FAIL) diff --git a/psw/urts/enclave.h b/psw/urts/enclave.h index 51578e04e..312886615 100644 --- a/psw/urts/enclave.h +++ b/psw/urts/enclave.h @@ -88,6 +88,9 @@ class CEnclave: private Uncopyable void *get_global_data_sim_ptr(); #endif CTrustThread * get_free_tcs(); + bool set_aex_notify(bool flag); + bool get_aex_notify(); + private: CTrustThread * get_tcs(int ecall_cmd); @@ -117,6 +120,7 @@ class CEnclave: private Uncopyable uint8_t *m_sealed_key; void* m_switchless; bool m_first_ecall; + bool m_aex_notify; sgx_target_info_t m_target_info; size_t m_dynamic_tcs_list_size; #ifdef SE_SIM diff --git a/psw/urts/enclave_creator_hw_com.cpp b/psw/urts/enclave_creator_hw_com.cpp index d5c9353f1..d556b0eb6 100644 --- a/psw/urts/enclave_creator_hw_com.cpp +++ b/psw/urts/enclave_creator_hw_com.cpp @@ -41,6 +41,7 @@ #include "se_memcpy.h" #include "se_detect.h" #include +#include "se_detect.h" #define EDMM_ENABLE_BIT 0x1ULL #define ARCH_REQ_XCOMP_PERM 0x1023 @@ -72,8 +73,9 @@ int EnclaveCreatorHW::initialize(sgx_enclave_id_t enclave_id) info.sealed_key = enclave->get_sealed_key(); info.cpu_core_num = (uint32_t)sysconf(_SC_NPROCESSORS_ONLN); if (is_EDMM_supported(enclave_id)) - info.system_feature_set[0] |= EDMM_ENABLE_BIT; - + info.system_feature_set[0] |= EDMM_ENABLE_BIT; + if (enclave->get_aex_notify() == true) + info.system_feature_set[0] |= (1ULL << AEXNOTIFY_BIT); int status = enclave->ecall(ECMD_INIT_ENCLAVE, NULL, reinterpret_cast(&info)); //free the tcs used by initialization; @@ -163,6 +165,13 @@ int EnclaveCreatorHW::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadat return SGX_ERROR_UNEXPECTED; } } + //if the enclave requires aex notify support, need to check the platform supports edeccssa or not + if(((secs_attr->flags & SGX_FLAGS_AEX_NOTIFY) != false) && (is_edeccssa_supported() == false)) + { + SE_TRACE(SE_TRACE_WARNING, "the enclave requires AEX Notify support, but the platform doesn't support EDECCSSA.\n"); + return SGX_ERROR_UNEXPECTED; + } + // try to use maximum ablity of cpu sgx_misc_attr->misc_select = se_cap.misc_select & enclave_css->body.misc_select; diff --git a/psw/urts/linux/enter_enclave.S b/psw/urts/linux/enter_enclave.S index fc3828e11..4f09e2da2 100644 --- a/psw/urts/linux/enter_enclave.S +++ b/psw/urts/linux/enter_enclave.S @@ -160,6 +160,7 @@ EENTER_PROLOG .Lasync_exit_pointer: ENCLU + ud2 _CET_ENDBR .size __morestack, .-__morestack diff --git a/psw/urts/linux/sig_handler.cpp b/psw/urts/linux/sig_handler.cpp index 00cfd6016..509802d5d 100644 --- a/psw/urts/linux/sig_handler.cpp +++ b/psw/urts/linux/sig_handler.cpp @@ -61,6 +61,7 @@ typedef struct _ecall_param_t #define REG_XAX REG_RAX #define REG_XBX REG_RBX #define REG_XSI REG_RSI +#define REG_XDI REG_RDI #define REG_XBP REG_RBP /* * refer to enter_enclave.h @@ -75,6 +76,7 @@ typedef struct _ecall_param_t #define REG_XAX REG_EAX #define REG_XBX REG_EBX #define REG_XSI REG_ESI +#define REG_XDI REG_EDI #define REG_XBP REG_EBP /* * refer to enter_enclave.h @@ -129,25 +131,37 @@ void sig_handler(int signum, siginfo_t* siginfo, void *priv) //If exception is raised in trts again and again, the SSA will overflow, and finally it is EENTER exception. assert(reinterpret_cast(xbx) == param->tcs); CEnclave *enclave = param->trust_thread->get_enclave(); - unsigned int ret = enclave->ecall(ECMD_EXCEPT, param->ocall_table, NULL); - if(SGX_SUCCESS == ret) + if(enclave->get_aex_notify() != true) { - //ERESUME execute - return; + unsigned int ret = enclave->ecall(ECMD_EXCEPT, param->ocall_table, NULL); + if(SGX_SUCCESS == ret) + { + //ERESUME execute + return; + } + //If the exception is caused by enclave lost or internal stack overrun, then return the error code to ecall caller elegantly. + else if(SGX_ERROR_ENCLAVE_LOST == ret || SGX_ERROR_STACK_OVERRUN == ret) + { + //enter_enlcave function will return with ret which is from tRTS; + context->uc_mcontext.gregs[REG_XIP] = reinterpret_cast(get_eretp()); + context->uc_mcontext.gregs[REG_XSI] = ret; + return; + } + //If we can't fix the exception within enclave, then give the handle to other signal hanlder. + //Call the previous signal handler. The default signal handler should terminate the application. + + enclave->rdunlock(); + CEnclavePool::instance()->unref_enclave(enclave); } - //If the exception is caused by enclave lost or internal stack overrun, then return the error code to ecall caller elegantly. - else if(SGX_ERROR_ENCLAVE_LOST == ret || SGX_ERROR_STACK_OVERRUN == ret) + else { - //enter_enlcave function will return with ret which is from tRTS; - context->uc_mcontext.gregs[REG_XIP] = reinterpret_cast(get_eretp()); - context->uc_mcontext.gregs[REG_XSI] = ret; + context->uc_mcontext.gregs[REG_XAX] = SE_EENTER; + context->uc_mcontext.gregs[REG_XDI] = ECMD_EXCEPT; + // This XSI parameter is not actually used by the exception handler in trts. + //But it is just left here for completeness. + context->uc_mcontext.gregs[REG_XSI] = (size_t)(param->ocall_table); return; } - //If we can't fix the exception within enclave, then give the handle to other signal hanlder. - //Call the previous signal handler. The default signal handler should terminate the application. - - enclave->rdunlock(); - CEnclavePool::instance()->unref_enclave(enclave); } //the case of exception on EENTER instruction. else if(xip == get_eenterp() @@ -304,26 +318,41 @@ static int sgx_urts_vdso_handler(long rdi, long rsi, long rdx, long ursp, long r //need to handle exception here __u64 *user_data = (__u64*)run->user_data; CTrustThread* trust_thread = reinterpret_cast(user_data[1]); + void *ocall_table = reinterpret_cast(user_data[0]); if(trust_thread == NULL) { run->user_data = SGX_ERROR_UNEXPECTED; return 0; } - void *ocall_table = reinterpret_cast(user_data[0]); - //directly use the original tcs - unsigned int ret = do_ecall(ECMD_EXCEPT, ocall_table, NULL, trust_thread); - - if(SGX_SUCCESS == ret) + CEnclave *enclave = trust_thread->get_enclave(); + if(enclave == NULL) { - return SE_ERESUME; + run->user_data = SGX_ERROR_UNEXPECTED; + return 0; + } + if(enclave->get_aex_notify() != true) + { + //directly use the original tcs + unsigned int ret = do_ecall(ECMD_EXCEPT, ocall_table, NULL, trust_thread); + + if(SGX_SUCCESS == ret) + { + return SE_ERESUME; + } + else + { + //for vDSO handler, we have to return error code to trts + //instead of calling old signal handler if registered + run->user_data = (__u64)ret; + return 0; + } } else { - //for vDSO handler, we have to return error code to trts - //instead of calling old signal handler if registered - run->user_data = (__u64)ret; - return 0; + //if vDSO is enabled, return SE_EENTER directly + SE_TRACE(SE_TRACE_DEBUG, "AEX-NOTIFY called, exception_addr=0x%x, exception_error_code=0x%x, exception_vector=0x%x\n", run->exception_addr, run->exception_error_code, run->exception_vector); + return SE_EENTER; } } else if(run->function == SE_EEXIT) diff --git a/psw/urts/parser/update_global_data.hxx b/psw/urts/parser/update_global_data.hxx index 2889587d6..57457a1c8 100644 --- a/psw/urts/parser/update_global_data.hxx +++ b/psw/urts/parser/update_global_data.hxx @@ -97,6 +97,7 @@ namespace { thread_data->last_sp = thread_data->stack_base_addr; thread_data->xsave_size = create_param->xsave_size; thread_data->first_ssa_gpr = (sys_word_t)create_param->ssa_base_addr + metadata->ssa_frame_size * SE_PAGE_SIZE - (uint32_t)sizeof(ssa_gpr_t); + thread_data->first_ssa_xsave = (sys_word_t)create_param->ssa_base_addr; thread_data->flags = 0; // TD address relative to TCS thread_data->tls_addr = (sys_word_t)create_param->tls_addr; @@ -173,6 +174,7 @@ namespace { global_data->elrange_start_address= 0; global_data->elrange_size = global_data->enclave_size; } + global_data->edmm_bk_overhead = (sys_word_t)create_param->edmm_bk_overhead; return true; } } diff --git a/psw/urts/se_detect.cpp b/psw/urts/se_detect.cpp index 9def8d41d..4cc818ded 100644 --- a/psw/urts/se_detect.cpp +++ b/psw/urts/se_detect.cpp @@ -48,6 +48,22 @@ bool is_se_supported() return true; } +bool is_edeccssa_supported() +{ + if(false == is_se_supported()) + { + return false; + } + + int cpu_info[4] = {0, 0, 0, 0}; + __cpuidex(cpu_info, SE_LEAF, 0); + if (!(cpu_info[0] & (1<(enclave->get_debug_info()); enclave->set_extra_debug_info(const_cast(loader.get_secs()), loader); + //if enclave enables aex notify + if(loader.get_secs().attributes.flags & SGX_FLAGS_AEX_NOTIFY) + { + enclave->set_aex_notify(true); + } //add enclave to enclave pool before init_enclave because in simualtion //mode init_enclave will rely on CEnclavePool to get Enclave instance. @@ -557,6 +562,12 @@ sgx_status_t _create_enclave_from_buffer_ex(const bool debug, uint8_t *base_addr goto clean_return; } } + //AEX Notify doesn't support simulation mode + if((sgx_misc_attr.secs_attr.flags & SGX_FLAGS_AEX_NOTIFY) && (get_enclave_creator()->use_se_hw() == false)) + { + ret = SGX_ERROR_FEATURE_NOT_SUPPORTED; + goto clean_return; + } lc = new SGXLaunchToken(&metadata->enclave_css, &sgx_misc_attr.secs_attr, NULL); #ifndef SE_SIM diff --git a/sdk/Makefile b/sdk/Makefile index 4c95dd3d7..2f8e8c851 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -43,7 +43,7 @@ endif opt_check_failed: @echo "ERROR: Please run 'download_prebuilt.sh' to download the prebuilt optimized libraries before compiling." @echo "Exiting......" - @exit -2 + @exit 3 .PHONY: all all: $(CHECK_OPT) diff --git a/sdk/Makefile.source b/sdk/Makefile.source index 6ebb8fb33..b4636bfee 100644 --- a/sdk/Makefile.source +++ b/sdk/Makefile.source @@ -44,6 +44,7 @@ # - openmp: libsgx_omp.a # - protobuf: libsgx_protobuf.a # - ttls: libsgx_ttls.a +# - mbedtls: libsgx_mbedcrypto.a # - Untrtusted libraries # - ukey_exchange: libsgx_ukey_exchange.a # - uprotected_fs: libsgx_uprotected_fs.a @@ -66,7 +67,7 @@ LIBTCXX := $(BUILD_DIR)/libsgx_tcxx.a LIBTSE := $(BUILD_DIR)/libsgx_tservice.a .PHONY: components -components: tstdc tcxx tservice trts tcrypto tkey_exchange ukey_exchange tprotected_fs uprotected_fs ptrace sample_crypto libcapable simulation signtool edger8r tcmalloc sgx_pcl sgx_encrypt sgx_tswitchless sgx_uswitchless pthread openmp protobuf ttls utls +components: tstdc tcxx tservice trts tcrypto tkey_exchange ukey_exchange tprotected_fs uprotected_fs ptrace sample_crypto libcapable simulation signtool edger8r tcmalloc sgx_pcl sgx_encrypt sgx_tswitchless sgx_uswitchless pthread openmp protobuf ttls utls mbedtls # --------------------------------------------------- # tstdc @@ -216,6 +217,10 @@ endif ttls: edger8r $(MAKE) -C ttls +.PHONY: mbedtls +mbedtls: + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/mbedtls + # --------------------------------------------------- # Untrusted libraries # --------------------------------------------------- @@ -316,5 +321,6 @@ clean: $(MAKE) -C $(LINUX_EXTERNAL_DIR)/protobuf clean $(MAKE) -C ttls clean $(MAKE) -C utls clean + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/mbedtls clean @$(RM) $(LIBTLIBC) $(LIBTCXX) $(LIBTSE) @$(RM) $(BUILD_DIR)/libc++_Changes_SGX.txt diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py index 672edfdc7..82724e5f9 100644 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py @@ -151,13 +151,14 @@ def init_enclave_debug(self): if (self.enclave_type & ET_SIM) != ET_SIM and (self.enclave_type & ET_DEBUG) != ET_DEBUG: print ('Warning: {0:s} is a product hardware enclave. It can\'t be debugged and sgx_emmt doesn\'t work'.format(self.enclave_path)) return -1 - # set TCS debug flag + # set TCS debug flag, clear AEXNOTIFY for tcs_addr in self.tcs_addr_list: string = read_from_memory(tcs_addr + 8, 4) if string == None: return 0 flag = struct.unpack('I', string)[0] flag |= 1 + flag &= (~2) gdb_cmd = "set *(unsigned int *)%#x = %#x" %(tcs_addr + 8, flag) gdb.execute(gdb_cmd, False, True) #If it is a product enclave, won't reach here. @@ -322,6 +323,8 @@ def fini_enclave_debug(self): self.show_emmt() try: # clear TCS debug flag + # TODO - We may also need to recover AEXNOTIFY bit. + # It requires us to save the orig AEXNOTIFY bit before init_enclave_debug() for tcs_addr in self.tcs_addr_list: string = read_from_memory(tcs_addr + 8, 4) if string == None: @@ -681,7 +684,9 @@ def stop(self): if string == None: return False flag = struct.unpack('I', string)[0] + # set TCS debug flag, clear AEXNOTIFY flag |= 1 + flag &= (~2) gdb_cmd = "set *(unsigned int *)%#x = %#x" %(tcs_addr + 8, flag) gdb.execute(gdb_cmd, False, True) return False diff --git a/sdk/sample_libcrypto/Makefile b/sdk/sample_libcrypto/Makefile index 2046892e1..ba7c499b2 100644 --- a/sdk/sample_libcrypto/Makefile +++ b/sdk/sample_libcrypto/Makefile @@ -47,7 +47,7 @@ LDFLAGS += $(COMMON_LDFLAGS) -Wl,--version-script,sample_libcrypto.lds -Wl,--gc- OBJS := sample_libcrypto.o -IPPDISP_DIR := $(LINUX_SDK_DIR)/tlibcrypto/ipp/ipp_disp +IPPDISP_DIR := $(LINUX_SDK_DIR)/tlibcrypto/ipp/ipp_disp/intel64 C_SRC := $(wildcard $(IPPDISP_DIR)/*.c) C_OBJS := $(patsubst $(IPPDISP_DIR)/%.c, %.o, $(C_SRC)) C_OBJS := $(sort $(C_OBJS)) diff --git a/sdk/sample_libcrypto/sample_libcrypto.cpp b/sdk/sample_libcrypto/sample_libcrypto.cpp index fdccad1d8..bcce95b49 100644 --- a/sdk/sample_libcrypto/sample_libcrypto.cpp +++ b/sdk/sample_libcrypto/sample_libcrypto.cpp @@ -107,7 +107,10 @@ extern "C" int memset_s(void *s, size_t smax, int c, size_t n) #define UNUSED(val) (void)(val) #endif - +__attribute__((constructor)) void sample_init_ipp_crypto() +{ + ippcpInit(); +} static uint32_t seed = (uint32_t)(9); diff --git a/sdk/sign_tool/SignTool/Makefile b/sdk/sign_tool/SignTool/Makefile index e0d241642..f9ce24796 100644 --- a/sdk/sign_tool/SignTool/Makefile +++ b/sdk/sign_tool/SignTool/Makefile @@ -36,7 +36,7 @@ CFLAGS += -Werror CFLAGS += -fpie -DOPENSSL_API_COMPAT=10101 CXXFLAGS += -fpie -DOPENSSL_API_COMPAT=10101 -LDFLAGS := -pie $(COMMON_LDFLAGS) +LDFLAGS := -pie $(COMMON_LDFLAGS) -Wno-odr INC += $(ADDED_INC) INC += -I$(COMMON_DIR)/inc \ diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp index 333d668f4..56ce09daa 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.cpp +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -304,6 +304,13 @@ bool CMetadata::fill_enclave_css(const xml_parameter_t *para) m_metadata->enclave_css.body.attributes.flags |= SGX_FLAGS_KSS; m_metadata->enclave_css.body.attribute_mask.flags |= SGX_FLAGS_KSS; } + + if (para[ENABLEAEXNOTIFY].value == 1) + { + m_metadata->enclave_css.body.attributes.flags |= SGX_FLAGS_AEX_NOTIFY; + m_metadata->enclave_css.body.attribute_mask.flags |= SGX_FLAGS_AEX_NOTIFY; + } + if (memcpy_s(&(m_metadata->enclave_css.body.isvext_prod_id), SGX_ISVEXT_PROD_ID_SIZE, &(para[ISVEXTPRODID_L].value), sizeof(para[ISVEXTPRODID_L].value))) { @@ -599,48 +606,53 @@ bool CMetadata::check_xml_parameter(const xml_parameter_t *parameter) return true; } -uint64_t CMetadata::calculate_rts_bk_overhead() +static uint64_t edmm_aligned_overhead(uint32_t size) { - se_trace(SE_TRACE_DEBUG, "ema_overhead: %lld, bit_array_overhead: %lld\n", sizeof(struct ema_t_), sizeof(struct bit_array_)); - - // alignment value according to sgx-emm emalloc.c - const uint32_t ema_align = 0x10; - const uint32_t page_count_align = 0x80; + // header size/alignment/min_block_size comes from the emalloc + // implementation in sgx-emm module + const uint64_t header_size = sizeof(uint64_t); + const uint64_t alignment = 0x8; + const uint64_t min_block_size = 0x10; + uint64_t bsize = ROUND_TO(size + header_size, alignment); + return bsize < min_block_size ? min_block_size : bsize; +} - uint64_t ema_overhead = ROUND_TO(sizeof(struct ema_t_), ema_align); - uint64_t bit_array_overhead = ROUND_TO(sizeof(struct bit_array_), ema_align); +uint64_t CMetadata::calculate_rts_bk_overhead() +{ + uint64_t ema_overhead = edmm_aligned_overhead(sizeof(struct ema_t_)); + uint64_t bit_array_overhead = edmm_aligned_overhead(sizeof(struct bit_array_)); // MIN heap uint32_t page_count = (uint32_t)(m_create_param.heap_min_size >> SE_PAGE_SHIFT); - uint64_t heap_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + uint64_t heap_node_overhead = ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); if(m_create_param.heap_init_size > m_create_param.heap_min_size) { // INIT heap page_count = (uint32_t)((m_create_param.heap_init_size - m_create_param.heap_min_size) >> SE_PAGE_SHIFT); - heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + heap_node_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); } if(m_create_param.heap_max_size > m_create_param.heap_init_size) { page_count = (uint32_t)((m_create_param.heap_max_size - m_create_param.heap_init_size) >> SE_PAGE_SHIFT); - heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + heap_node_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); } page_count = (uint32_t)(m_create_param.rsrv_min_size >> SE_PAGE_SHIFT); - uint64_t rsrv_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + uint64_t rsrv_node_overhead = ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); if(m_create_param.rsrv_init_size > m_create_param.rsrv_min_size) { // INIT RSRV page_count = (uint32_t)((m_create_param.rsrv_init_size - m_create_param.rsrv_min_size) >> SE_PAGE_SHIFT); - rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + rsrv_node_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); } if(m_create_param.rsrv_max_size > m_create_param.rsrv_init_size) { page_count = (uint32_t)((m_create_param.rsrv_max_size - m_create_param.rsrv_init_size) >> SE_PAGE_SHIFT); - rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + rsrv_node_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); } // guard page | stack | guard page | TCS | SSA | guard page | TLS @@ -650,13 +662,13 @@ uint64_t CMetadata::calculate_rts_bk_overhead() // stack page_count = (uint32_t)(m_create_param.stack_min_size >> SE_PAGE_SHIFT); - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); removed_ctx_overhead += ema_overhead; if(m_create_param.stack_max_size > m_create_param.stack_min_size) { page_count = (uint32_t)((m_create_param.stack_max_size - m_create_param.stack_min_size) >> SE_PAGE_SHIFT); - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); removed_ctx_overhead += ema_overhead; } @@ -666,12 +678,12 @@ uint64_t CMetadata::calculate_rts_bk_overhead() // tcs page_count = TCS_SIZE >> SE_PAGE_SHIFT; - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); removed_ctx_overhead += ema_overhead; // ssa page_count = m_metadata->ssa_frame_size * SSA_NUM; - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); removed_ctx_overhead += ema_overhead; // guard page @@ -685,7 +697,7 @@ uint64_t CMetadata::calculate_rts_bk_overhead() { page_count += (uint32_t)(ROUND_TO_PAGE(section->virtual_size()) >> SE_PAGE_SHIFT); } - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(page_count, 8) >> 3)); removed_ctx_overhead += ema_overhead; uint32_t tcs_min_pool = 0; /* Number of static threads (EADD) */ @@ -736,14 +748,15 @@ uint64_t CMetadata::calculate_rts_bk_overhead() std::vector sections = m_parser->get_sections(); for (auto s : sections) { uint32_t p_count = (uint32_t)(ROUND_TO_PAGE(s->virtual_size()) >> SE_PAGE_SHIFT); - total_sections_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(p_count, page_count_align) >> 3); + total_sections_overhead += ema_overhead + bit_array_overhead + edmm_aligned_overhead((ROUND_TO(p_count, 8) >> 3)); } return heap_node_overhead + rsrv_node_overhead + total_non_removed_ctx_overhead + total_removed_ctx_overhead + - total_sections_overhead; + total_sections_overhead + + ema_overhead; // potential ema node for the last guard page } void *CMetadata::alloc_buffer_from_metadata(uint32_t size) @@ -1187,52 +1200,27 @@ bool CMetadata::build_layout_table() // SGX2 metadata required if ((meta_versions & 2u) == 2u) { - // 0x10000 due to the requirement from sgx-emm's min_block_size - uint64_t aligned_overhead = ROUND_TO(calculate_rts_bk_overhead(), 0x10000); - se_trace(SE_TRACE_DEBUG, "raw overhead: 0x%016llX\n", aligned_overhead); - - uint64_t units_of_block_size = aligned_overhead >> 16; - uint8_t reserve_cnt = 0; - while (units_of_block_size > 0) + uint64_t user_region_size = 0; + if (m_create_param.user_region_size > 0) { - ++reserve_cnt; - units_of_block_size >>= 1; + user_region_size = m_create_param.user_region_size; + // one-byte ema bookkeeping struct can roughly cover 2^15 byte data + uint64_t overhead = (m_create_param.user_region_size >> 15); + uint64_t aligned_overhead = ROUND_TO_PAGE(overhead) > 0 ? ROUND_TO_PAGE(overhead) : SE_PAGE_SIZE; + m_create_param.edmm_bk_overhead += aligned_overhead; } - if (reserve_cnt >= 30) - { - // There's a limit in emalloc.c that max_emalloc_size is 2^28 bytes. So when - // reservation count reaches 30, we reach that limit. - se_trace(SE_TRACE_ERROR, "Exceed RTS bookkeeping limit\n"); - return false; - } + const uint64_t initial_reserve_size = 0x10000; + const uint64_t guard_size = 0x8000; + const uint64_t reserve_overhead = 32; - se_trace(SE_TRACE_DEBUG, "ema reservation time: %d\n", reserve_cnt); - - // The memory reservation implementation in sgx-emm emalloc.c works like this: - // The initial reserve size is 16 pages (0x10000 bytes) and will double the size - // each time a new reservation is needed. That is, we will have these reservation - // sizes: 0x100000B for the 1st reserve, 0x200000B for the 2nd, 0x40000B for the 3rd. - // Therefore, if our rts ema overhead needs one reservation, we need 0x10000B, if it - // needs two reservation, we need 0x10000+0x20000=0x30000B, if it needs three, we - // need 0x10000+0x20000+0x40000=0x70000. - // Therefore, if we scale down 0x10000, we will have this pattern: 1, 3, 7, 15, ... - // which can be described as 2 ^ (number of reservation time) - 1. - // The memory reservation in emalloc.c also reserve two guard pages around the target - // memory region in each reservation, so we need an extra 0x10000B each time. - // Therefore, the total overhead should be (2^reserve_cnt - 1 + reserve_cnt) * 0x10000B. - uint64_t user_region_size = ((uint64_t)((1 << reserve_cnt) - 1 + reserve_cnt)) << 16; - se_trace(SE_TRACE_ERROR, "RTS bookkeeping overhead: 0x%016llX\n", user_region_size); + m_create_param.edmm_bk_overhead += calculate_rts_bk_overhead(); + uint64_t aligned_overhead = ROUND_TO(m_create_param.edmm_bk_overhead + reserve_overhead, initial_reserve_size); + user_region_size += aligned_overhead + (guard_size << 1); + m_create_param.edmm_bk_overhead = aligned_overhead; - if (m_create_param.user_region_size > 0) - { - user_region_size += m_create_param.user_region_size; - - // one-byte ema bookkeeping struct can roughly cover 2^15 byte data - uint64_t extra_overhead = (m_create_param.user_region_size >> 15); - user_region_size += ROUND_TO_PAGE(extra_overhead); - } - se_trace(SE_TRACE_ERROR, "Total user region size: 0x%016llX\n", user_region_size); + se_trace(SE_TRACE_DEBUG, "Total user region size: 0x%016llX\n", user_region_size); + se_trace(SE_TRACE_DEBUG, "Total edmm overhead: 0x%016llX\n", m_create_param.edmm_bk_overhead); memset(&layout, 0, sizeof(layout)); layout.entry.id = LAYOUT_ID_USER_REGION; @@ -1458,17 +1446,6 @@ bool CMetadata::build_gd_template(uint8_t *data, uint32_t *data_size) { m_create_param.rsrv_offset = (size_t)layout_rsrv->rva; } - - layout_entry_t * layout_user = get_entry_by_id(LAYOUT_ID_USER_REGION, false); - if (NULL == layout_user) - { - m_create_param.user_region_offset = (size_t)0; - } - else - { - m_create_param.user_region_offset = (size_t)layout_user->rva; - } - size_t tmp_tls_addr = (size_t)(get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva); m_create_param.td_addr = tmp_tls_addr + (size_t)((get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); @@ -1502,6 +1479,11 @@ bool CMetadata::build_tcs_template(tcs_t *tcs) { return false; } + if( m_metadata->enclave_css.body.attributes.flags & SGX_FLAGS_AEX_NOTIFY ) + { + tcs->flags |= TCS_FLAG_AEXNOTIFY; + } + tcs->oentry += offset; tcs->nssa = SSA_NUM; tcs->cssa = 0; @@ -1664,13 +1646,13 @@ bool CMetadata::check_config() { // SGX2 metadata only m_meta_verions = 1u << 1; - se_trace(SE_TRACE_ERROR, "\033[0;32mINFO: Enclave configuration 'MiscSelect' and 'MiscSelectMask' will prevent enclave from running on SGX1 platform. To make it run on SGX1 platform, suggest to set MiscMask[0]=0 and MiscSelect[0]=1.\n\033[0m"); - return true; } - - // SGX1 and SGX2 metadata - m_meta_verions = (1u << 1) | 1u; - se_trace(SE_TRACE_ERROR, "\033[0;32mINFO: Enclave configuration 'MiscSelect' and 'MiscSelectMask' will work on SGX1 and SGX2 platforms with respective metadata.\n\033[0m"); + else + { + // SGX1 and SGX2 metadata + m_meta_verions = (1u << 1) | 1u; + } + se_trace(SE_TRACE_ERROR, "\033[0;32mINFO: Enclave configuration 'MiscSelect' and 'MiscSelectMask' will prevent enclave from running on SGX1 platform. To make it run on SGX1 platform, suggest to set MiscSelect[0]=0.\n\033[0m"); return true; } diff --git a/sdk/sign_tool/SignTool/manage_metadata.h b/sdk/sign_tool/SignTool/manage_metadata.h index 337e13078..84f5a076b 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.h +++ b/sdk/sign_tool/SignTool/manage_metadata.h @@ -85,7 +85,8 @@ typedef enum _para_type_t ELRANGESIZE, PKRU, AMX, - USERREGIONSIZE + USERREGIONSIZE, + ENABLEAEXNOTIFY } para_type_t; typedef struct _xml_parameter_t diff --git a/sdk/sign_tool/SignTool/sign_tool.cpp b/sdk/sign_tool/SignTool/sign_tool.cpp index 3fe8ef769..a29079904 100644 --- a/sdk/sign_tool/SignTool/sign_tool.cpp +++ b/sdk/sign_tool/SignTool/sign_tool.cpp @@ -1333,7 +1333,8 @@ int main(int argc, char* argv[]) {"ELRangeSize", 0xFFFFFFFFFFFFFFFF, 0x1000, 0, 0}, {"PKRU", FEATURE_LOADER_SELECTS, FEATURE_MUST_BE_DISABLED, FEATURE_MUST_BE_DISABLED, 0}, {"AMX", FEATURE_LOADER_SELECTS, FEATURE_MUST_BE_DISABLED, FEATURE_MUST_BE_DISABLED, 0}, - {"UserRegionSize", ENCLAVE_MAX_SIZE_64/2, 0, USER_REGION_SIZE, 0}}; + {"UserRegionSize", ENCLAVE_MAX_SIZE_64/2, 0, USER_REGION_SIZE, 0}, + {"EnableAEXNotify", 1, 0, 0, 0}}; const char *path[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; uint8_t enclave_hash[SGX_HASH_SIZE] = {0}; uint8_t metadata_raw[METADATA_SIZE]; diff --git a/sdk/simulation/trtssim/linux/Makefile b/sdk/simulation/trtssim/linux/Makefile index bcb68e5d4..0e8614402 100644 --- a/sdk/simulation/trtssim/linux/Makefile +++ b/sdk/simulation/trtssim/linux/Makefile @@ -67,6 +67,7 @@ TRTS1_OBJS := init_enclave.o \ trts_xsave.o \ init_optimized_lib.o \ trts_add_trim.o \ + trts_aex.o \ trts_emm_sim.o TRTS2_OBJS := trts_nsp.o @@ -81,6 +82,7 @@ TLS_OBJS := get_tcs.o \ restore_tls.o TLDR_ASM_OBJS := trts_pic.o \ + trts_mitigation.o \ metadata_sec.o \ xsave_gnu.o \ thunk.o diff --git a/sdk/switchless/sgx_uswitchless/sl_uswitchless_untrusted.c b/sdk/switchless/sgx_uswitchless/sl_uswitchless_untrusted.c index 5c9fd8e0a..61bca885d 100644 --- a/sdk/switchless/sgx_uswitchless/sl_uswitchless_untrusted.c +++ b/sdk/switchless/sgx_uswitchless/sl_uswitchless_untrusted.c @@ -144,10 +144,12 @@ sgx_status_t sl_init_uswitchless(sgx_enclave_id_t enclave_id, const void* config status = SGX_ERROR_UNEXPECTED; sl_uswitchless_free(uswitchless_p); } + else + { + *switchless_pp = uswitchless_p; + } } - *switchless_pp = uswitchless_p; - return status; } diff --git a/sdk/tlibcrypto/Makefile b/sdk/tlibcrypto/Makefile index bb048e95e..33a4009af 100644 --- a/sdk/tlibcrypto/Makefile +++ b/sdk/tlibcrypto/Makefile @@ -88,7 +88,7 @@ LIB_NAME := libsgx_tcrypto_ipp.a endif #($(USE_CRYPTO_LIB), 0) -C_Files := $(wildcard ipp/ipp_disp/*.c) +C_Files := $(wildcard ipp/ipp_disp/intel64/*.c) C_OBJS := $(C_Files:.c=.o) C_OBJS := $(sort $(C_OBJS)) @@ -138,9 +138,9 @@ all: $(TARGET) $(DISP_LIB_NAME) | $(BUILD_DIR) .PHONY: clean clean: - @$(RM) *.o ipp/*.o ipp/ipp_disp/*.o sgxssl/*.o $(TARGET) $(BUILD_DIR)/$(TARGET) $(LIB_NAME) $(DISP_LIB_NAME) $(BUILD_DIR)/$(DISP_LIB_NAME) + @$(RM) *.o ipp/*.o ipp/ipp_disp/intel64/*.o sgxssl/*.o $(TARGET) $(BUILD_DIR)/$(TARGET) $(LIB_NAME) $(DISP_LIB_NAME) $(BUILD_DIR)/$(DISP_LIB_NAME) .PHONY: rebuild rebuild: $(MAKE) clean - $(MAKE) all \ No newline at end of file + $(MAKE) all diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00000.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippcpGetLibVersion.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00000.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippcpGetLibVersion.c index af7275142..fe4bb3f3f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00000.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippcpGetLibVersion.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppLibraryVersion*, y8_ippcpGetLibVersion, (void) ) -IPPAPI( const IppLibraryVersion*, l9_ippcpGetLibVersion, (void) ) IPPAPI( const IppLibraryVersion*, k1_ippcpGetLibVersion, (void) ) +IPPAPI( const IppLibraryVersion*, l9_ippcpGetLibVersion, (void) ) +IPPAPI( const IppLibraryVersion*, y8_ippcpGetLibVersion, (void) ) -IPPFUN( const IppLibraryVersion*,sgx_disp_ippcpGetLibVersion, (void) ) +IPPFUN( const IppLibraryVersion*, sgx_disp_ippcpGetLibVersion, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippcpGetLibVersion( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippcpGetLibVersion( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippcpGetLibVersion( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppLibraryVersion*, p8_ippcpGetLibVersion, (void) ) -IPPAPI( const IppLibraryVersion*, h9_ippcpGetLibVersion, (void) ) - -IPPFUN( const IppLibraryVersion*,sgx_disp_ippcpGetLibVersion, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippcpGetLibVersion( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippcpGetLibVersion( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00026.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00026.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC.c index 8640f4a2f..ff36a5999 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00026.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00027.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS1.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00027.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS1.c index 8a877c9a1..45701bffc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00027.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00028.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00028.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS2.c index f38b6d528..0c0a6b7c7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00028.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00029.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS3.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00029.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS3.c index eaf668f64..bd1256849 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00029.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCBC_CS3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00031.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00031.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCFB.c index b389dc67f..08f5b9e6b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00031.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00035.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCTR.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00035.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCTR.c index 364e1cea2..ee3edd2ea 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00035.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00021.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptECB.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00021.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptECB.c index feaba5884..66bb3701a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00021.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPAPI(IppStatus, l9_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) IPPAPI(IppStatus, k1_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptECB( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPAPI(IppStatus, h9_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptECB( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00033.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptOFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00033.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptOFB.c index 4c679a138..8724414c4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00033.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00037.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptXTS_Direct.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00037.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptXTS_Direct.c index 871e32805..a8bf50ebb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00037.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESDecryptXTS_Direct.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPAPI(IppStatus, l9_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) IPPAPI(IppStatus, k1_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPAPI(IppStatus, l9_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPAPI(IppStatus, y8_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPFUN(IppStatus, sgx_disp_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESDecryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESDecryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESDecryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPAPI(IppStatus, h9_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESDecryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESDecryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESDecryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00022.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00022.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC.c index cbc25d5e0..6d7ae7985 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00022.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00023.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS1.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00023.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS1.c index 9518854fb..8691fa94a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00023.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00024.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00024.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS2.c index 5b108febe..293f64551 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00024.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00025.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS3.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00025.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS3.c index 7c1c38365..a88d463d3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00025.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCBC_CS3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00030.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00030.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCFB.c index 11eba7dfb..1a664f91e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00030.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsAESSpec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00034.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCTR.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00034.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCTR.c index c764963fb..a0b318416 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00034.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00020.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptECB.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00020.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptECB.c index f04fb4f9a..071d7f559 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00020.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPAPI(IppStatus, l9_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) IPPAPI(IppStatus, k1_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptECB( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -IPPAPI(IppStatus, h9_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsAESSpec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptECB( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00032.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptOFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00032.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptOFB.c index 4adf930f1..b1cca949f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00032.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsAESSpec* pCtx, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00036.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptXTS_Direct.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00036.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptXTS_Direct.c index 94cd95a3c..089bbf9fd 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00036.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESEncryptXTS_Direct.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPAPI(IppStatus, l9_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) IPPAPI(IppStatus, k1_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPAPI(IppStatus, l9_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPAPI(IppStatus, y8_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) +IPPFUN(IppStatus, sgx_disp_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESEncryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESEncryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESEncryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -IPPAPI(IppStatus, h9_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESEncryptXTS_Direct,(const Ipp8u* pSrc, Ipp8u* pDst, int encBitsize, int aesBlkNo, const Ipp8u* pTweakPT, const Ipp8u* pKey, int keyBitsize, int dataUnitBitsize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESEncryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESEncryptXTS_Direct( pSrc, pDst, encBitsize, aesBlkNo, pTweakPT, pKey, keyBitsize, dataUnitBitsize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00015.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00015.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESGetSize.c index 6fb991355..5f2f2e5be 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00015.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESGetSize,(int *pSize)) -IPPAPI(IppStatus, l9_ippsAESGetSize,(int *pSize)) IPPAPI(IppStatus, k1_ippsAESGetSize,(int *pSize)) +IPPAPI(IppStatus, l9_ippsAESGetSize,(int *pSize)) +IPPAPI(IppStatus, y8_ippsAESGetSize,(int *pSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESGetSize,(int *pSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESGetSize,(int *pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESGetSize,(int *pSize)) -IPPAPI(IppStatus, h9_ippsAESGetSize,(int *pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESGetSize,(int *pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00016.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESInit.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00016.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESInit.c index 0d6634592..1eafc8180 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00016.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) -IPPAPI(IppStatus, l9_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) IPPAPI(IppStatus, k1_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) +IPPAPI(IppStatus, l9_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) +IPPAPI(IppStatus, y8_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESInit( pKey, keyLen, pCtx, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) -IPPAPI(IppStatus, h9_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESInit( pKey, keyLen, pCtx, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00018.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESPack.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00018.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESPack.c index 2b6feed3d..eb016f608 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00018.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESPack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, l9_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) IPPAPI(IppStatus, k1_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, l9_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, y8_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESPack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESPack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESPack( pCtx, pBuffer, bufSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, h9_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESPack,(const IppsAESSpec* pCtx, Ipp8u* pBuffer, int bufSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESPack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESPack( pCtx, pBuffer, bufSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00017.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetKey.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00017.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetKey.c index 02f6c6383..ed5903b24 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00017.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) -IPPAPI(IppStatus, l9_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) IPPAPI(IppStatus, k1_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESSetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESSetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESSetKey( pKey, keyLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) -IPPAPI(IppStatus, h9_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsAESSetKey,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESSetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESSetKey( pKey, keyLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetupNoise.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetupNoise.c new file mode 100644 index 000000000..166c24e36 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESSetupNoise.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsAESSetupNoise,(Ipp32u noiseLevel, IppsAESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsAESSetupNoise,(Ipp32u noiseLevel, IppsAESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsAESSetupNoise,(Ipp32u noiseLevel, IppsAESSpec* pCtx)) + +IPPFUN(IppStatus, sgx_disp_ippsAESSetupNoise,(Ipp32u noiseLevel, IppsAESSpec* pCtx)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsAESSetupNoise( noiseLevel, pCtx ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsAESSetupNoise( noiseLevel, pCtx ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsAESSetupNoise( noiseLevel, pCtx ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00019.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESUnpack.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00019.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESUnpack.c index 8daa3eff7..9dff7b8ad 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00019.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAESUnpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) -IPPAPI(IppStatus, l9_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) IPPAPI(IppStatus, k1_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) +IPPAPI(IppStatus, l9_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) +IPPAPI(IppStatus, y8_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAESUnpack( pBuffer, pCtx, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAESUnpack( pBuffer, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAESUnpack( pBuffer, pCtx, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) -IPPAPI(IppStatus, h9_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAESUnpack,(const Ipp8u* pBuffer, IppsAESSpec* pCtx, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAESUnpack( pBuffer, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAESUnpack( pBuffer, pCtx, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00072.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMDecrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00072.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMDecrypt.c index f64003477..1354e65ce 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00072.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMDecrypt( pSrc, pDst, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMDecrypt( pSrc, pDst, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00071.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMEncrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00071.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMEncrypt.c index c4c657517..26ccc56cf 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00071.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMEncrypt( pSrc, pDst, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMEncrypt( pSrc, pDst, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00066.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00066.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetSize.c index 2efa0843a..17657fa30 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00066.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMGetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsAES_CCMGetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsAES_CCMGetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsAES_CCMGetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsAES_CCMGetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMGetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMGetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMGetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsAES_CCMGetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMGetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00073.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00073.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetTag.c index f7d008f15..24f213836 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00073.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMGetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMGetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMGetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00067.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00067.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMInit.c index 6f6319064..ab83f2288 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00067.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) -IPPAPI(IppStatus, l9_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) IPPAPI(IppStatus, k1_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) +IPPAPI(IppStatus, l9_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) +IPPAPI(IppStatus, y8_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMInit( pKey, keyLen, pState, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) -IPPAPI(IppStatus, h9_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_CCMState* pState, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMInit( pKey, keyLen, pState, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00068.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMMessageLen.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00068.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMMessageLen.c index 41674960d..15d72dce7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00068.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMMessageLen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMMessageLen( msgLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMMessageLen( msgLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMMessageLen( msgLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMMessageLen,(Ipp64u msgLen, IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMMessageLen( msgLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMMessageLen( msgLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00070.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMStart.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00070.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMStart.c index ee61d86b0..e6d525988 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00070.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMStart.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMStart( pIV, ivLen, pAD, adLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMStart( pIV, ivLen, pAD, adLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMStart( pIV, ivLen, pAD, adLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMStart( pIV, ivLen, pAD, adLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMStart( pIV, ivLen, pAD, adLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00069.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMTagLen.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00069.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMTagLen.c index e4d144b98..a8d729bb6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00069.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CCMTagLen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CCMTagLen( tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CCMTagLen( tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CCMTagLen( tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CCMTagLen,(int tagLen, IppsAES_CCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CCMTagLen( tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CCMTagLen( tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00093.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACFinal.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00093.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACFinal.c index 2998da092..fcac840ec 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00093.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACFinal.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) IPPAPI(IppStatus, k1_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CMACFinal( pMD, mdLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CMACFinal( pMD, mdLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CMACFinal( pMD, mdLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CMACFinal( pMD, mdLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CMACFinal( pMD, mdLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00090.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00090.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetSize.c index 35fe89b82..7dd0ef21d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00090.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CMACGetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsAES_CMACGetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsAES_CMACGetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsAES_CMACGetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsAES_CMACGetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACGetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACGetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CMACGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CMACGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CMACGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CMACGetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsAES_CMACGetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACGetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CMACGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CMACGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00094.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00094.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetTag.c index dba8be557..6e44435ed 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00094.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACGetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) IPPAPI(IppStatus, k1_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CMACGetTag( pMD, mdLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CMACGetTag( pMD, mdLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CMACGetTag( pMD, mdLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CMACGetTag( pMD, mdLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CMACGetTag( pMD, mdLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00091.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00091.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACInit.c index 89539adb7..3a6fbd3be 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00091.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) -IPPAPI(IppStatus, l9_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) IPPAPI(IppStatus, k1_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) +IPPAPI(IppStatus, l9_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) +IPPAPI(IppStatus, y8_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CMACInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CMACInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CMACInit( pKey, keyLen, pState, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) -IPPAPI(IppStatus, h9_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CMACInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CMACInit( pKey, keyLen, pState, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACSetupNoise.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACSetupNoise.c new file mode 100644 index 000000000..4ad9b1b60 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACSetupNoise.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsAES_CMACSetupNoise,(Ipp32u noiseLevel, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CMACSetupNoise,(Ipp32u noiseLevel, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CMACSetupNoise,(Ipp32u noiseLevel, IppsAES_CMACState* pState)) + +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACSetupNoise,(Ipp32u noiseLevel, IppsAES_CMACState* pState)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsAES_CMACSetupNoise( noiseLevel, pState ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsAES_CMACSetupNoise( noiseLevel, pState ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsAES_CMACSetupNoise( noiseLevel, pState ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00092.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACUpdate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00092.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACUpdate.c index 69ca6e259..addc2b229 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00092.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_CMACUpdate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, l9_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) IPPAPI(IppStatus, k1_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, l9_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, y8_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_CMACUpdate( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_CMACUpdate( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_CMACUpdate( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, h9_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_CMACUpdate( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_CMACUpdate( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00038.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_EncryptCFB16_MB.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00038.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_EncryptCFB16_MB.c index 47fac89d2..588d85cfb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00038.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_EncryptCFB16_MB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) -IPPAPI(IppStatus, l9_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) IPPAPI(IppStatus, k1_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) +IPPAPI(IppStatus, l9_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) +IPPAPI(IppStatus, y8_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) -IPPFUN(IppStatus,sgx_disp_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) +IPPFUN(IppStatus, sgx_disp_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_EncryptCFB16_MB( pSrc, pDst, len, pCtx, pIV, status, numBuffers ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_EncryptCFB16_MB( pSrc, pDst, len, pCtx, pIV, status, numBuffers ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_EncryptCFB16_MB( pSrc, pDst, len, pCtx, pIV, status, numBuffers ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) -IPPAPI(IppStatus, h9_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_EncryptCFB16_MB, (const Ipp8u* pSrc[], Ipp8u* pDst[], int len[], const IppsAESSpec* pCtx[], const Ipp8u* pIV[], IppStatus status[], int numBuffers)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_EncryptCFB16_MB( pSrc, pDst, len, pCtx, pIV, status, numBuffers ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_EncryptCFB16_MB( pSrc, pDst, len, pCtx, pIV, status, numBuffers ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00081.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMDecrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00081.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMDecrypt.c index a70b6c340..fc11d7249 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00081.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMDecrypt( pSrc, pDst, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMDecrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMDecrypt( pSrc, pDst, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00080.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMEncrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00080.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMEncrypt.c index fdbc59710..ee71f6fdb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00080.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMEncrypt( pSrc, pDst, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMEncrypt( pSrc, pDst, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMEncrypt( pSrc, pDst, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00074.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00074.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetSize.c index 86540a114..80f0b3b17 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00074.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMGetSize,(int * pSize)) -IPPAPI(IppStatus, l9_ippsAES_GCMGetSize,(int * pSize)) IPPAPI(IppStatus, k1_ippsAES_GCMGetSize,(int * pSize)) +IPPAPI(IppStatus, l9_ippsAES_GCMGetSize,(int * pSize)) +IPPAPI(IppStatus, y8_ippsAES_GCMGetSize,(int * pSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMGetSize,(int * pSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMGetSize,(int * pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMGetSize,(int * pSize)) -IPPAPI(IppStatus, h9_ippsAES_GCMGetSize,(int * pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMGetSize,(int * pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00082.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00082.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetTag.c index 058fc1c2f..9d03d278a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00082.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMGetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMGetTag( pDstTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMGetTag( pDstTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMGetTag( pDstTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMGetTag( pDstTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMGetTag( pDstTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00075.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00075.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMInit.c index 71a2f67da..f31d1cb9b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00075.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) -IPPAPI(IppStatus, l9_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) IPPAPI(IppStatus, k1_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) +IPPAPI(IppStatus, l9_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) +IPPAPI(IppStatus, y8_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMInit( pKey, keyLen, pState, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) -IPPAPI(IppStatus, h9_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMInit( pKey, keyLen, pState, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMInit( pKey, keyLen, pState, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessAAD.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessAAD.c new file mode 100644 index 000000000..2a4bd0201 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessAAD.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) + +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsAES_GCMProcessAAD( pAAD, aadLen, pState ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsAES_GCMProcessAAD( pAAD, aadLen, pState ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsAES_GCMProcessAAD( pAAD, aadLen, pState ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00077.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessIV.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00077.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessIV.c index be6a5523d..63788a8d5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00077.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMProcessIV.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMProcessIV( pIV, ivLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMProcessIV( pIV, ivLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMProcessIV( pIV, ivLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMProcessIV( pIV, ivLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMProcessIV( pIV, ivLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00076.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMReset.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00076.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMReset.c index 110b8d7dc..a50a1f7b7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00076.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMReset.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMReset,(IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMReset,(IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMReset,(IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMReset,(IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMReset,(IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMReset,(IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMReset,(IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMReset( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMReset( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMReset( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMReset,(IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMReset,(IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMReset,(IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMReset( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMReset( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMSetupNoise.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMSetupNoise.c new file mode 100644 index 000000000..78fb4728d --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMSetupNoise.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsAES_GCMSetupNoise,(Ipp32u noiseLevel, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMSetupNoise,(Ipp32u noiseLevel, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMSetupNoise,(Ipp32u noiseLevel, IppsAES_GCMState* pState)) + +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMSetupNoise,(Ipp32u noiseLevel, IppsAES_GCMState* pState)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsAES_GCMSetupNoise( noiseLevel, pState ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsAES_GCMSetupNoise( noiseLevel, pState ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsAES_GCMSetupNoise( noiseLevel, pState ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00079.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMStart.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00079.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMStart.c index 3f5fb2f9d..606080f30 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00079.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_GCMStart.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) IPPAPI(IppStatus, k1_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, l9_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, y8_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_GCMStart( pIV, ivLen, pAAD, aadLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_GCMStart( pIV, ivLen, pAAD, aadLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_GCMStart( pIV, ivLen, pAAD, aadLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMStart( pIV, ivLen, pAAD, aadLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMStart( pIV, ivLen, pAAD, aadLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00087.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_S2V_CMAC.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00087.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_S2V_CMAC.c index 2225165aa..ef349cd9d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00087.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_S2V_CMAC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) -IPPAPI(IppStatus, l9_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) IPPAPI(IppStatus, k1_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) +IPPAPI(IppStatus, l9_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) +IPPAPI(IppStatus, y8_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) -IPPFUN(IppStatus,sgx_disp_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) +IPPFUN(IppStatus, sgx_disp_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_S2V_CMAC( pKey, keyLen, pAD, pADlen, numAD, pV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_S2V_CMAC( pKey, keyLen, pAD, pADlen, numAD, pV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_S2V_CMAC( pKey, keyLen, pAD, pADlen, numAD, pV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) -IPPAPI(IppStatus, h9_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_S2V_CMAC,(const Ipp8u* pKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, Ipp8u* pV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_S2V_CMAC( pKey, keyLen, pAD, pADlen, numAD, pV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_S2V_CMAC( pKey, keyLen, pAD, pADlen, numAD, pV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00089.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVDecrypt.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00089.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVDecrypt.c index e63b28193..03d5f5d9b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00089.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) -IPPAPI(IppStatus, l9_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) IPPAPI(IppStatus, k1_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) +IPPAPI(IppStatus, l9_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) +IPPAPI(IppStatus, y8_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) -IPPFUN(IppStatus,sgx_disp_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) +IPPFUN(IppStatus, sgx_disp_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_SIVDecrypt( pSrc, pDst, len, pAuthPassed, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD, pSIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_SIVDecrypt( pSrc, pDst, len, pAuthPassed, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD, pSIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_SIVDecrypt( pSrc, pDst, len, pAuthPassed, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD, pSIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) -IPPAPI(IppStatus, h9_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_SIVDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int* pAuthPassed, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD, const Ipp8u* pSIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_SIVDecrypt( pSrc, pDst, len, pAuthPassed, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD, pSIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_SIVDecrypt( pSrc, pDst, len, pAuthPassed, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD, pSIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00088.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVEncrypt.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00088.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVEncrypt.c index c2fd7088c..04f19a4fb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00088.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_SIVEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) -IPPAPI(IppStatus, l9_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) IPPAPI(IppStatus, k1_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) +IPPAPI(IppStatus, l9_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) +IPPAPI(IppStatus, y8_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) -IPPFUN(IppStatus,sgx_disp_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) +IPPFUN(IppStatus, sgx_disp_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_SIVEncrypt( pSrc, pDst, len, pSIV, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_SIVEncrypt( pSrc, pDst, len, pSIV, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_SIVEncrypt( pSrc, pDst, len, pSIV, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) -IPPAPI(IppStatus, h9_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_SIVEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, Ipp8u* pSIV, const Ipp8u* pAuthKey, const Ipp8u* pConfKey, int keyLen, const Ipp8u* pAD[], const int pADlen[], int numAD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_SIVEncrypt( pSrc, pDst, len, pSIV, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_SIVEncrypt( pSrc, pDst, len, pSIV, pAuthKey, pConfKey, keyLen, pAD, pADlen, numAD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00086.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSDecrypt.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00086.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSDecrypt.c index f4db2a5e8..6691d14b1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00086.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPAPI(IppStatus, l9_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) IPPAPI(IppStatus, k1_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPAPI(IppStatus, l9_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPAPI(IppStatus, y8_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPFUN(IppStatus, sgx_disp_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_XTSDecrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_XTSDecrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_XTSDecrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPAPI(IppStatus, h9_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_XTSDecrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_XTSDecrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00085.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSEncrypt.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00085.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSEncrypt.c index 2f7d35da7..01d7ed02b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00085.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPAPI(IppStatus, l9_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) IPPAPI(IppStatus, k1_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPAPI(IppStatus, l9_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPAPI(IppStatus, y8_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) +IPPFUN(IppStatus, sgx_disp_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_XTSEncrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_XTSEncrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_XTSEncrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -IPPAPI(IppStatus, h9_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int bitSizeLen, const IppsAES_XTSSpec* pCtx, const Ipp8u* pTweak, int startCipherBlkNo)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_XTSEncrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_XTSEncrypt( pSrc, pDst, bitSizeLen, pCtx, pTweak, startCipherBlkNo ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00083.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00083.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSGetSize.c index 04c5b16e6..16340b3c9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00083.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_XTSGetSize,(int * pSize)) -IPPAPI(IppStatus, l9_ippsAES_XTSGetSize,(int * pSize)) IPPAPI(IppStatus, k1_ippsAES_XTSGetSize,(int * pSize)) +IPPAPI(IppStatus, l9_ippsAES_XTSGetSize,(int * pSize)) +IPPAPI(IppStatus, y8_ippsAES_XTSGetSize,(int * pSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSGetSize,(int * pSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_XTSGetSize,(int * pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_XTSGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_XTSGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_XTSGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_XTSGetSize,(int * pSize)) -IPPAPI(IppStatus, h9_ippsAES_XTSGetSize,(int * pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSGetSize,(int * pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_XTSGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_XTSGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00084.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00084.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSInit.c index 7f3556102..f4d2c3d90 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00084.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAES_XTSInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) -IPPAPI(IppStatus, l9_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) IPPAPI(IppStatus, k1_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) +IPPAPI(IppStatus, l9_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) +IPPAPI(IppStatus, y8_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAES_XTSInit( pKey, keyLen, duBitsize, pCtx, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAES_XTSInit( pKey, keyLen, duBitsize, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAES_XTSInit( pKey, keyLen, duBitsize, pCtx, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) -IPPAPI(IppStatus, h9_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_XTSInit,(const Ipp8u* pKey, int keyLen, int duBitsize, IppsAES_XTSSpec* pCtx,int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_XTSInit( pKey, keyLen, duBitsize, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_XTSInit( pKey, keyLen, duBitsize, pCtx, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00095.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourCheckKey.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00095.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourCheckKey.c index 8d9e2d37d..d1ca7f2e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00095.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourCheckKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) -IPPAPI(IppStatus, l9_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) IPPAPI(IppStatus, k1_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) +IPPAPI(IppStatus, l9_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) +IPPAPI(IppStatus, y8_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourCheckKey( pKey, keyLen, pIsWeak ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourCheckKey( pKey, keyLen, pIsWeak ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourCheckKey( pKey, keyLen, pIsWeak ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) -IPPAPI(IppStatus, h9_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourCheckKey, (const Ipp8u *pKey, int keyLen, IppBool* pIsWeak)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourCheckKey( pKey, keyLen, pIsWeak ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourCheckKey( pKey, keyLen, pIsWeak ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00102.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourDecrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00102.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourDecrypt.c index 4d80ae7c2..0715e5e5a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00102.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, l9_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) IPPAPI(IppStatus, k1_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, l9_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, y8_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourDecrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourDecrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourDecrypt( pSrc, pDst, length, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, h9_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourDecrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourDecrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourDecrypt( pSrc, pDst, length, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00101.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourEncrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00101.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourEncrypt.c index 0dbb41523..d079366f4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00101.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, l9_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) IPPAPI(IppStatus, k1_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, l9_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, y8_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourEncrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourEncrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourEncrypt( pSrc, pDst, length, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, h9_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourEncrypt, (const Ipp8u *pSrc, Ipp8u *pDst, int length, IppsARCFourState *pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourEncrypt( pSrc, pDst, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourEncrypt( pSrc, pDst, length, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00096.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00096.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourGetSize.c index 8bb94204c..9f0306049 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00096.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourGetSize, (int* pSize)) -IPPAPI(IppStatus, l9_ippsARCFourGetSize, (int* pSize)) IPPAPI(IppStatus, k1_ippsARCFourGetSize, (int* pSize)) +IPPAPI(IppStatus, l9_ippsARCFourGetSize, (int* pSize)) +IPPAPI(IppStatus, y8_ippsARCFourGetSize, (int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourGetSize, (int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourGetSize, (int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourGetSize, (int* pSize)) -IPPAPI(IppStatus, h9_ippsARCFourGetSize, (int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourGetSize, (int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00097.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourInit.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00097.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourInit.c index 085c66e70..5a22c25b0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00097.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, l9_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) IPPAPI(IppStatus, k1_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, l9_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) +IPPAPI(IppStatus, y8_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourInit( pKey, keyLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourInit( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourInit( pKey, keyLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) -IPPAPI(IppStatus, h9_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourInit, (const Ipp8u *pKey, int keyLen, IppsARCFourState *pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourInit( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourInit( pKey, keyLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00099.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourPack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00099.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourPack.c index 1d7a5e179..259394916 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00099.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourPack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourPack( pCtx, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourPack( pCtx, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourPack,(const IppsARCFourState* pCtx, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourPack( pCtx, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00098.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourReset.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00098.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourReset.c index fc2e91b30..eb957d781 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00098.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourReset.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourReset, (IppsARCFourState* pCtx)) -IPPAPI(IppStatus, l9_ippsARCFourReset, (IppsARCFourState* pCtx)) IPPAPI(IppStatus, k1_ippsARCFourReset, (IppsARCFourState* pCtx)) +IPPAPI(IppStatus, l9_ippsARCFourReset, (IppsARCFourState* pCtx)) +IPPAPI(IppStatus, y8_ippsARCFourReset, (IppsARCFourState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourReset, (IppsARCFourState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourReset, (IppsARCFourState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourReset( pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourReset( pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourReset( pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourReset, (IppsARCFourState* pCtx)) -IPPAPI(IppStatus, h9_ippsARCFourReset, (IppsARCFourState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourReset, (IppsARCFourState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourReset( pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourReset( pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00100.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourUnpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00100.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourUnpack.c index 963644e87..c350f8947 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00100.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsARCFourUnpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) -IPPAPI(IppStatus, l9_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) IPPAPI(IppStatus, k1_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) +IPPAPI(IppStatus, l9_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) +IPPAPI(IppStatus, y8_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsARCFourUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsARCFourUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsARCFourUnpack( pBuffer, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) -IPPAPI(IppStatus, h9_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsARCFourUnpack,(const Ipp8u* pBuffer, IppsARCFourState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsARCFourUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsARCFourUnpack( pBuffer, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00247.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAdd_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00247.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAdd_BN.c index a13d92f30..425d83fae 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00247.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsAdd_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsAdd_BN( pA, pB, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsAdd_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsAdd_BN( pA, pB, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAdd_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAdd_BN( pA, pB, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00238.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumGetSize.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00238.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumGetSize.c index 4debdfeab..30aea76b7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00238.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsBigNumGetSize,(int length, int* pSize)) -IPPAPI(IppStatus, l9_ippsBigNumGetSize,(int length, int* pSize)) IPPAPI(IppStatus, k1_ippsBigNumGetSize,(int length, int* pSize)) +IPPAPI(IppStatus, l9_ippsBigNumGetSize,(int length, int* pSize)) +IPPAPI(IppStatus, y8_ippsBigNumGetSize,(int length, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsBigNumGetSize,(int length, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsBigNumGetSize,(int length, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsBigNumGetSize( length, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsBigNumGetSize( length, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsBigNumGetSize( length, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsBigNumGetSize,(int length, int* pSize)) -IPPAPI(IppStatus, h9_ippsBigNumGetSize,(int length, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsBigNumGetSize,(int length, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsBigNumGetSize( length, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsBigNumGetSize( length, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00239.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumInit.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00239.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumInit.c index f0316b20a..b3274f812 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00239.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsBigNumInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsBigNumInit,(int length, IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsBigNumInit,(int length, IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsBigNumInit,(int length, IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsBigNumInit,(int length, IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsBigNumInit,(int length, IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsBigNumInit,(int length, IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsBigNumInit,(int length, IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsBigNumInit( length, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsBigNumInit( length, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsBigNumInit( length, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsBigNumInit,(int length, IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsBigNumInit,(int length, IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsBigNumInit,(int length, IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsBigNumInit( length, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsBigNumInit( length, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00240.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmpZero_BN.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00240.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmpZero_BN.c index 45ce49b1f..a0d28d945 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00240.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmpZero_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) -IPPAPI(IppStatus, l9_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) IPPAPI(IppStatus, k1_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) +IPPAPI(IppStatus, l9_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) +IPPAPI(IppStatus, y8_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) -IPPFUN(IppStatus,sgx_disp_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) +IPPFUN(IppStatus, sgx_disp_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsCmpZero_BN( pBN, pResult ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsCmpZero_BN( pBN, pResult ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsCmpZero_BN( pBN, pResult ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) -IPPAPI(IppStatus, h9_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) - -IPPFUN(IppStatus,sgx_disp_ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsCmpZero_BN( pBN, pResult ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsCmpZero_BN( pBN, pResult ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00241.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmp_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00241.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmp_BN.c index 66774d955..7a08e1b7c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00241.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsCmp_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) -IPPAPI(IppStatus, l9_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) IPPAPI(IppStatus, k1_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) +IPPAPI(IppStatus, l9_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) +IPPAPI(IppStatus, y8_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) -IPPFUN(IppStatus,sgx_disp_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) +IPPFUN(IppStatus, sgx_disp_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsCmp_BN( pA, pB, pResult ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsCmp_BN( pA, pB, pResult ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsCmp_BN( pA, pB, pResult ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) -IPPAPI(IppStatus, h9_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) - -IPPFUN(IppStatus,sgx_disp_ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsCmp_BN( pA, pB, pResult ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsCmp_BN( pA, pB, pResult ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00001.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00001.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESGetSize.c index f8baca34d..d12993d08 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00001.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDESGetSize,(int *size)) -IPPAPI(IppStatus, l9_ippsDESGetSize,(int *size)) IPPAPI(IppStatus, k1_ippsDESGetSize,(int *size)) +IPPAPI(IppStatus, l9_ippsDESGetSize,(int *size)) +IPPAPI(IppStatus, y8_ippsDESGetSize,(int *size)) -IPPFUN(IppStatus,sgx_disp_ippsDESGetSize,(int *size)) +IPPFUN(IppStatus, sgx_disp_ippsDESGetSize,(int *size)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDESGetSize( size ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDESGetSize( size ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDESGetSize( size ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDESGetSize,(int *size)) -IPPAPI(IppStatus, h9_ippsDESGetSize,(int *size)) - -IPPFUN(IppStatus,sgx_disp_ippsDESGetSize,(int *size)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDESGetSize( size ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDESGetSize( size ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00002.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESInit.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00002.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESInit.c index 310861e1b..f59ad337d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00002.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) -IPPAPI(IppStatus, l9_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) IPPAPI(IppStatus, k1_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDESInit( pKey, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDESInit( pKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDESInit( pKey, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) -IPPAPI(IppStatus, h9_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDESInit,(const Ipp8u* pKey, IppsDESSpec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDESInit( pKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDESInit( pKey, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00003.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESPack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00003.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESPack.c index 2545e617a..af93a528c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00003.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESPack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDESPack( pCtx, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDESPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDESPack( pCtx, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsDESPack,(const IppsDESSpec* pCtx, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDESPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDESPack( pCtx, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00004.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESUnpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00004.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESUnpack.c index 704251b9e..3108912ea 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00004.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDESUnpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) -IPPAPI(IppStatus, l9_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) IPPAPI(IppStatus, k1_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) +IPPAPI(IppStatus, l9_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) +IPPAPI(IppStatus, y8_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDESUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDESUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDESUnpack( pBuffer, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) -IPPAPI(IppStatus, h9_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDESUnpack,(const Ipp8u* pBuffer, IppsDESSpec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDESUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDESUnpack( pBuffer, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00319.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLGetResultString.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00319.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLGetResultString.c index da081db12..5b2b988de 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00319.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLGetResultString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const char*, y8_ippsDLGetResultString, (IppDLResult code)) -IPPAPI( const char*, l9_ippsDLGetResultString, (IppDLResult code)) IPPAPI( const char*, k1_ippsDLGetResultString, (IppDLResult code)) +IPPAPI( const char*, l9_ippsDLGetResultString, (IppDLResult code)) +IPPAPI( const char*, y8_ippsDLGetResultString, (IppDLResult code)) -IPPFUN( const char*,sgx_disp_ippsDLGetResultString, (IppDLResult code)) +IPPFUN( const char*, sgx_disp_ippsDLGetResultString, (IppDLResult code)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLGetResultString( code ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLGetResultString( code ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLGetResultString( code ); - } else + } else return NULL; } -#else - -IPPAPI( const char*, p8_ippsDLGetResultString, (IppDLResult code)) -IPPAPI( const char*, h9_ippsDLGetResultString, (IppDLResult code)) - -IPPFUN( const char*,sgx_disp_ippsDLGetResultString, (IppDLResult code)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLGetResultString( code ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLGetResultString( code ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00328.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenKeyPair.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00328.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenKeyPair.c index 05d22d3fc..0236dc3c5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00328.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGenKeyPair( pPrvKey, pPubKey, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGenKeyPair( pPrvKey, pPubKey, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGenKeyPair( pPrvKey, pPubKey, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGenKeyPair,(IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGenKeyPair( pPrvKey, pPubKey, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGenKeyPair( pPrvKey, pPubKey, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00337.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDH.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00337.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDH.c index 800d7b9ca..280050c6c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00337.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDH.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGenerateDH( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGenerateDH( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGenerateDH( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGenerateDH,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGenerateDH( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGenerateDH( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00335.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDSA.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00335.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDSA.c index f92ab6891..388a62974 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00335.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGenerateDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGenerateDSA( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGenerateDSA( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGenerateDSA( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGenerateDSA,(const IppsBigNumState* pSeedIn, int nTrials, IppsDLPState* pCtx, IppsBigNumState* pSeedOut, int* pCounter, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGenerateDSA( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGenerateDSA( pSeedIn, nTrials, pCtx, pSeedOut, pCounter, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00325.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGet.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00325.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGet.c index b0da9c899..d229f584d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00325.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGet( pP, pR, pG, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGet,(IppsBigNumState* pP, IppsBigNumState* pR, IppsBigNumState* pG, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGet( pP, pR, pG, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00327.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetDP.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00327.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetDP.c index ce3b9d6b2..47d52b61a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00327.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetDP.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGetDP( pDP, tag, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGetDP,(IppsBigNumState* pDP, IppDLPKeyTag tag, const IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGetDP( pDP, tag, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00320.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00320.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetSize.c index 8ba6b2592..e67084661 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00320.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) -IPPAPI(IppStatus, l9_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) IPPAPI(IppStatus, k1_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) +IPPAPI(IppStatus, l9_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) +IPPAPI(IppStatus, y8_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPGetSize( bitSizeP, bitSizeR, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPGetSize( bitSizeP, bitSizeR, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPGetSize( bitSizeP, bitSizeR, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) -IPPAPI(IppStatus, h9_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPGetSize,(int bitSizeP, int bitSizeR, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPGetSize( bitSizeP, bitSizeR, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPGetSize( bitSizeP, bitSizeR, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00321.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPInit.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00321.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPInit.c index 5681c8643..a4ac5c06f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00321.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPInit( bitSizeP, bitSizeR, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPInit( bitSizeP, bitSizeR, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPInit( bitSizeP, bitSizeR, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPInit, (int bitSizeP, int bitSizeR, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPInit( bitSizeP, bitSizeR, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPInit( bitSizeP, bitSizeR, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00322.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00322.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPack.c index 29a849be9..4563315c8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00322.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPPack( pCtx, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPPack( pCtx, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPPack,(const IppsDLPState* pCtx, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPPack( pCtx, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPPack( pCtx, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00329.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPublicKey.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00329.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPublicKey.c index c54b51830..632ddbca7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00329.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPPublicKey( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPPublicKey( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPPublicKey( pPrvKey, pPubKey, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPPublicKey, (const IppsBigNumState* pPrvKey, IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPPublicKey( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPPublicKey( pPrvKey, pPubKey, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00324.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSet.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00324.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSet.c index 169c892b5..70d677f4a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00324.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPSet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPSet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPSet( pP, pR, pG, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPSet,(const IppsBigNumState* pP, const IppsBigNumState* pR, const IppsBigNumState* pG, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPSet( pP, pR, pG, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPSet( pP, pR, pG, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00326.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetDP.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00326.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetDP.c index 1b4b7a540..b16f35b2b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00326.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetDP.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPSetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPSetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPSetDP( pDP, tag, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPSetDP,(const IppsBigNumState* pDP, IppDLPKeyTag tag, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPSetDP( pDP, tag, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPSetDP( pDP, tag, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00331.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetKeyPair.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00331.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetKeyPair.c index 092906f6c..b796cbee5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00331.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSetKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPSetKeyPair( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPSetKeyPair( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPSetKeyPair( pPrvKey, pPubKey, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPSetKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPSetKeyPair( pPrvKey, pPubKey, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPSetKeyPair( pPrvKey, pPubKey, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00334.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSharedSecretDH.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00334.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSharedSecretDH.c index fd2d42abf..bb7f28486 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00334.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSharedSecretDH.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPSharedSecretDH( pPrvKeyA, pPubKeyB, pShare, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPSharedSecretDH( pPrvKeyA, pPubKeyB, pShare, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPSharedSecretDH( pPrvKeyA, pPubKeyB, pShare, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPSharedSecretDH,(const IppsBigNumState* pPrvKeyA, const IppsBigNumState* pPubKeyB, IppsBigNumState* pShare, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPSharedSecretDH( pPrvKeyA, pPubKeyB, pShare, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPSharedSecretDH( pPrvKeyA, pPubKeyB, pShare, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00332.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSignDSA.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00332.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSignDSA.c index d31b80875..bb8f99456 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00332.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPSignDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPSignDSA( pMsgDigest, pPrvKey, pSignR, pSignS, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPSignDSA( pMsgDigest, pPrvKey, pSignR, pSignS, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPSignDSA( pMsgDigest, pPrvKey, pSignR, pSignS, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrvKey, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPSignDSA( pMsgDigest, pPrvKey, pSignR, pSignS, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPSignDSA( pMsgDigest, pPrvKey, pSignR, pSignS, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00323.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPUnpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00323.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPUnpack.c index 8bb6a8c97..4e95c4d27 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00323.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPUnpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPUnpack( pBuffer, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPUnpack,(const Ipp8u* pBuffer, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPUnpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPUnpack( pBuffer, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00338.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDH.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00338.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDH.c index 3b58c4313..8bca6e18b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00338.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDH.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPValidateDH( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPValidateDH( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPValidateDH( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateDH,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPValidateDH( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPValidateDH( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00336.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDSA.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00336.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDSA.c index c9914ac42..32ce65a11 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00336.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPValidateDSA( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPValidateDSA( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPValidateDSA( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateDSA,(int nTrials, IppDLResult* pResult, IppsDLPState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPValidateDSA( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPValidateDSA( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00330.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateKeyPair.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00330.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateKeyPair.c index bb0d4547c..370c52b48 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00330.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPValidateKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPValidateKeyPair( pPrvKey, pPubKey, pResult, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPValidateKeyPair( pPrvKey, pPubKey, pResult, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPValidateKeyPair( pPrvKey, pPubKey, pResult, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPValidateKeyPair,(const IppsBigNumState* pPrvKey, const IppsBigNumState* pPubKey, IppDLResult* pResult, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPValidateKeyPair( pPrvKey, pPubKey, pResult, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPValidateKeyPair( pPrvKey, pPubKey, pResult, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00333.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPVerifyDSA.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00333.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPVerifyDSA.c index 8df0f483d..c0805f1c0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00333.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDLPVerifyDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPAPI(IppStatus, l9_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) IPPAPI(IppStatus, k1_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPAPI(IppStatus, l9_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPAPI(IppStatus, y8_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDLPVerifyDSA( pMsgDigest, pSignR, pSignS, pResult, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDLPVerifyDSA( pMsgDigest, pSignR, pSignS, pResult, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDLPVerifyDSA( pMsgDigest, pSignR, pSignS, pResult, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) -IPPAPI(IppStatus, h9_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsDLPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppDLResult* pResult, IppsDLPState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDLPVerifyDSA( pMsgDigest, pSignR, pSignS, pResult, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDLPVerifyDSA( pMsgDigest, pSignR, pSignS, pResult, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00251.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDiv_BN.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00251.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDiv_BN.c index 7108956b2..6e0cea27c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00251.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsDiv_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsDiv_BN( pA, pB, pQ, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsDiv_BN( pA, pB, pQ, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsDiv_BN( pA, pB, pQ, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsDiv_BN( pA, pB, pQ, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsDiv_BN( pA, pB, pQ, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00339.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCGetResultString.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00339.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCGetResultString.c index 0c3fa4464..567085a5d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00339.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCGetResultString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const char*, y8_ippsECCGetResultString, (IppECResult code)) -IPPAPI( const char*, l9_ippsECCGetResultString, (IppECResult code)) IPPAPI( const char*, k1_ippsECCGetResultString, (IppECResult code)) +IPPAPI( const char*, l9_ippsECCGetResultString, (IppECResult code)) +IPPAPI( const char*, y8_ippsECCGetResultString, (IppECResult code)) -IPPFUN( const char*,sgx_disp_ippsECCGetResultString, (IppECResult code)) +IPPFUN( const char*, sgx_disp_ippsECCGetResultString, (IppECResult code)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCGetResultString( code ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCGetResultString( code ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCGetResultString( code ); - } else + } else return NULL; } -#else - -IPPAPI( const char*, p8_ippsECCGetResultString, (IppECResult code)) -IPPAPI( const char*, h9_ippsECCGetResultString, (IppECResult code)) - -IPPFUN( const char*,sgx_disp_ippsECCGetResultString, (IppECResult code)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCGetResultString( code ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCGetResultString( code ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00385.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPAddPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00385.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPAddPoint.c index 88bac81ed..c8e0d5990 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00385.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPAddPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPAddPoint( pP, pQ, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppsECCPPointState* pR, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPAddPoint( pP, pQ, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00368.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd192r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00368.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd192r1.c index 9eed10d44..efb4f2be2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00368.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStd192r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd192r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStd192r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00369.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd224r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00369.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd224r1.c index 59a348ee2..2dcbba9bb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00369.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStd224r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd224r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStd224r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00370.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd256r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00370.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd256r1.c index fc37553ac..aa93559e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00370.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStd256r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd256r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStd256r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00371.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd384r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00371.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd384r1.c index 0dd7d0ff4..6cd0edcce 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00371.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStd384r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd384r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStd384r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00372.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd521r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00372.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd521r1.c index bfbf0c7ad..f7cfd03ac 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00372.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStd521r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStd521r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStd521r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00373.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStdSM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00373.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStdSM2.c index 19afabf8a..2947e5bcf 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00373.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPBindGxyTblStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPBindGxyTblStdSM2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPBindGxyTblStdSM2, (IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPBindGxyTblStdSM2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00382.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPCheckPoint.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00382.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPCheckPoint.c index 648ba3c4a..2ddc31166 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00382.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPCheckPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPCheckPoint( pP, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPCheckPoint( pP, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPCheckPoint( pP, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPCheckPoint,(const IppsECCPPointState* pP, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPCheckPoint( pP, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPCheckPoint( pP, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00383.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPComparePoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00383.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPComparePoint.c index d6b63c4b7..bd3f7e16c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00383.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPComparePoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPComparePoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPComparePoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPComparePoint( pP, pQ, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPComparePoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPComparePoint( pP, pQ, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00387.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGenKeyPair.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00387.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGenKeyPair.c index e5ee2a631..0ef6065e2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00387.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGenKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGenKeyPair( pPrivate, pPublic, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGenKeyPair( pPrivate, pPublic, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGenKeyPair( pPrivate, pPublic, pEC, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGenKeyPair( pPrivate, pPublic, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGenKeyPair( pPrivate, pPublic, pEC, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00374.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGet.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00374.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGet.c index 257b83fc4..6ab76ac17 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00374.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGet,(IppsBigNumState* pPrime, IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGX,IppsBigNumState* pGY,IppsBigNumState* pOrder, int* cofactor, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00375.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetOrderBitSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00375.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetOrderBitSize.c index 935e46cdb..1654880e4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00375.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetOrderBitSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetOrderBitSize( pBitSize, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetOrderBitSize( pBitSize, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetOrderBitSize( pBitSize, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetOrderBitSize,(int* pBitSize, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetOrderBitSize( pBitSize, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetOrderBitSize( pBitSize, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00381.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00381.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetPoint.c index a871f361a..4c0805ba4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00381.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetPoint( pX, pY, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, const IppsECCPPointState* pPoint, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetPoint( pX, pY, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00340.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSize.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00340.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSize.c index 4fb028285..c4f563ba6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00340.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSize,(int feBitSize, int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSize,(int feBitSize, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSize,(int feBitSize, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSize,(int feBitSize, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSize( feBitSize, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSize( feBitSize, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSize,(int feBitSize, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSize,(int feBitSize, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSize( feBitSize, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00341.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00341.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r1.c index 727a0c104..f828805d2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00341.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd128r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd128r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd128r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd128r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd128r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd128r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd128r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd128r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd128r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd128r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd128r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd128r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd128r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd128r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd128r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00342.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00342.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r2.c index 49eecd6b5..7d208acde 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00342.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd128r2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd128r2,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd128r2,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd128r2,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd128r2,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd128r2,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd128r2,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd128r2,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd128r2( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd128r2( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd128r2( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd128r2,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd128r2,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd128r2,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd128r2( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd128r2( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00343.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd192r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00343.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd192r1.c index 84df48b7f..99692f064 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00343.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd192r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd192r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd192r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd192r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd192r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd192r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd192r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd192r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd192r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd192r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd192r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd192r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd192r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd192r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd192r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00344.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd224r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00344.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd224r1.c index 0190ceb38..50d346cb1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00344.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd224r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd224r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd224r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd224r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd224r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd224r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd224r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd224r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd224r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd224r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd224r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd224r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd224r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd224r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd224r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00345.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd256r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00345.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd256r1.c index 3a2a1dd4d..2edeb151f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00345.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd256r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd256r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd256r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd256r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd256r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd256r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd256r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd256r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd256r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd256r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd256r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd256r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd256r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd256r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd256r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00346.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd384r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00346.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd384r1.c index 6517501f8..ef24bf5ae 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00346.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd384r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd384r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd384r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd384r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd384r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd384r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd384r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd384r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd384r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd384r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd384r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd384r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd384r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd384r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd384r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00347.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd521r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00347.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd521r1.c index 9898b1764..9b034c615 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00347.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStd521r1,(int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStd521r1,(int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStd521r1,(int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStd521r1,(int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStd521r1,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd521r1,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStd521r1,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStd521r1( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStd521r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStd521r1( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStd521r1,(int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStd521r1,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStd521r1,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStd521r1( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStd521r1( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00348.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStdSM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00348.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStdSM2.c index a296affa1..5938d68e0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00348.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPGetSizeStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPGetSizeStdSM2, (int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPGetSizeStdSM2, (int* pSize)) IPPAPI(IppStatus, k1_ippsECCPGetSizeStdSM2, (int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPGetSizeStdSM2, (int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPGetSizeStdSM2, (int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStdSM2, (int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPGetSizeStdSM2, (int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPGetSizeStdSM2( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPGetSizeStdSM2( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPGetSizeStdSM2( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPGetSizeStdSM2, (int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPGetSizeStdSM2, (int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPGetSizeStdSM2, (int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPGetSizeStdSM2( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPGetSizeStdSM2( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00349.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInit.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00349.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInit.c index 548bdde79..50a85a15f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00349.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInit( feBitSize, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInit( feBitSize, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInit( feBitSize, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInit,(int feBitSize, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInit( feBitSize, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInit( feBitSize, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00350.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00350.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r1.c index 7cb83651b..dd9febd23 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00350.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd128r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd128r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd128r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd128r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd128r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd128r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd128r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd128r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd128r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd128r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd128r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd128r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd128r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd128r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd128r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00351.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00351.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r2.c index 22ce5dc9c..204628cf2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00351.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd128r2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd128r2,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd128r2,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd128r2,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd128r2,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd128r2,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd128r2,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd128r2,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd128r2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd128r2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd128r2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd128r2,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd128r2,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd128r2,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd128r2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd128r2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00352.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd192r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00352.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd192r1.c index a5f36efab..352b3d4ba 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00352.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd192r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd192r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd192r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd192r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd192r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd192r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd192r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd192r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd192r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00353.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd224r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00353.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd224r1.c index ed9bbfb32..ec39a7406 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00353.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd224r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd224r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd224r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd224r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd224r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd224r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd224r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd224r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd224r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00354.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd256r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00354.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd256r1.c index b1fc30857..4749c1bf3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00354.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd256r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd256r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd256r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd256r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd256r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd256r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd256r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd256r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd256r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00355.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd384r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00355.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd384r1.c index 98838c17e..d4d65ca19 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00355.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd384r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd384r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd384r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd384r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd384r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd384r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd384r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd384r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd384r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00356.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd521r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00356.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd521r1.c index de0ed78ab..913fc907d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00356.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStd521r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStd521r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd521r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStd521r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStd521r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStd521r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStd521r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStd521r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStd521r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00357.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStdSM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00357.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStdSM2.c index 56d7d5452..47b9f70e7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00357.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPInitStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPInitStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPInitStdSM2, (IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPInitStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPInitStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPInitStdSM2, (IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStdSM2, (IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPInitStdSM2, (IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPInitStdSM2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPInitStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPInitStdSM2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPInitStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPInitStdSM2, (IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPInitStdSM2, (IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPInitStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPInitStdSM2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00386.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPMulPointScalar.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00386.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPMulPointScalar.c index 3f35060d0..b808d3f07 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00386.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPMulPointScalar.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPMulPointScalar( pP, pK, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPMulPointScalar( pP, pK, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPMulPointScalar( pP, pK, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, IppsECCPPointState* pR, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPMulPointScalar( pP, pK, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPMulPointScalar( pP, pK, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00384.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPNegativePoint.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00384.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPNegativePoint.c index 25cb0c1a4..dc8eb6100 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00384.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPNegativePoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPNegativePoint( pP, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPNegativePoint( pP, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPNegativePoint( pP, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPNegativePoint,(const IppsECCPPointState* pP, IppsECCPPointState* pR, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPNegativePoint( pP, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPNegativePoint( pP, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00377.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointGetSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00377.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointGetSize.c index f98591adb..58faabca9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00377.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPPointGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, l9_ippsECCPPointGetSize,(int feBitSize, int* pSize)) IPPAPI(IppStatus, k1_ippsECCPPointGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, l9_ippsECCPPointGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, y8_ippsECCPPointGetSize,(int feBitSize, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsECCPPointGetSize,(int feBitSize, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsECCPPointGetSize,(int feBitSize, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPPointGetSize( feBitSize, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPPointGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPPointGetSize( feBitSize, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPPointGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, h9_ippsECCPPointGetSize,(int feBitSize, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPPointGetSize,(int feBitSize, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPPointGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPPointGetSize( feBitSize, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00378.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointInit.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00378.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointInit.c index 32c907176..b4b8b887c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00378.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPointInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) -IPPAPI(IppStatus, l9_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) IPPAPI(IppStatus, k1_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) +IPPAPI(IppStatus, l9_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) +IPPAPI(IppStatus, y8_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) -IPPFUN(IppStatus,sgx_disp_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) +IPPFUN(IppStatus, sgx_disp_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPPointInit( feBitSize, pPoint ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPPointInit( feBitSize, pPoint ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPPointInit( feBitSize, pPoint ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) -IPPAPI(IppStatus, h9_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPPointInit( feBitSize, pPoint ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPPointInit( feBitSize, pPoint ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00388.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPublicKey.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00388.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPublicKey.c index d7c98ff3f..d2e283d80 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00388.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPPublicKey( pPrivate, pPublic, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPPublicKey( pPrivate, pPublic, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPPublicKey( pPrivate, pPublic, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPPublicKey,(const IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPPublicKey( pPrivate, pPublic, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPPublicKey( pPrivate, pPublic, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00358.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSet.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00358.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSet.c index 7bd05a531..2d31a2b57 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00358.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSet,(const IppsBigNumState* pPrime, const IppsBigNumState* pA, const IppsBigNumState* pB, const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, int cofactor, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSet( pPrime, pA, pB, pGX, pGY, pOrder, cofactor, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00390.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetKeyPair.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00390.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetKeyPair.c index abed86072..6241f8bac 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00390.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetKeyPair( pPrivate, pPublic, regular, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetKeyPair( pPrivate, pPublic, regular, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetKeyPair( pPrivate, pPublic, regular, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppBool regular, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetKeyPair( pPrivate, pPublic, regular, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetKeyPair( pPrivate, pPublic, regular, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00379.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00379.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPoint.c index 227530c96..d37c4db38 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00379.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetPoint( pX, pY, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsECCPPointState* pPoint, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetPoint( pX, pY, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00380.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPointAtInfinity.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00380.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPointAtInfinity.c index 3e19a5083..9c90b668e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00380.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetPointAtInfinity.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetPointAtInfinity( pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetPointAtInfinity( pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00359.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00359.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd.c index 8df6e279c..78bd0a916 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00359.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd( flag, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd( flag, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd( flag, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd,(IppECCType flag, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd( flag, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd( flag, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00360.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00360.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r1.c index 1fe36fe41..f7f82db22 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00360.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd128r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd128r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd128r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd128r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd128r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd128r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd128r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd128r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd128r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd128r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd128r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd128r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd128r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd128r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd128r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00361.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00361.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r2.c index 30337bc3d..807596969 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00361.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd128r2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd128r2,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd128r2,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd128r2,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd128r2,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd128r2,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd128r2,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd128r2,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd128r2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd128r2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd128r2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd128r2,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd128r2,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd128r2,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd128r2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd128r2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00362.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd192r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00362.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd192r1.c index 012d8479f..75dccae9d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00362.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd192r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd192r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd192r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd192r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd192r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd192r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd192r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd192r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd192r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd192r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd192r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00363.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd224r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00363.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd224r1.c index a218a820a..77a9c6dc3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00363.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd224r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd224r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd224r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd224r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd224r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd224r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd224r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd224r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd224r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd224r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd224r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00364.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd256r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00364.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd256r1.c index d52c657c8..cb20f02b7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00364.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd256r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd256r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd256r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd256r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd256r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd256r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd256r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd256r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd256r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd256r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd256r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00365.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd384r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00365.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd384r1.c index ab650c853..3e1ce3d96 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00365.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd384r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd384r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd384r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd384r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd384r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd384r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd384r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd384r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd384r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd384r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd384r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00366.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd521r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00366.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd521r1.c index 27336eb20..5354012a0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00366.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStd521r1,(IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStd521r1,(IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStd521r1,(IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd521r1,(IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStd521r1,(IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStd521r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStd521r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStd521r1,(IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStd521r1,(IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStd521r1,(IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStd521r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00367.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStdSM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00367.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStdSM2.c index 0a55b7714..3f2fb608d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00367.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSetStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSetStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSetStdSM2, (IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSetStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSetStdSM2, (IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSetStdSM2, (IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStdSM2, (IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSetStdSM2, (IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSetStdSM2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSetStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSetStdSM2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSetStdSM2, (IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSetStdSM2, (IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSetStdSM2, (IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSetStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSetStdSM2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00391.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDH.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00391.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDH.c index 67f79b632..03fbde341 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00391.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDH.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSharedSecretDH( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSharedSecretDH( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSharedSecretDH( pPrivateA, pPublicB, pShare, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSharedSecretDH( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSharedSecretDH( pPrivateA, pPublicB, pShare, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00392.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDHC.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00392.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDHC.c index a449e0e17..fa1f58c9e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00392.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSharedSecretDHC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsECCPPointState* pPublicB, IppsBigNumState* pShare, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00393.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignDSA.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00393.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignDSA.c index 6d535ba46..392ff1b2d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00393.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSignDSA( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSignDSA( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSignDSA( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSignDSA( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSignDSA( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00395.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignNR.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00395.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignNR.c index 22d49da7c..ccf49a53d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00395.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignNR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSignNR( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSignNR( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSignNR( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pPrivate, IppsBigNumState* pSignX, IppsBigNumState* pSignY, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSignNR( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSignNR( pMsgDigest, pPrivate, pSignX, pSignY, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00397.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignSM2.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00397.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignSM2.c index e3359b307..4cbc6d435 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00397.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPSignSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00376.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidate.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00376.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidate.c index bd5701f73..8b7a2e245 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00376.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPValidate( nTrials, pResult, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPValidate( nTrials, pResult, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPValidate( nTrials, pResult, pEC, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPValidate,(int nTrials, IppECResult* pResult, IppsECCPState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPValidate( nTrials, pResult, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPValidate( nTrials, pResult, pEC, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00389.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidateKeyPair.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00389.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidateKeyPair.c index 25d963a95..c1c1a9380 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00389.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPValidateKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPValidateKeyPair( pPrivate, pPublic, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPValidateKeyPair( pPrivate, pPublic, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPValidateKeyPair( pPrivate, pPublic, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPValidateKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPValidateKeyPair( pPrivate, pPublic, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPValidateKeyPair( pPrivate, pPublic, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00394.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyDSA.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00394.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyDSA.c index ad62521fb..7dfd3824f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00394.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyDSA.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPVerifyDSA( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPVerifyDSA( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPVerifyDSA( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPVerifyDSA( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPVerifyDSA( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00396.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyNR.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00396.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyNR.c index d3ac7f44d..28e316846 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00396.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifyNR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPVerifyNR( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPVerifyNR( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPVerifyNR( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPVerifyNR( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPVerifyNR( pMsgDigest, pSignX, pSignY, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00398.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifySM2.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00398.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifySM2.c index 456054c4c..b3737f9b1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00398.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsECCPVerifySM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, l9_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) IPPAPI(IppStatus, k1_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, l9_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) +IPPAPI(IppStatus, y8_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsECCPVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsECCPVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsECCPVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) -IPPAPI(IppStatus, h9_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsECCPVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsECCPPointState* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsECCPState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsECCPVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsECCPVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00246.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsExtGet_BN.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00246.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsExtGet_BN.c index 967bfcf3b..077294736 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00246.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsExtGet_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsExtGet_BN( pSgn, pBitSize, pData, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsExtGet_BN( pSgn, pBitSize, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsExtGet_BN( pSgn, pBitSize, pData, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsExtGet_BN,(IppsBigNumSGN* pSgn, int* pBitSize, Ipp32u* pData, const IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsExtGet_BN( pSgn, pBitSize, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsExtGet_BN( pSgn, pBitSize, pData, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00441.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00441.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd.c index 76a8a76d3..ceb8efb90 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00441.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpAdd( pA, pB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpAdd( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpAdd( pA, pB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpAdd, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpAdd( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpAdd( pA, pB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00446.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd_PE.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00446.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd_PE.c index 62df5a1c4..3030b3129 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00446.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpAdd_PE.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpAdd_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpAdd_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpAdd_PE( pA, pParentB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpAdd_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpAdd_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpAdd_PE( pA, pParentB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00433.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCmpElement.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00433.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCmpElement.c index 00a6c7e40..aaed7d3c2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00433.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCmpElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpCmpElement( pA, pB, pResult, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpCmpElement( pA, pB, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpCmpElement( pA, pB, pResult, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpCmpElement,(const IppsGFpElement* pA, const IppsGFpElement* pB, int* pResult, const IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpCmpElement( pA, pB, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpCmpElement( pA, pB, pResult, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00436.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpConj.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00436.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpConj.c index af340af93..2b06fc817 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00436.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpConj.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpConj( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpConj( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpConj( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpConj,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpConj( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpConj( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00430.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCpyElement.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00430.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCpyElement.c index eded3fb53..58fdaed25 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00430.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpCpyElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpCpyElement( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpCpyElement( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpCpyElement( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpCpyElement,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpCpyElement( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpCpyElement( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00493.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECAddPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00493.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECAddPoint.c index 570c5113e..ef705415b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00493.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECAddPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECAddPoint( pP, pQ, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECAddPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECAddPoint( pP, pQ, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECAddPoint( pP, pQ, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00463.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd192r1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00463.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd192r1.c index 622dfb6ca..1a2521f0a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00463.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStd192r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd192r1,(IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStd192r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStd192r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00464.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd224r1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00464.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd224r1.c index 73a08ad9e..901bd1d99 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00464.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStd224r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd224r1,(IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStd224r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStd224r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00465.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd256r1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00465.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd256r1.c index 69f0d30c7..68ca27e7b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00465.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStd256r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd256r1,(IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStd256r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStd256r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00466.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd384r1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00466.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd384r1.c index ee3f98c8f..6955f1d2d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00466.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStd384r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd384r1,(IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStd384r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStd384r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00467.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd521r1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00467.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd521r1.c index 9a4cf9089..ef380ce20 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00467.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStd521r1( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStd521r1,(IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStd521r1( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStd521r1( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00468.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStdSM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00468.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStdSM2.c index adeb6404f..234f6431a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00468.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECBindGxyTblStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECBindGxyTblStdSM2( pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECBindGxyTblStdSM2, (IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECBindGxyTblStdSM2( pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECBindGxyTblStdSM2( pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00491.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCmpPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00491.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCmpPoint.c index 13da6cb02..074e85d4f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00491.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCmpPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECCmpPoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECCmpPoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECCmpPoint( pP, pQ, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECCmpPoint,(const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppECResult* pResult, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECCmpPoint( pP, pQ, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECCmpPoint( pP, pQ, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00490.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCpyPoint.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00490.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCpyPoint.c index 8def8247d..3dcd8a898 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00490.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECCpyPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECCpyPoint( pA, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECCpyPoint( pA, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECCpyPoint( pA, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECCpyPoint,(const IppsGFpECPoint* pA, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECCpyPoint( pA, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECCpyPoint( pA, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext.c new file mode 100644 index 000000000..458fac799 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECDecryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsBigNumState *pPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECDecryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsBigNumState *pPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECDecryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsBigNumState *pPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECDecryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsBigNumState *pPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECDecryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPrvKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECDecryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPrvKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECDecryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPrvKey, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext_DecMsgSize.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext_DecMsgSize.c new file mode 100644 index 000000000..f829ebcc1 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECDecryptSM2_Ext_DecMsgSize.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECDecryptSM2_Ext_DecMsgSize, (const IppsGFpECState *pEC, int ctMsgSize, int *pSize)) +IPPAPI(IppStatus, l9_ippsGFpECDecryptSM2_Ext_DecMsgSize, (const IppsGFpECState *pEC, int ctMsgSize, int *pSize)) +IPPAPI(IppStatus, y8_ippsGFpECDecryptSM2_Ext_DecMsgSize, (const IppsGFpECState *pEC, int ctMsgSize, int *pSize)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECDecryptSM2_Ext_DecMsgSize, (const IppsGFpECState *pEC, int ctMsgSize, int *pSize)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECDecryptSM2_Ext_DecMsgSize( pEC, ctMsgSize, pSize ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECDecryptSM2_Ext_DecMsgSize( pEC, ctMsgSize, pSize ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECDecryptSM2_Ext_DecMsgSize( pEC, ctMsgSize, pSize ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00512.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESDecrypt_SM2.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00512.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESDecrypt_SM2.c index c2f020f6f..959c9a54f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00512.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESDecrypt_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, l9_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) IPPAPI(IppStatus, k1_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, l9_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, y8_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESDecrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESDecrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESDecrypt_SM2( pInput, pOutput, dataLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, h9_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESDecrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESDecrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESDecrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00511.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESEncrypt_SM2.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00511.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESEncrypt_SM2.c index 675e2b0c7..9028ef9de 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00511.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESEncrypt_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, l9_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) IPPAPI(IppStatus, k1_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, l9_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, y8_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESEncrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESEncrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESEncrypt_SM2( pInput, pOutput, dataLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, h9_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESEncrypt_SM2, (const Ipp8u* pInput, Ipp8u* pOutput, int dataLen, IppsECESState_SM2* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESEncrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESEncrypt_SM2( pInput, pOutput, dataLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00513.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESFinal_SM2.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00513.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESFinal_SM2.c index afa1f8581..9584682a8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00513.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESFinal_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, l9_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) IPPAPI(IppStatus, k1_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, l9_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) +IPPAPI(IppStatus, y8_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESFinal_SM2( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESFinal_SM2( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESFinal_SM2( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) -IPPAPI(IppStatus, h9_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESFinal_SM2, (Ipp8u* pTag, int tagLen, IppsECESState_SM2* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESFinal_SM2( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESFinal_SM2( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00514.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetBuffersSize_SM2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00514.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetBuffersSize_SM2.c index fd43139f1..f03e2edfc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00514.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetBuffersSize_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) -IPPAPI(IppStatus, l9_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) IPPAPI(IppStatus, k1_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) +IPPAPI(IppStatus, l9_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) +IPPAPI(IppStatus, y8_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESGetBuffersSize_SM2( pPublicKeySize, pMaximumTagSize, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESGetBuffersSize_SM2( pPublicKeySize, pMaximumTagSize, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESGetBuffersSize_SM2( pPublicKeySize, pMaximumTagSize, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) -IPPAPI(IppStatus, h9_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESGetBuffersSize_SM2, (int* pPublicKeySize, int* pMaximumTagSize, const IppsECESState_SM2* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESGetBuffersSize_SM2( pPublicKeySize, pMaximumTagSize, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESGetBuffersSize_SM2( pPublicKeySize, pMaximumTagSize, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00507.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetSize_SM2.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00507.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetSize_SM2.c index 1b9922ced..5b81053a6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00507.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESGetSize_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) -IPPAPI(IppStatus, l9_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) IPPAPI(IppStatus, k1_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESGetSize_SM2( pEC, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESGetSize_SM2( pEC, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESGetSize_SM2( pEC, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) -IPPAPI(IppStatus, h9_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESGetSize_SM2, (const IppsGFpECState* pEC, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESGetSize_SM2( pEC, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESGetSize_SM2( pEC, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00508.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESInit_SM2.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00508.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESInit_SM2.c index 8ea7b4636..47406068b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00508.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESInit_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) -IPPAPI(IppStatus, l9_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) IPPAPI(IppStatus, k1_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) +IPPAPI(IppStatus, l9_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) +IPPAPI(IppStatus, y8_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESInit_SM2( pEC, pState, avaliableCtxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESInit_SM2( pEC, pState, avaliableCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESInit_SM2( pEC, pState, avaliableCtxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) -IPPAPI(IppStatus, h9_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESInit_SM2, (IppsGFpECState* pEC, IppsECESState_SM2* pState, int avaliableCtxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESInit_SM2( pEC, pState, avaliableCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESInit_SM2( pEC, pState, avaliableCtxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00509.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESSetKey_SM2.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00509.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESSetKey_SM2.c index de901594c..d3d47848e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00509.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESSetKey_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESSetKey_SM2( pPrivate, pPublic, pState, pEC, pEcScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESSetKey_SM2( pPrivate, pPublic, pState, pEC, pEcScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESSetKey_SM2( pPrivate, pPublic, pState, pEC, pEcScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESSetKey_SM2, (const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppsECESState_SM2* pState, IppsGFpECState* pEC, Ipp8u* pEcScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESSetKey_SM2( pPrivate, pPublic, pState, pEC, pEcScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESSetKey_SM2( pPrivate, pPublic, pState, pEC, pEcScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00510.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESStart_SM2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00510.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESStart_SM2.c index 502dd6a9c..8fdb22f3d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00510.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECESStart_SM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) -IPPAPI(IppStatus, l9_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) IPPAPI(IppStatus, k1_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) +IPPAPI(IppStatus, l9_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) +IPPAPI(IppStatus, y8_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECESStart_SM2( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECESStart_SM2( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECESStart_SM2( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) -IPPAPI(IppStatus, h9_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECESStart_SM2, (IppsECESState_SM2* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECESStart_SM2( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECESStart_SM2( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext.c new file mode 100644 index 000000000..547c2e9a5 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECEncryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsGFpECPoint *pPublicKey, IppsGFpECPoint *pEhpPublicKey, IppsBigNumState *pEphPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECEncryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsGFpECPoint *pPublicKey, IppsGFpECPoint *pEhpPublicKey, IppsBigNumState *pEphPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECEncryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsGFpECPoint *pPublicKey, IppsGFpECPoint *pEhpPublicKey, IppsBigNumState *pEphPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECEncryptSM2_Ext, (Ipp8u *pOut, int maxOutLen, int *pOutSize, const Ipp8u *pInp, int inpLen, const IppsGFpECPoint *pPublicKey, IppsGFpECPoint *pEhpPublicKey, IppsBigNumState *pEphPrvKey, IppsGFpECState *pEC, Ipp8u *pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECEncryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPublicKey, pEhpPublicKey, pEphPrvKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECEncryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPublicKey, pEhpPublicKey, pEphPrvKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECEncryptSM2_Ext( pOut, maxOutLen, pOutSize, pInp, inpLen, pPublicKey, pEhpPublicKey, pEphPrvKey, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext_EncMsgSize.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext_EncMsgSize.c new file mode 100644 index 000000000..bf3d8dba1 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECEncryptSM2_Ext_EncMsgSize.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECEncryptSM2_Ext_EncMsgSize, (const IppsGFpECState *pEC, int ptMsgSize, int *pSize)) +IPPAPI(IppStatus, l9_ippsGFpECEncryptSM2_Ext_EncMsgSize, (const IppsGFpECState *pEC, int ptMsgSize, int *pSize)) +IPPAPI(IppStatus, y8_ippsGFpECEncryptSM2_Ext_EncMsgSize, (const IppsGFpECState *pEC, int ptMsgSize, int *pSize)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECEncryptSM2_Ext_EncMsgSize, (const IppsGFpECState *pEC, int ptMsgSize, int *pSize)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECEncryptSM2_Ext_EncMsgSize( pEC, ptMsgSize, pSize ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECEncryptSM2_Ext_EncMsgSize( pEC, ptMsgSize, pSize ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECEncryptSM2_Ext_EncMsgSize( pEC, ptMsgSize, pSize ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00469.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGet.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00469.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGet.c index e506a1d47..406f7255c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00469.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGet( ppGFp, pA, pB, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGet( ppGFp, pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGet( ppGFp, pA, pB, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGet,(IppsGFpState** const ppGFp, IppsGFpElement* pA, IppsGFpElement* pB, const IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGet( ppGFp, pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGet( ppGFp, pA, pB, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00506.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetInfo_GF.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00506.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetInfo_GF.c index 64fd3414d..be189da32 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00506.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetInfo_GF.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetInfo_GF( pInfo, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetInfo_GF( pInfo, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetInfo_GF( pInfo, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetInfo_GF,(IppsGFpInfo* pInfo, const IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetInfo_GF( pInfo, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetInfo_GF( pInfo, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00484.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00484.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPoint.c index 5e8ce3cee..c3f5dfd4c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00484.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetPoint( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetPoint( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetPoint( pPoint, pX, pY, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPoint,(const IppsGFpECPoint* pPoint, IppsGFpElement* pX, IppsGFpElement* pY, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetPoint( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetPoint( pPoint, pX, pY, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00487.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointOctString.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00487.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointOctString.c index 9c4b010aa..e5ffb8505 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00487.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointOctString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetPointOctString( pPoint, pStr, strLen, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetPointOctString( pPoint, pStr, strLen, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetPointOctString( pPoint, pStr, strLen, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPointOctString,(const IppsGFpECPoint* pPoint, Ipp8u* pStr, int strLen, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetPointOctString( pPoint, pStr, strLen, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetPointOctString( pPoint, pStr, strLen, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00485.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointRegular.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00485.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointRegular.c index fe88faea6..7645e5e5d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00485.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetPointRegular.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetPointRegular( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetPointRegular( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetPointRegular( pPoint, pX, pY, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetPointRegular,(const IppsGFpECPoint* pPoint, IppsBigNumState* pX, IppsBigNumState* pY, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetPointRegular( pPoint, pX, pY, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetPointRegular( pPoint, pX, pY, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00450.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00450.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSize.c index 9852c43f4..69ed99f88 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00450.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) -IPPAPI(IppStatus, l9_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) IPPAPI(IppStatus, k1_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetSize( pGFp, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetSize( pGFp, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetSize( pGFp, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) -IPPAPI(IppStatus, h9_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetSize,(const IppsGFpState* pGFp, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetSize( pGFp, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetSize( pGFp, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00470.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSubgroup.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00470.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSubgroup.c index 595895ea8..4bb0ee2e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00470.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECGetSubgroup.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECGetSubgroup( ppGFp, pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECGetSubgroup( ppGFp, pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECGetSubgroup( ppGFp, pX, pY, pOrder, pCofactor, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECGetSubgroup,(IppsGFpState** const ppGFp, IppsGFpElement* pX, IppsGFpElement* pY, IppsBigNumState* pOrder,IppsBigNumState* pCofactor, const IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECGetSubgroup( ppGFp, pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECGetSubgroup( ppGFp, pX, pY, pOrder, pCofactor, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00451.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInit.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00451.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInit.c index 003465970..d582ce813 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00451.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInit( pGFp, pA, pB, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInit( pGFp, pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInit( pGFp, pA, pB, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInit, (const IppsGFpState* pGFp, const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInit( pGFp, pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInit( pGFp, pA, pB, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00454.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00454.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r1.c index 7cf228e3f..92167daab 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00454.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd128r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd128r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd128r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd128r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd128r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd128r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00455.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r2.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00455.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r2.c index dbac72f62..16ee7450a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00455.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd128r2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd128r2( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd128r2( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd128r2( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd128r2,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd128r2( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd128r2( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00456.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd192r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00456.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd192r1.c index 0c2c01d70..1989171f3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00456.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd192r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd192r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd192r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd192r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd192r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd192r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00457.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd224r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00457.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd224r1.c index e08a9a2f3..82059508c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00457.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd224r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd224r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd224r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd224r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd224r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd224r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00458.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd256r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00458.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd256r1.c index 9ba571045..585a9019e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00458.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd256r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd256r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd256r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd256r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd256r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd256r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00459.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd384r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00459.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd384r1.c index ad0f2f89f..376bda965 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00459.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd384r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd384r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd384r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd384r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd384r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd384r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00460.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd521r1.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00460.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd521r1.c index 98da42912..2d64a508e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00460.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStd521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStd521r1( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStd521r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStd521r1( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStd521r1,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStd521r1( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStd521r1( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00462.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdBN256.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00462.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdBN256.c index 0960b220e..b8b83ff82 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00462.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdBN256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStdBN256( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStdBN256( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStdBN256( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStdBN256,(const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStdBN256( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStdBN256( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00461.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdSM2.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00461.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdSM2.c index 0bf42c534..53de49dd5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00461.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECInitStdSM2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECInitStdSM2( pGFp, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECInitStdSM2( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECInitStdSM2( pGFp, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECInitStdSM2, (const IppsGFpState* pGFp, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECInitStdSM2( pGFp, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECInitStdSM2( pGFp, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Confirm.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Confirm.c new file mode 100644 index 000000000..f57b8d3d6 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Confirm.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECKeyExchangeSM2_Confirm, (const Ipp8u pSPeer[IPP_SM3_DIGEST_BYTESIZE], int* pStatus, IppsGFpECKeyExchangeSM2State* pKE)) +IPPAPI(IppStatus, l9_ippsGFpECKeyExchangeSM2_Confirm, (const Ipp8u pSPeer[IPP_SM3_DIGEST_BYTESIZE], int* pStatus, IppsGFpECKeyExchangeSM2State* pKE)) +IPPAPI(IppStatus, y8_ippsGFpECKeyExchangeSM2_Confirm, (const Ipp8u pSPeer[IPP_SM3_DIGEST_BYTESIZE], int* pStatus, IppsGFpECKeyExchangeSM2State* pKE)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECKeyExchangeSM2_Confirm, (const Ipp8u pSPeer[IPP_SM3_DIGEST_BYTESIZE], int* pStatus, IppsGFpECKeyExchangeSM2State* pKE)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECKeyExchangeSM2_Confirm( pSPeer, pStatus, pKE ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECKeyExchangeSM2_Confirm( pSPeer, pStatus, pKE ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECKeyExchangeSM2_Confirm( pSPeer, pStatus, pKE ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_GetSize.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_GetSize.c new file mode 100644 index 000000000..2889695dd --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_GetSize.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECKeyExchangeSM2_GetSize, (const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpECKeyExchangeSM2_GetSize, (const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpECKeyExchangeSM2_GetSize, (const IppsGFpECState* pEC, int* pSize)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECKeyExchangeSM2_GetSize, (const IppsGFpECState* pEC, int* pSize)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECKeyExchangeSM2_GetSize( pEC, pSize ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECKeyExchangeSM2_GetSize( pEC, pSize ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECKeyExchangeSM2_GetSize( pEC, pSize ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Init.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Init.c new file mode 100644 index 000000000..3d10f9e57 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Init.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECKeyExchangeSM2_Init, (IppsGFpECKeyExchangeSM2State* pKE, IppsKeyExchangeRoleSM2 role, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECKeyExchangeSM2_Init, (IppsGFpECKeyExchangeSM2State* pKE, IppsKeyExchangeRoleSM2 role, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECKeyExchangeSM2_Init, (IppsGFpECKeyExchangeSM2State* pKE, IppsKeyExchangeRoleSM2 role, IppsGFpECState* pEC)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECKeyExchangeSM2_Init, (IppsGFpECKeyExchangeSM2State* pKE, IppsKeyExchangeRoleSM2 role, IppsGFpECState* pEC)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECKeyExchangeSM2_Init( pKE, role, pEC ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECKeyExchangeSM2_Init( pKE, role, pEC ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECKeyExchangeSM2_Init( pKE, role, pEC ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Setup.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Setup.c new file mode 100644 index 000000000..4882b99d0 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_Setup.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECKeyExchangeSM2_Setup, (const Ipp8u pZSelf[IPP_SM3_DIGEST_BYTESIZE], const Ipp8u pZPeer[IPP_SM3_DIGEST_BYTESIZE], const IppsGFpECPoint *pPublicKeySelf, const IppsGFpECPoint *pPublicKeyPeer, const IppsGFpECPoint *pEphPublicKeySelf, const IppsGFpECPoint *pEphPublicKeyPeer, IppsGFpECKeyExchangeSM2State *pKE)) +IPPAPI(IppStatus, l9_ippsGFpECKeyExchangeSM2_Setup, (const Ipp8u pZSelf[IPP_SM3_DIGEST_BYTESIZE], const Ipp8u pZPeer[IPP_SM3_DIGEST_BYTESIZE], const IppsGFpECPoint *pPublicKeySelf, const IppsGFpECPoint *pPublicKeyPeer, const IppsGFpECPoint *pEphPublicKeySelf, const IppsGFpECPoint *pEphPublicKeyPeer, IppsGFpECKeyExchangeSM2State *pKE)) +IPPAPI(IppStatus, y8_ippsGFpECKeyExchangeSM2_Setup, (const Ipp8u pZSelf[IPP_SM3_DIGEST_BYTESIZE], const Ipp8u pZPeer[IPP_SM3_DIGEST_BYTESIZE], const IppsGFpECPoint *pPublicKeySelf, const IppsGFpECPoint *pPublicKeyPeer, const IppsGFpECPoint *pEphPublicKeySelf, const IppsGFpECPoint *pEphPublicKeyPeer, IppsGFpECKeyExchangeSM2State *pKE)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECKeyExchangeSM2_Setup, (const Ipp8u pZSelf[IPP_SM3_DIGEST_BYTESIZE], const Ipp8u pZPeer[IPP_SM3_DIGEST_BYTESIZE], const IppsGFpECPoint *pPublicKeySelf, const IppsGFpECPoint *pPublicKeyPeer, const IppsGFpECPoint *pEphPublicKeySelf, const IppsGFpECPoint *pEphPublicKeyPeer, IppsGFpECKeyExchangeSM2State *pKE)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECKeyExchangeSM2_Setup( pZSelf, pZPeer, pPublicKeySelf, pPublicKeyPeer, pEphPublicKeySelf, pEphPublicKeyPeer, pKE ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECKeyExchangeSM2_Setup( pZSelf, pZPeer, pPublicKeySelf, pPublicKeyPeer, pEphPublicKeySelf, pEphPublicKeyPeer, pKE ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECKeyExchangeSM2_Setup( pZSelf, pZPeer, pPublicKeySelf, pPublicKeyPeer, pEphPublicKeySelf, pEphPublicKeyPeer, pKE ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_SharedKey.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_SharedKey.c new file mode 100644 index 000000000..1f36a272d --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECKeyExchangeSM2_SharedKey.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECKeyExchangeSM2_SharedKey, (Ipp8u* pSharedKey, int sharedKeySize, Ipp8u* pSSelf, const IppsBigNumState* pPrvKey, IppsBigNumState* pEphPrvKey, IppsGFpECKeyExchangeSM2State *pKE, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECKeyExchangeSM2_SharedKey, (Ipp8u* pSharedKey, int sharedKeySize, Ipp8u* pSSelf, const IppsBigNumState* pPrvKey, IppsBigNumState* pEphPrvKey, IppsGFpECKeyExchangeSM2State *pKE, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECKeyExchangeSM2_SharedKey, (Ipp8u* pSharedKey, int sharedKeySize, Ipp8u* pSSelf, const IppsBigNumState* pPrvKey, IppsBigNumState* pEphPrvKey, IppsGFpECKeyExchangeSM2State *pKE, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECKeyExchangeSM2_SharedKey, (Ipp8u* pSharedKey, int sharedKeySize, Ipp8u* pSSelf, const IppsBigNumState* pPrvKey, IppsBigNumState* pEphPrvKey, IppsGFpECKeyExchangeSM2State *pKE, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECKeyExchangeSM2_SharedKey( pSharedKey, sharedKeySize, pSSelf, pPrvKey, pEphPrvKey, pKE, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECKeyExchangeSM2_SharedKey( pSharedKey, sharedKeySize, pSSelf, pPrvKey, pEphPrvKey, pKE, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECKeyExchangeSM2_SharedKey( pSharedKey, sharedKeySize, pSSelf, pPrvKey, pEphPrvKey, pKE, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00479.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMakePoint.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00479.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMakePoint.c index 89ead03d7..5e6a0c18a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00479.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMakePoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECMakePoint( pX, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECMakePoint( pX, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECMakePoint( pX, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECMakePoint,(const IppsGFpElement* pX, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECMakePoint( pX, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECMakePoint( pX, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMessageRepresentationSM2.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMessageRepresentationSM2.c new file mode 100644 index 000000000..d98a2038d --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMessageRepresentationSM2.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECMessageRepresentationSM2, (IppsBigNumState* pMsgDigest, const Ipp8u* pMsg, int msgLen, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pRegPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECMessageRepresentationSM2, (IppsBigNumState* pMsgDigest, const Ipp8u* pMsg, int msgLen, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pRegPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECMessageRepresentationSM2, (IppsBigNumState* pMsgDigest, const Ipp8u* pMsg, int msgLen, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pRegPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECMessageRepresentationSM2, (IppsBigNumState* pMsgDigest, const Ipp8u* pMsg, int msgLen, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pRegPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECMessageRepresentationSM2( pMsgDigest, pMsg, msgLen, pUserID, userIDLen, pRegPublic, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECMessageRepresentationSM2( pMsgDigest, pMsg, msgLen, pUserID, userIDLen, pRegPublic, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECMessageRepresentationSM2( pMsgDigest, pMsg, msgLen, pUserID, userIDLen, pRegPublic, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00494.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMulPoint.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00494.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMulPoint.c index aaf601c8f..aa30dbf33 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00494.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECMulPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECMulPoint( pP, pN, pR, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECMulPoint( pP, pN, pR, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECMulPoint( pP, pN, pR, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECMulPoint,(const IppsGFpECPoint* pP, const IppsBigNumState* pN, IppsGFpECPoint* pR, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECMulPoint( pP, pN, pR, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECMulPoint( pP, pN, pR, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00492.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECNegPoint.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00492.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECNegPoint.c index dcd972e53..fdbea9b24 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00492.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECNegPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECNegPoint( pP, pR, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECNegPoint( pP, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECNegPoint( pP, pR, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECNegPoint,(const IppsGFpECPoint* pP, IppsGFpECPoint* pR, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECNegPoint( pP, pR, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECNegPoint( pP, pR, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00473.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointGetSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00473.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointGetSize.c index 56e5c0eba..bdbdd0e32 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00473.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) -IPPAPI(IppStatus, l9_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) IPPAPI(IppStatus, k1_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECPointGetSize( pEC, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECPointGetSize( pEC, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECPointGetSize( pEC, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) -IPPAPI(IppStatus, h9_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECPointGetSize,(const IppsGFpECState* pEC, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECPointGetSize( pEC, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECPointGetSize( pEC, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00474.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointInit.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00474.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointInit.c index 53d7b0f53..1c5495930 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00474.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPointInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECPointInit( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECPointInit( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECPointInit( pX, pY, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECPointInit, (const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECPointInit( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECPointInit( pX, pY, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00495.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPrivateKey.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00495.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPrivateKey.c index e94f9c75a..8140f4bb4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00495.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPrivateKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECPrivateKey( pPrivate, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECPrivateKey( pPrivate, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECPrivateKey( pPrivate, pEC, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECPrivateKey,(IppsBigNumState* pPrivate, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECPrivateKey( pPrivate, pEC, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECPrivateKey( pPrivate, pEC, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00496.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPublicKey.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00496.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPublicKey.c index 92a59fc24..b0e851568 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00496.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECPublicKey( pPrivate, pPublic, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECPublicKey( pPrivate, pPublic, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECPublicKey( pPrivate, pPublic, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECPublicKey,(const IppsBigNumState* pPrivate, IppsGFpECPoint* pPublic, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECPublicKey( pPrivate, pPublic, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECPublicKey( pPrivate, pPublic, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00471.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECScratchBufferSize.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00471.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECScratchBufferSize.c index af64a48f5..25e21b076 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00471.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECScratchBufferSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) -IPPAPI(IppStatus, l9_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) IPPAPI(IppStatus, k1_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) +IPPAPI(IppStatus, l9_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) +IPPAPI(IppStatus, y8_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECScratchBufferSize( nScalars, pEC, pBufferSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECScratchBufferSize( nScalars, pEC, pBufferSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECScratchBufferSize( nScalars, pEC, pBufferSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) -IPPAPI(IppStatus, h9_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECScratchBufferSize,(int nScalars, const IppsGFpECState* pEC, int* pBufferSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECScratchBufferSize( nScalars, pEC, pBufferSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECScratchBufferSize( nScalars, pEC, pBufferSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00452.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSet.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00452.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSet.c index 3be6b5a14..6e6961b04 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00452.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSet( pA, pB, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSet( pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSet( pA, pB, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSet,(const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSet( pA, pB, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSet( pA, pB, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00476.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPoint.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00476.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPoint.c index 5afda40bc..1680a601b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00476.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPoint( pX, pY, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPoint,(const IppsGFpElement* pX, const IppsGFpElement* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPoint( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPoint( pX, pY, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00475.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointAtInfinity.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00475.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointAtInfinity.c index 4f46f4926..6b198143a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00475.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointAtInfinity.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointAtInfinity( pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointAtInfinity,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointAtInfinity( pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointAtInfinity( pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00480.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00480.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash.c index 97e6a93c6..f6a8948ec 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00480.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointHash( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointHash( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointHash( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHash,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointHash( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointHash( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00481.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00481.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible.c index 8041e2564..4ace24968 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00481.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointHashBackCompatible( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointHashBackCompatible( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointHashBackCompatible( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHashBackCompatible,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppHashAlgId hashID, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointHashBackCompatible( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointHashBackCompatible( hdr, pMsg, msgLen, pPoint, pEC, hashID, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00483.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible_rmf.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00483.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible_rmf.c index ea1c754e4..59973e41a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00483.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHashBackCompatible_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointHashBackCompatible_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointHashBackCompatible_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointHashBackCompatible_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHashBackCompatible_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointHashBackCompatible_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointHashBackCompatible_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00482.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash_rmf.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00482.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash_rmf.c index 596f91203..654156148 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00482.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointHash_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointHash_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointHash_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointHash_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointHash_rmf,(Ipp32u hdr, const Ipp8u* pMsg, int msgLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC, const IppsHashMethod* pMethod, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointHash_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointHash_rmf( hdr, pMsg, msgLen, pPoint, pEC, pMethod, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00486.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointOctString.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00486.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointOctString.c index 264f5f537..d64f9e4f7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00486.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointOctString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointOctString( pStr, strLen, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointOctString( pStr, strLen, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointOctString( pStr, strLen, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointOctString,(const Ipp8u* pStr, int strLen, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointOctString( pStr, strLen, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointOctString( pStr, strLen, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00478.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRandom.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00478.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRandom.c index 6bcdb99bf..5c6b7b891 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00478.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRandom.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointRandom( pPoint, pEC, rndFunc, pRndParam, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointRandom( pPoint, pEC, rndFunc, pRndParam, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointRandom( pPoint, pEC, rndFunc, pRndParam, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointRandom,(IppsGFpECPoint* pPoint, IppsGFpECState* pEC, IppBitSupplier rndFunc, void* pRndParam, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointRandom( pPoint, pEC, rndFunc, pRndParam, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointRandom( pPoint, pEC, rndFunc, pRndParam, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00477.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRegular.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00477.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRegular.c index 7d55b17f7..3f6fbbcf4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00477.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetPointRegular.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetPointRegular( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetPointRegular( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetPointRegular( pX, pY, pPoint, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetPointRegular,(const IppsBigNumState* pX, const IppsBigNumState* pY, IppsGFpECPoint* pPoint, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetPointRegular( pX, pY, pPoint, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetPointRegular( pX, pY, pPoint, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00453.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetSubgroup.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00453.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetSubgroup.c index 770cac9b9..dea90103d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00453.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSetSubgroup.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSetSubgroup( pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSetSubgroup( pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSetSubgroup( pX, pY, pOrder, pCofactor, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSetSubgroup,(const IppsGFpElement* pX, const IppsGFpElement* pY, const IppsBigNumState* pOrder, const IppsBigNumState* pCofactor, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSetSubgroup( pX, pY, pOrder, pCofactor, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSetSubgroup( pX, pY, pOrder, pCofactor, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00498.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDH.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00498.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDH.c index f1f184c2d..bc645bea4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00498.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDH.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSharedSecretDH( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSharedSecretDH( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSharedSecretDH( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSharedSecretDH,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSharedSecretDH( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSharedSecretDH( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00499.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDHC.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00499.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDHC.c index e33ee2597..318ca5706 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00499.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSharedSecretDHC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSharedSecretDHC,(const IppsBigNumState* pPrivateA, const IppsGFpECPoint* pPublicB, IppsBigNumState* pShare, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSharedSecretDHC( pPrivateA, pPublicB, pShare, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignDSA.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignDSA.c new file mode 100644 index 000000000..e4228f723 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignDSA.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECSignDSA, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignNR.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignNR.c new file mode 100644 index 000000000..d03150332 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignNR.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECSignNR, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSignNR, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSignNR, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECSignNR, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignSM2.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignSM2.c new file mode 100644 index 000000000..c2bc626ab --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECSignSM2.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECSignSM2, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECSignSM2, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECSignSM2, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECSignSM2, (const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00497.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstKeyPair.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00497.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstKeyPair.c index 8b671aa1e..5c86a9cdd 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00497.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstKeyPair.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECTstKeyPair( pPrivate, pPublic, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECTstKeyPair( pPrivate, pPublic, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECTstKeyPair( pPrivate, pPublic, pResult, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstKeyPair,(const IppsBigNumState* pPrivate, const IppsGFpECPoint* pPublic, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECTstKeyPair( pPrivate, pPublic, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECTstKeyPair( pPrivate, pPublic, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00488.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPoint.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00488.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPoint.c index 524a4f02e..1ae5e0d5b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00488.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPoint.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) -IPPAPI(IppStatus, l9_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) IPPAPI(IppStatus, k1_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) +IPPAPI(IppStatus, l9_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) +IPPAPI(IppStatus, y8_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECTstPoint( pP, pResult, pEC ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECTstPoint( pP, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECTstPoint( pP, pResult, pEC ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) -IPPAPI(IppStatus, h9_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstPoint,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECTstPoint( pP, pResult, pEC ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECTstPoint( pP, pResult, pEC ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00489.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPointInSubgroup.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00489.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPointInSubgroup.c index 95dd530de..f95328d3e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00489.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECTstPointInSubgroup.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECTstPointInSubgroup( pP, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECTstPointInSubgroup( pP, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECTstPointInSubgroup( pP, pResult, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECTstPointInSubgroup,(const IppsGFpECPoint* pP, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECTstPointInSubgroup( pP, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECTstPointInSubgroup( pP, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECUserIDHashSM2.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECUserIDHashSM2.c new file mode 100644 index 000000000..96ad52269 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECUserIDHashSM2.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECUserIDHashSM2, (Ipp8u* pZaDigest, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pPublicKey, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECUserIDHashSM2, (Ipp8u* pZaDigest, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pPublicKey, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECUserIDHashSM2, (Ipp8u* pZaDigest, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pPublicKey, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECUserIDHashSM2, (Ipp8u* pZaDigest, const Ipp8u* pUserID, int userIDLen, const IppsGFpECPoint* pPublicKey, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECUserIDHashSM2( pZaDigest, pUserID, userIDLen, pPublicKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECUserIDHashSM2( pZaDigest, pUserID, userIDLen, pPublicKey, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECUserIDHashSM2( pZaDigest, pUserID, userIDLen, pPublicKey, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00472.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerify.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00472.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerify.c index c441f18bf..1c295152c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00472.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerify.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpECVerify( pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpECVerify( pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpECVerify( pResult, pEC, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerify,(IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECVerify( pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECVerify( pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyDSA.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyDSA.c new file mode 100644 index 000000000..1ce8d5b44 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyDSA.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECVerifyDSA, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECVerifyDSA, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECVerifyDSA, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECVerifyDSA, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyNR.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyNR.c new file mode 100644 index 000000000..cd26ad18c --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifyNR.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECVerifyNR, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECVerifyNR, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECVerifyNR, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECVerifyNR, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifySM2.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifySM2.c new file mode 100644 index 000000000..7bc0126a0 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpECVerifySM2.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI(IppStatus, k1_ippsGFpECVerifySM2, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpECVerifySM2, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpECVerifySM2, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) + +IPPFUN(IppStatus, sgx_disp_ippsGFpECVerifySM2, (const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00422.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementGetSize.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00422.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementGetSize.c index ab9e50d17..7b39871b9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00422.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) -IPPAPI(IppStatus, l9_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) IPPAPI(IppStatus, k1_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) +IPPAPI(IppStatus, l9_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) +IPPAPI(IppStatus, y8_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpElementGetSize( pGFp, pElementSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpElementGetSize( pGFp, pElementSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpElementGetSize( pGFp, pElementSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) -IPPAPI(IppStatus, h9_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpElementGetSize,(const IppsGFpState* pGFp, int* pElementSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpElementGetSize( pGFp, pElementSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpElementGetSize( pGFp, pElementSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00423.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00423.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementInit.c index ff948a1e4..0669cb1ad 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00423.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpElementInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpElementInit( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpElementInit( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpElementInit( pA, lenA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpElementInit, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpElementInit( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpElementInit( pA, lenA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00444.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpExp.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00444.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpExp.c index 17c412837..e628e90f0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00444.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpExp.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpExp( pA, pE, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpExp( pA, pE, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpExp( pA, pE, pR, pGFp, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpExp, (const IppsGFpElement* pA, const IppsBigNumState* pE, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpExp( pA, pE, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpExp( pA, pE, pR, pGFp, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00431.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElement.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00431.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElement.c index 78cbf94c8..90b984acd 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00431.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpGetElement( pA, pDataA, lenA, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpGetElement( pA, pDataA, lenA, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpGetElement( pA, pDataA, lenA, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpGetElement,(const IppsGFpElement* pA, Ipp32u* pDataA, int lenA, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpGetElement( pA, pDataA, lenA, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpGetElement( pA, pDataA, lenA, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00432.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElementOctString.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00432.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElementOctString.c index 9f2b1a17d..66a24ab87 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00432.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetElementOctString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpGetElementOctString( pA, pStr, strSize, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpGetElementOctString( pA, pStr, strSize, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpGetElementOctString( pA, pStr, strSize, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpGetElementOctString,(const IppsGFpElement* pA, Ipp8u* pStr, int strSize, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpGetElementOctString( pA, pStr, strSize, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpGetElementOctString( pA, pStr, strSize, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00449.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetInfo.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00449.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetInfo.c index 559e7855b..51dd52782 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00449.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetInfo.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpGetInfo( pInfo, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpGetInfo( pInfo, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpGetInfo( pInfo, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpGetInfo, (IppsGFpInfo* pInfo, const IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpGetInfo( pInfo, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpGetInfo( pInfo, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00399.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetSize.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00399.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetSize.c index c06b06223..9217a63a2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00399.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpGetSize, (int feBitSize, int* pSize)) -IPPAPI(IppStatus, l9_ippsGFpGetSize, (int feBitSize, int* pSize)) IPPAPI(IppStatus, k1_ippsGFpGetSize, (int feBitSize, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpGetSize, (int feBitSize, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpGetSize, (int feBitSize, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpGetSize, (int feBitSize, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpGetSize, (int feBitSize, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpGetSize( feBitSize, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpGetSize( feBitSize, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpGetSize, (int feBitSize, int* pSize)) -IPPAPI(IppStatus, h9_ippsGFpGetSize, (int feBitSize, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpGetSize, (int feBitSize, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpGetSize( feBitSize, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpGetSize( feBitSize, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00402.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInit.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00402.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInit.c index 129e0292a..e89c22bf0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00402.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpInit( pPrime, primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpInit( pPrime, primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpInit( pPrime, primeBitSize, pGFpMethod, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpInit, (const IppsBigNumState* pPrime, int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpInit( pPrime, primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpInit( pPrime, primeBitSize, pGFpMethod, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00400.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitArbitrary.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00400.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitArbitrary.c index 1a6e33a3f..1c2660e8a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00400.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitArbitrary.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpInitArbitrary( pPrime, primeBitSize, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpInitArbitrary( pPrime, primeBitSize, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpInitArbitrary( pPrime, primeBitSize, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpInitArbitrary,(const IppsBigNumState* pPrime, int primeBitSize, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpInitArbitrary( pPrime, primeBitSize, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpInitArbitrary( pPrime, primeBitSize, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00401.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitFixed.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00401.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitFixed.c index 1a775bc54..b446c1af2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00401.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInitFixed.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpInitFixed( primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpInitFixed( primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpInitFixed( primeBitSize, pGFpMethod, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpInitFixed,(int primeBitSize, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpInitFixed( primeBitSize, pGFpMethod, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpInitFixed( primeBitSize, pGFpMethod, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00438.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInv.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00438.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInv.c index e94d60521..9eaf47650 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00438.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpInv.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpInv( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpInv( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpInv( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpInv, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpInv( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpInv( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00435.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsUnityElement.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00435.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsUnityElement.c index 6c83019b9..a14ba7c80 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00435.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsUnityElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpIsUnityElement( pA, pResult, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpIsUnityElement( pA, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpIsUnityElement( pA, pResult, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpIsUnityElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpIsUnityElement( pA, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpIsUnityElement( pA, pResult, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00434.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsZeroElement.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00434.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsZeroElement.c index b242896af..c892ebc05 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00434.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpIsZeroElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpIsZeroElement( pA, pResult, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpIsZeroElement( pA, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpIsZeroElement( pA, pResult, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpIsZeroElement,(const IppsGFpElement* pA, int* pResult, const IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpIsZeroElement( pA, pResult, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpIsZeroElement( pA, pResult, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00403.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p192r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00403.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p192r1.c index 93b0a8d1d..2fb95de19 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00403.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p192r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p192r1, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p192r1, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p192r1, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p192r1, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p192r1, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p192r1, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p192r1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p192r1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p192r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p192r1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p192r1, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p192r1, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p192r1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p192r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p192r1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00404.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p224r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00404.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p224r1.c index 97ecfc9aa..aa0fa6bad 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00404.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p224r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p224r1, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p224r1, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p224r1, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p224r1, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p224r1, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p224r1, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p224r1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p224r1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p224r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p224r1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p224r1, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p224r1, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p224r1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p224r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p224r1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00410.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00410.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256.c index 5ce757540..cbcaa6e06 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00410.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p256, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p256, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p256( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p256( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p256, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p256, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p256( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00409.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256bn.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00409.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256bn.c index 259e5ed06..5ffaa507a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00409.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256bn.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256bn, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256bn, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p256bn, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256bn, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256bn, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256bn, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p256bn, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p256bn( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p256bn( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p256bn( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p256bn, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p256bn, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256bn, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p256bn( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p256bn( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00405.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00405.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256r1.c index dbb53b434..8168b3540 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00405.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256r1, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256r1, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p256r1, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256r1, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256r1, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256r1, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p256r1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p256r1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p256r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p256r1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p256r1, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p256r1, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256r1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p256r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p256r1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00408.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256sm2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00408.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256sm2.c index fa4567e31..0967af995 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00408.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p256sm2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256sm2,(void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256sm2,(void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p256sm2,(void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p256sm2,(void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p256sm2,(void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256sm2,(void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p256sm2,(void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p256sm2( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p256sm2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p256sm2( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p256sm2,(void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p256sm2,(void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p256sm2,(void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p256sm2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p256sm2( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00406.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p384r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00406.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p384r1.c index 3171bfe48..572eee4f4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00406.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p384r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p384r1, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p384r1, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p384r1, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p384r1, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p384r1, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p384r1, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p384r1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p384r1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p384r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p384r1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p384r1, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p384r1, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p384r1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p384r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p384r1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00407.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p521r1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00407.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p521r1.c index 4faccbf07..5e8ce6f6e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00407.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_p521r1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p521r1, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p521r1, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_p521r1, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_p521r1, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_p521r1, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p521r1, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_p521r1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_p521r1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_p521r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_p521r1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_p521r1, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_p521r1, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_p521r1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_p521r1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_p521r1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00411.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_pArb.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00411.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_pArb.c index 0ef1a1b6c..db3914725 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00411.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMethod_pArb.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_pArb, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_pArb, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpMethod_pArb, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpMethod_pArb, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpMethod_pArb, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_pArb, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpMethod_pArb, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMethod_pArb( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMethod_pArb( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMethod_pArb( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpMethod_pArb, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpMethod_pArb, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpMethod_pArb, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMethod_pArb( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMethod_pArb( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00443.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00443.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul.c index 809d22557..61bd884c2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00443.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMul( pA, pB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMul( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMul( pA, pB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpMul, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMul( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMul( pA, pB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00448.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul_PE.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00448.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul_PE.c index 09023668c..641752df7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00448.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMul_PE.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMul_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMul_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMul_PE( pA, pParentB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpMul_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMul_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMul_PE( pA, pParentB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00445.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMultiExp.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00445.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMultiExp.c index c57c0964b..32ba1bf9e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00445.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpMultiExp.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpMultiExp( ppElmA, ppE, nItems, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpMultiExp( ppElmA, ppE, nItems, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpMultiExp( ppElmA, ppE, nItems, pR, pGFp, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpMultiExp,(const IppsGFpElement* const ppElmA[], const IppsBigNumState* const ppE[], int nItems, IppsGFpElement* pR, IppsGFpState* pGFp, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpMultiExp( ppElmA, ppE, nItems, pR, pGFp, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpMultiExp( ppElmA, ppE, nItems, pR, pGFp, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00437.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpNeg.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00437.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpNeg.c index fb75555b0..7a50ef285 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00437.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpNeg.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpNeg( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpNeg( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpNeg( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpNeg, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpNeg( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpNeg( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00421.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpScratchBufferSize.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00421.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpScratchBufferSize.c index f399a3a55..f8672b395 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00421.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpScratchBufferSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) -IPPAPI(IppStatus, l9_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) IPPAPI(IppStatus, k1_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) +IPPAPI(IppStatus, l9_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) +IPPAPI(IppStatus, y8_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpScratchBufferSize( nExponents, ExpBitSize, pGFp, pBufferSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpScratchBufferSize( nExponents, ExpBitSize, pGFp, pBufferSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpScratchBufferSize( nExponents, ExpBitSize, pGFp, pBufferSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) -IPPAPI(IppStatus, h9_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpScratchBufferSize,(int nExponents, int ExpBitSize, const IppsGFpState* pGFp, int* pBufferSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpScratchBufferSize( nExponents, ExpBitSize, pGFp, pBufferSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpScratchBufferSize( nExponents, ExpBitSize, pGFp, pBufferSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00424.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElement.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00424.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElement.c index 2964fafe4..fad6aae00 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00424.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElement.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElement( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElement( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElement( pA, lenA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElement, (const Ipp32u* pA, int lenA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElement( pA, lenA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElement( pA, lenA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00428.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00428.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash.c index e6ee8a16f..f0c92ccb4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00428.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) -IPPAPI(IppStatus, l9_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) IPPAPI(IppStatus, k1_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) +IPPAPI(IppStatus, l9_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) +IPPAPI(IppStatus, y8_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElementHash( pMsg, msgLen, pElm, pGFp, hashID ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElementHash( pMsg, msgLen, pElm, pGFp, hashID ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElementHash( pMsg, msgLen, pElm, pGFp, hashID ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) -IPPAPI(IppStatus, h9_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementHash,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, IppHashAlgId hashID)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElementHash( pMsg, msgLen, pElm, pGFp, hashID ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElementHash( pMsg, msgLen, pElm, pGFp, hashID ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00429.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash_rmf.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00429.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash_rmf.c index b35f07435..e7c99d2d4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00429.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementHash_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElementHash_rmf( pMsg, msgLen, pElm, pGFp, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElementHash_rmf( pMsg, msgLen, pElm, pGFp, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElementHash_rmf( pMsg, msgLen, pElm, pGFp, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementHash_rmf,(const Ipp8u* pMsg, int msgLen, IppsGFpElement* pElm, IppsGFpState* pGFp, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElementHash_rmf( pMsg, msgLen, pElm, pGFp, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElementHash_rmf( pMsg, msgLen, pElm, pGFp, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00426.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementOctString.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00426.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementOctString.c index 58b75786b..bd8d1476f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00426.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementOctString.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElementOctString( pStr, strSize, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElementOctString( pStr, strSize, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElementOctString( pStr, strSize, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementOctString,(const Ipp8u* pStr, int strSize, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElementOctString( pStr, strSize, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElementOctString( pStr, strSize, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00427.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRandom.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00427.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRandom.c index ab24f3abe..192259705 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00427.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRandom.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElementRandom( pR, pGFp, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElementRandom( pR, pGFp, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElementRandom( pR, pGFp, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementRandom,(IppsGFpElement* pR, IppsGFpState* pGFp, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElementRandom( pR, pGFp, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElementRandom( pR, pGFp, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00425.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRegular.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00425.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRegular.c index 1deff464f..41e80c601 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00425.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSetElementRegular.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSetElementRegular( pBN, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSetElementRegular( pBN, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSetElementRegular( pBN, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSetElementRegular,(const IppsBigNumState* pBN, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSetElementRegular( pBN, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSetElementRegular( pBN, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00440.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqr.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00440.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqr.c index 1c596b1b4..4d62f4ba8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00440.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqr.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSqr( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSqr( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSqr( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSqr, (const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSqr( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSqr( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00439.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqrt.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00439.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqrt.c index 812dfecdb..4b2ae0d49 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00439.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSqrt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSqrt( pA, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSqrt( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSqrt( pA, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSqrt,(const IppsGFpElement* pA, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSqrt( pA, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSqrt( pA, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00442.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00442.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub.c index 95eb94c35..7af4d6863 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00442.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSub( pA, pB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSub( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSub( pA, pB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSub, (const IppsGFpElement* pA, const IppsGFpElement* pB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSub( pA, pB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSub( pA, pB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00447.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub_PE.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00447.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub_PE.c index 4d53d862f..964830f6f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00447.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpSub_PE.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, l9_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) IPPAPI(IppStatus, k1_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, l9_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPAPI(IppStatus, y8_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPFUN(IppStatus,sgx_disp_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) +IPPFUN(IppStatus, sgx_disp_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpSub_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpSub_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpSub_PE( pA, pParentB, pR, pGFp ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -IPPAPI(IppStatus, h9_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpSub_PE,(const IppsGFpElement* pA, const IppsGFpElement* pParentB, IppsGFpElement* pR, IppsGFpState* pGFp)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpSub_PE( pA, pParentB, pR, pGFp ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpSub_PE( pA, pParentB, pR, pGFp ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00412.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxGetSize.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00412.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxGetSize.c index e3f53292f..50d443bdc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00412.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) -IPPAPI(IppStatus, l9_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) IPPAPI(IppStatus, k1_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) +IPPAPI(IppStatus, l9_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) +IPPAPI(IppStatus, y8_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxGetSize( pGroundGF, degree, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxGetSize( pGroundGF, degree, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxGetSize( pGroundGF, degree, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) -IPPAPI(IppStatus, h9_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpxGetSize,(const IppsGFpState* pGroundGF, int degree, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxGetSize( pGroundGF, degree, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxGetSize( pGroundGF, degree, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00413.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInit.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00413.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInit.c index 08315ec24..b5b8853b9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00413.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPAPI(IppStatus, l9_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) IPPAPI(IppStatus, k1_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPAPI(IppStatus, l9_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPAPI(IppStatus, y8_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPFUN(IppStatus,sgx_disp_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPFUN(IppStatus, sgx_disp_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxInit( pGroundGF, extDeg, ppGroundElm, nElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxInit( pGroundGF, extDeg, ppGroundElm, nElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxInit( pGroundGF, extDeg, ppGroundElm, nElm, pGFpMethod, pGFpx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPAPI(IppStatus, h9_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpxInit, (const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* const ppGroundElm[], int nElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxInit( pGroundGF, extDeg, ppGroundElm, nElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxInit( pGroundGF, extDeg, ppGroundElm, nElm, pGFpMethod, pGFpx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00414.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInitBinomial.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00414.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInitBinomial.c index cc5b4ec4a..5095c9cbc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00414.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxInitBinomial.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPAPI(IppStatus, l9_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) IPPAPI(IppStatus, k1_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPAPI(IppStatus, l9_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPAPI(IppStatus, y8_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPFUN(IppStatus,sgx_disp_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) +IPPFUN(IppStatus, sgx_disp_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxInitBinomial( pGroundGF, extDeg, pGroundElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxInitBinomial( pGroundGF, extDeg, pGroundElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxInitBinomial( pGroundGF, extDeg, pGroundElm, pGFpMethod, pGFpx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -IPPAPI(IppStatus, h9_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpxInitBinomial,(const IppsGFpState* pGroundGF, int extDeg, const IppsGFpElement* pGroundElm, const IppsGFpMethod* pGFpMethod, IppsGFpState* pGFpx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxInitBinomial( pGroundGF, extDeg, pGroundElm, pGFpMethod, pGFpx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxInitBinomial( pGroundGF, extDeg, pGroundElm, pGFpMethod, pGFpx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00419.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00419.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom.c index d5ea80e1d..7c0f894e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00419.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_binom, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_binom, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_binom( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_binom( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_binom( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_binom, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_binom, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_binom( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_binom( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00417.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00417.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2.c index d1bba7724..615633268 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00417.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom2, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom2, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_binom2, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom2, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom2, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom2, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_binom2, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_binom2( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_binom2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_binom2( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_binom2, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_binom2, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom2, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_binom2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_binom2( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00415.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2_epid2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00415.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2_epid2.c index 96cb69028..47124df67 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00415.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom2_epid2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom2_epid2,(void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom2_epid2,(void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_binom2_epid2,(void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom2_epid2,(void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom2_epid2,(void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom2_epid2,(void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_binom2_epid2,(void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_binom2_epid2( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_binom2_epid2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_binom2_epid2( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_binom2_epid2,(void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_binom2_epid2,(void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom2_epid2,(void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_binom2_epid2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_binom2_epid2( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00418.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00418.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3.c index 3ce759c8e..72f68e39e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00418.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom3, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom3, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_binom3, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom3, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom3, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom3, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_binom3, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_binom3( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_binom3( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_binom3( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_binom3, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_binom3, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom3, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_binom3( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_binom3( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00416.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3_epid2.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00416.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3_epid2.c index c4782e75a..7ddcca3f9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00416.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_binom3_epid2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom3_epid2,(void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom3_epid2,(void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_binom3_epid2,(void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_binom3_epid2,(void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_binom3_epid2,(void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom3_epid2,(void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_binom3_epid2,(void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_binom3_epid2( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_binom3_epid2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_binom3_epid2( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_binom3_epid2,(void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_binom3_epid2,(void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_binom3_epid2,(void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_binom3_epid2( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_binom3_epid2( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00420.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_com.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00420.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_com.c index a450768b6..5abfc2002 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00420.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGFpxMethod_com.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_com, (void) ) -IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_com, (void) ) IPPAPI( const IppsGFpMethod*, k1_ippsGFpxMethod_com, (void) ) +IPPAPI( const IppsGFpMethod*, l9_ippsGFpxMethod_com, (void) ) +IPPAPI( const IppsGFpMethod*, y8_ippsGFpxMethod_com, (void) ) -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_com, (void) ) +IPPFUN( const IppsGFpMethod*, sgx_disp_ippsGFpxMethod_com, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGFpxMethod_com( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGFpxMethod_com( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGFpxMethod_com( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsGFpMethod*, p8_ippsGFpxMethod_com, (void) ) -IPPAPI( const IppsGFpMethod*, h9_ippsGFpxMethod_com, (void) ) - -IPPFUN( const IppsGFpMethod*,sgx_disp_ippsGFpxMethod_com, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpxMethod_com( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpxMethod_com( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00253.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGcd_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00253.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGcd_BN.c index 5fc14e768..885b309a4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00253.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGcd_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) -IPPAPI(IppStatus, l9_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) IPPAPI(IppStatus, k1_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) +IPPAPI(IppStatus, l9_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) +IPPAPI(IppStatus, y8_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) -IPPFUN(IppStatus,sgx_disp_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) +IPPFUN(IppStatus, sgx_disp_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGcd_BN( pA, pB, pGCD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGcd_BN( pA, pB, pGCD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGcd_BN( pA, pB, pGCD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) -IPPAPI(IppStatus, h9_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) - -IPPFUN(IppStatus,sgx_disp_ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGcd_BN( pA, pB, pGCD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGcd_BN( pA, pB, pGCD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00256.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetOctString_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00256.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetOctString_BN.c index b08b283c7..50cae0536 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00256.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetOctString_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGetOctString_BN( pStr, strLen, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGetOctString_BN( pStr, strLen, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00242.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetSize_BN.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00242.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetSize_BN.c index e2b152494..3df66c04d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00242.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGetSize_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) -IPPAPI(IppStatus, l9_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) IPPAPI(IppStatus, k1_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) +IPPAPI(IppStatus, l9_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) +IPPAPI(IppStatus, y8_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGetSize_BN( pBN, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGetSize_BN( pBN, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGetSize_BN( pBN, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) -IPPAPI(IppStatus, h9_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsGetSize_BN,(const IppsBigNumState* pBN, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGetSize_BN( pBN, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGetSize_BN( pBN, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00244.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGet_BN.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00244.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGet_BN.c index fef8739a7..c9ad5a8a1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00244.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsGet_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsGet_BN( pSgn, pLength, pData, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsGet_BN( pSgn, pLength, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsGet_BN( pSgn, pLength, pData, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsGet_BN,(IppsBigNumSGN* pSgn, int* pLength, Ipp32u* pData, const IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGet_BN( pSgn, pLength, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGet_BN( pSgn, pLength, pData, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00233.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACDuplicate_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00233.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACDuplicate_rmf.c index e92ab7717..f569c4a91 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00233.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACDuplicate_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) -IPPAPI(IppStatus, l9_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) IPPAPI(IppStatus, k1_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) +IPPAPI(IppStatus, l9_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) +IPPAPI(IppStatus, y8_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACDuplicate_rmf( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACDuplicate_rmf( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACDuplicate_rmf( pSrcCtx, pDstCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) -IPPAPI(IppStatus, h9_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACDuplicate_rmf,(const IppsHMACState_rmf* pSrcCtx, IppsHMACState_rmf* pDstCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACDuplicate_rmf( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACDuplicate_rmf( pSrcCtx, pDstCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00235.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACFinal_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00235.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACFinal_rmf.c index e035b2885..8e258d309 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00235.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACFinal_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, l9_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) IPPAPI(IppStatus, k1_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, l9_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, y8_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACFinal_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACFinal_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACFinal_rmf( pMD, mdLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, h9_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACFinal_rmf,(Ipp8u* pMD, int mdLen, IppsHMACState_rmf* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACFinal_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACFinal_rmf( pMD, mdLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00229.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetSize_rmf.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00229.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetSize_rmf.c index 9704c400f..8da676a7b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00229.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetSize_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACGetSize_rmf,(int* pSize)) -IPPAPI(IppStatus, l9_ippsHMACGetSize_rmf,(int* pSize)) IPPAPI(IppStatus, k1_ippsHMACGetSize_rmf,(int* pSize)) +IPPAPI(IppStatus, l9_ippsHMACGetSize_rmf,(int* pSize)) +IPPAPI(IppStatus, y8_ippsHMACGetSize_rmf,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsHMACGetSize_rmf,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsHMACGetSize_rmf,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACGetSize_rmf( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACGetSize_rmf( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACGetSize_rmf( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACGetSize_rmf,(int* pSize)) -IPPAPI(IppStatus, h9_ippsHMACGetSize_rmf,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACGetSize_rmf,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACGetSize_rmf( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACGetSize_rmf( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00236.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetTag_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00236.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetTag_rmf.c index 118fb4ca6..e5b963e14 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00236.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACGetTag_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, l9_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) IPPAPI(IppStatus, k1_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, l9_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, y8_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACGetTag_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACGetTag_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACGetTag_rmf( pMD, mdLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, h9_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACGetTag_rmf,(Ipp8u* pMD, int mdLen, const IppsHMACState_rmf* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACGetTag_rmf( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACGetTag_rmf( pMD, mdLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00230.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACInit_rmf.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00230.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACInit_rmf.c index 70f4f007e..8fd83e1ca 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00230.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACInit_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACInit_rmf( pKey, keyLen, pCtx, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACInit_rmf( pKey, keyLen, pCtx, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACInit_rmf( pKey, keyLen, pCtx, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACInit_rmf,(const Ipp8u* pKey, int keyLen, IppsHMACState_rmf* pCtx, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACInit_rmf( pKey, keyLen, pCtx, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACInit_rmf( pKey, keyLen, pCtx, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00237.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACMessage_rmf.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00237.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACMessage_rmf.c index 41accb773..c98315c19 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00237.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACMessage_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACMessage_rmf( pMsg, msgLen, pKey, keyLen, pMD, mdLen, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACMessage_rmf( pMsg, msgLen, pKey, keyLen, pMD, mdLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACMessage_rmf( pMsg, msgLen, pKey, keyLen, pMD, mdLen, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACMessage_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACMessage_rmf( pMsg, msgLen, pKey, keyLen, pMD, mdLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACMessage_rmf( pMsg, msgLen, pKey, keyLen, pMD, mdLen, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00231.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACPack_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00231.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACPack_rmf.c index 773172050..98aea09f4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00231.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACPack_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, l9_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) IPPAPI(IppStatus, k1_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, l9_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, y8_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPFUN(IppStatus,sgx_disp_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPFUN(IppStatus, sgx_disp_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACPack_rmf( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACPack_rmf( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACPack_rmf( pCtx, pBuffer, bufSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, h9_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACPack_rmf,(const IppsHMACState_rmf* pCtx, Ipp8u* pBuffer, int bufSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACPack_rmf( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACPack_rmf( pCtx, pBuffer, bufSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00232.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUnpack_rmf.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00232.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUnpack_rmf.c index 99f4bdf58..0718ed4fb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00232.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUnpack_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, l9_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) IPPAPI(IppStatus, k1_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, l9_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, y8_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACUnpack_rmf( pBuffer, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACUnpack_rmf( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACUnpack_rmf( pBuffer, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, h9_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACUnpack_rmf,(const Ipp8u* pBuffer, IppsHMACState_rmf* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACUnpack_rmf( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACUnpack_rmf( pBuffer, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00234.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUpdate_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00234.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUpdate_rmf.c index 056668a90..ef6ad5250 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00234.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMACUpdate_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, l9_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) IPPAPI(IppStatus, k1_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, l9_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) +IPPAPI(IppStatus, y8_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMACUpdate_rmf( pSrc, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMACUpdate_rmf( pSrc, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMACUpdate_rmf( pSrc, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) -IPPAPI(IppStatus, h9_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMACUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHMACState_rmf* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMACUpdate_rmf( pSrc, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMACUpdate_rmf( pSrc, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00224.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00224.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Duplicate.c index 6763e40f3..12d034f5a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00224.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) -IPPAPI(IppStatus, l9_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) IPPAPI(IppStatus, k1_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) +IPPAPI(IppStatus, l9_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) +IPPAPI(IppStatus, y8_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Duplicate( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Duplicate( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Duplicate( pSrcCtx, pDstCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) -IPPAPI(IppStatus, h9_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Duplicate,(const IppsHMACState* pSrcCtx, IppsHMACState* pDstCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Duplicate( pSrcCtx, pDstCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Duplicate( pSrcCtx, pDstCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00226.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Final.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00226.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Final.c index 12997aeb7..2149a3e1a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00226.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -IPPAPI(IppStatus, l9_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) IPPAPI(IppStatus, k1_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +IPPAPI(IppStatus, l9_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +IPPAPI(IppStatus, y8_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Final( pMD, mdLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Final( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Final( pMD, mdLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -IPPAPI(IppStatus, h9_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Final( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Final( pMD, mdLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00220.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00220.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetSize.c index 9a8097a56..27737af6f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00220.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsHMAC_GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsHMAC_GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsHMAC_GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsHMAC_GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsHMAC_GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00227.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetTag.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00227.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetTag.c index fee1eae92..d6e860b68 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00227.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -IPPAPI(IppStatus, l9_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) IPPAPI(IppStatus, k1_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +IPPAPI(IppStatus, l9_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +IPPAPI(IppStatus, y8_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_GetTag( pMD, mdLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_GetTag( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_GetTag( pMD, mdLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -IPPAPI(IppStatus, h9_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_GetTag( pMD, mdLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_GetTag( pMD, mdLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00221.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Init.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00221.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Init.c index f15933813..f4d882da2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00221.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, l9_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) IPPAPI(IppStatus, k1_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, l9_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, y8_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Init( pKey, keyLen, pCtx, hashAlg ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Init( pKey, keyLen, pCtx, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Init( pKey, keyLen, pCtx, hashAlg ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, h9_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Init( pKey, keyLen, pCtx, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Init( pKey, keyLen, pCtx, hashAlg ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00228.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Message.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00228.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Message.c index 3095326bf..e6eba4eb6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00228.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Message.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, l9_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) IPPAPI(IppStatus, k1_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, l9_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, y8_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Message( pMsg, msgLen, pKey, keyLen, pMD, mdLen, hashAlg ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Message( pMsg, msgLen, pKey, keyLen, pMD, mdLen, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Message( pMsg, msgLen, pKey, keyLen, pMD, mdLen, hashAlg ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, h9_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pKey, int keyLen, Ipp8u* pMD, int mdLen, IppHashAlgId hashAlg)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Message( pMsg, msgLen, pKey, keyLen, pMD, mdLen, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Message( pMsg, msgLen, pKey, keyLen, pMD, mdLen, hashAlg ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00222.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Pack.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00222.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Pack.c index 1c242fa79..ef5c8c73c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00222.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, l9_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) IPPAPI(IppStatus, k1_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, l9_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, y8_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Pack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Pack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Pack( pCtx, pBuffer, bufSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, h9_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Pack,(const IppsHMACState* pCtx, Ipp8u* pBuffer, int bufSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Pack( pCtx, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Pack( pCtx, pBuffer, bufSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00223.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00223.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Unpack.c index 923027d4c..ff388771b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00223.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) -IPPAPI(IppStatus, l9_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) IPPAPI(IppStatus, k1_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) +IPPAPI(IppStatus, l9_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) +IPPAPI(IppStatus, y8_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Unpack( pBuffer, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Unpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Unpack( pBuffer, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) -IPPAPI(IppStatus, h9_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Unpack,(const Ipp8u* pBuffer, IppsHMACState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Unpack( pBuffer, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Unpack( pBuffer, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00225.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Update.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00225.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Update.c index 45c84f02b..39cd5878e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00225.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHMAC_Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -IPPAPI(IppStatus, l9_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) IPPAPI(IppStatus, k1_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +IPPAPI(IppStatus, l9_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +IPPAPI(IppStatus, y8_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHMAC_Update( pSrc, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHMAC_Update( pSrc, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHMAC_Update( pSrc, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -IPPAPI(IppStatus, h9_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHMAC_Update( pSrc, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHMAC_Update( pSrc, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00170.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00170.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate.c index c1727569f..4d73af125 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00170.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) -IPPAPI(IppStatus, l9_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) IPPAPI(IppStatus, k1_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) +IPPAPI(IppStatus, l9_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) +IPPAPI(IppStatus, y8_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashDuplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashDuplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashDuplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) -IPPAPI(IppStatus, h9_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashDuplicate,(const IppsHashState* pSrcState, IppsHashState* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashDuplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashDuplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00210.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate_rmf.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00210.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate_rmf.c index 4a90dd8a5..5c64ca44c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00210.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashDuplicate_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) -IPPAPI(IppStatus, l9_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) IPPAPI(IppStatus, k1_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) +IPPAPI(IppStatus, l9_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) +IPPAPI(IppStatus, y8_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashDuplicate_rmf( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashDuplicate_rmf( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashDuplicate_rmf( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) -IPPAPI(IppStatus, h9_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashDuplicate_rmf,(const IppsHashState_rmf* pSrcState, IppsHashState_rmf* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashDuplicate_rmf( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashDuplicate_rmf( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00173.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00173.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal.c index 9bb9149d6..0884187d8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00173.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) -IPPAPI(IppStatus, l9_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) IPPAPI(IppStatus, k1_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) +IPPAPI(IppStatus, l9_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) +IPPAPI(IppStatus, y8_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashFinal( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashFinal( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashFinal( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) -IPPAPI(IppStatus, h9_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashFinal,(Ipp8u* pMD, IppsHashState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashFinal( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashFinal( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00213.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal_rmf.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00213.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal_rmf.c index 4e6027d09..59f7825d7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00213.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashFinal_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, l9_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) IPPAPI(IppStatus, k1_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, l9_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, y8_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashFinal_rmf( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashFinal_rmf( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashFinal_rmf( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, h9_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashFinal_rmf,(Ipp8u* pMD, IppsHashState_rmf* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashFinal_rmf( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashFinal_rmf( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00216.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetInfo_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00216.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetInfo_rmf.c index 6cff30c62..603af841f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00216.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetInfo_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) -IPPAPI(IppStatus, l9_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) IPPAPI(IppStatus, k1_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) +IPPAPI(IppStatus, l9_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) +IPPAPI(IppStatus, y8_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashGetInfo_rmf( pInfo, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashGetInfo_rmf( pInfo, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashGetInfo_rmf( pInfo, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) -IPPAPI(IppStatus, h9_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashGetInfo_rmf,(IppsHashInfo* pInfo, const IppsHashState_rmf* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashGetInfo_rmf( pInfo, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashGetInfo_rmf( pInfo, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00166.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00166.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize.c index 7e9f05f24..ac7e3250a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00166.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashGetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsHashGetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsHashGetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsHashGetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsHashGetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsHashGetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsHashGetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashGetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsHashGetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHashGetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00206.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize_rmf.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00206.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize_rmf.c index eb58e4d18..2f12eadfc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00206.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetSize_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashGetSize_rmf,(int* pSize)) -IPPAPI(IppStatus, l9_ippsHashGetSize_rmf,(int* pSize)) IPPAPI(IppStatus, k1_ippsHashGetSize_rmf,(int* pSize)) +IPPAPI(IppStatus, l9_ippsHashGetSize_rmf,(int* pSize)) +IPPAPI(IppStatus, y8_ippsHashGetSize_rmf,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsHashGetSize_rmf,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsHashGetSize_rmf,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashGetSize_rmf( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashGetSize_rmf( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashGetSize_rmf( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashGetSize_rmf,(int* pSize)) -IPPAPI(IppStatus, h9_ippsHashGetSize_rmf,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHashGetSize_rmf,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashGetSize_rmf( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashGetSize_rmf( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00172.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00172.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag.c index 63f1ad335..a8a93d774 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00172.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) -IPPAPI(IppStatus, l9_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) IPPAPI(IppStatus, k1_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) +IPPAPI(IppStatus, l9_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) +IPPAPI(IppStatus, y8_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashGetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) -IPPAPI(IppStatus, h9_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashGetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashGetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00212.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00212.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag_rmf.c index 6155f9cb4..bbd8e764d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00212.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashGetTag_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) -IPPAPI(IppStatus, l9_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) IPPAPI(IppStatus, k1_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) +IPPAPI(IppStatus, l9_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) +IPPAPI(IppStatus, y8_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashGetTag_rmf( pMD, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashGetTag_rmf( pMD, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashGetTag_rmf( pMD, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) -IPPAPI(IppStatus, h9_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashGetTag_rmf,(Ipp8u* pMD, int tagLen, const IppsHashState_rmf* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashGetTag_rmf( pMD, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashGetTag_rmf( pMD, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00167.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00167.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit.c index 4ee4ebfce..20431a58e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00167.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, l9_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) IPPAPI(IppStatus, k1_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, l9_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, y8_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) -IPPFUN(IppStatus,sgx_disp_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) +IPPFUN(IppStatus, sgx_disp_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashInit( pState, hashAlg ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashInit( pState, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashInit( pState, hashAlg ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, h9_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) - -IPPFUN(IppStatus,sgx_disp_ippsHashInit,(IppsHashState* pState, IppHashAlgId hashAlg)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashInit( pState, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashInit( pState, hashAlg ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00207.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00207.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit_rmf.c index 995c28739..cb2eacb63 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00207.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashInit_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashInit_rmf( pState, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashInit_rmf( pState, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashInit_rmf( pState, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsHashInit_rmf,(IppsHashState_rmf* pState, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashInit_rmf( pState, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashInit_rmf( pState, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00174.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00174.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage.c index 39610e427..e350c8b4e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00174.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, l9_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) IPPAPI(IppStatus, k1_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, l9_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, y8_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) -IPPFUN(IppStatus,sgx_disp_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) +IPPFUN(IppStatus, sgx_disp_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMessage( pMsg, len, pMD, hashAlg ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMessage( pMsg, len, pMD, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMessage( pMsg, len, pMD, hashAlg ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, h9_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) - -IPPFUN(IppStatus,sgx_disp_ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMessage( pMsg, len, pMD, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMessage( pMsg, len, pMD, hashAlg ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00214.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage_rmf.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00214.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage_rmf.c index 7d7a57904..1c6f4fdde 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00214.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMessage_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMessage_rmf( pMsg, len, pMD, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMessage_rmf( pMsg, len, pMD, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMessage_rmf( pMsg, len, pMD, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsHashMessage_rmf,(const Ipp8u* pMsg, int len, Ipp8u* pMD, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMessage_rmf( pMsg, len, pMD, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMessage_rmf( pMsg, len, pMD, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00215.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetInfo.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00215.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetInfo.c index e9d140369..49855124a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00215.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetInfo.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodGetInfo( pInfo, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodGetInfo( pInfo, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodGetInfo( pInfo, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsHashMethodGetInfo,(IppsHashInfo* pInfo, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodGetInfo( pInfo, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodGetInfo( pInfo, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00190.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetSize.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00190.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetSize.c index 64d8329f3..1d82cab89 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00190.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodGetSize, (int* pSize) ) -IPPAPI( IppStatus, l9_ippsHashMethodGetSize, (int* pSize) ) IPPAPI( IppStatus, k1_ippsHashMethodGetSize, (int* pSize) ) +IPPAPI( IppStatus, l9_ippsHashMethodGetSize, (int* pSize) ) +IPPAPI( IppStatus, y8_ippsHashMethodGetSize, (int* pSize) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodGetSize, (int* pSize) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodGetSize, (int* pSize) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodGetSize, (int* pSize) ) -IPPAPI( IppStatus, h9_ippsHashMethodGetSize, (int* pSize) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodGetSize, (int* pSize) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00191.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_MD5.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00191.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_MD5.c index 590421cfb..55e28d14b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00191.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_MD5.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_MD5( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_MD5( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_MD5( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_MD5, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_MD5( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_MD5( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00193.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00193.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1.c index 03bf66589..1b82fd7d0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00193.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA1( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA1( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA1( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA1( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA1( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00194.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_NI.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00194.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_NI.c index dc2c8d8a5..a81067c0d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00194.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA1_NI( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA1_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA1_NI( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1_NI, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA1_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA1_NI( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00195.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_TT.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00195.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_TT.c index 8ef07de58..55f9e416b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00195.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA1_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA1_TT( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA1_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA1_TT( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA1_TT, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA1_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA1_TT( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00199.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00199.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224.c index be4c61cbe..9a86c13b7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00199.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA224( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA224( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA224( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA224( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA224( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00200.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_NI.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00200.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_NI.c index e780d60ad..79186d59a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00200.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA224_NI( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA224_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA224_NI( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224_NI, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA224_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA224_NI( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00201.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_TT.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00201.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_TT.c index 330f7f5a6..ac57a19f9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00201.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA224_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA224_TT( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA224_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA224_TT( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA224_TT, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA224_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA224_TT( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00196.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00196.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256.c index f42df9cb4..a0dd3df48 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00196.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA256( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA256( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA256( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA256( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA256( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00197.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_NI.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00197.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_NI.c index 4575d093b..6f62c601c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00197.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA256_NI( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA256_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA256_NI( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256_NI, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA256_NI( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA256_NI( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00198.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_TT.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00198.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_TT.c index 9c4025839..2315646a1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00198.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA256_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA256_TT( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA256_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA256_TT( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA256_TT, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA256_TT( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA256_TT( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00203.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA384.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00203.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA384.c index b99d7e84e..6eab7d3c6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00203.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA384.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA384( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA384( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA384( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA384, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA384( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA384( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00202.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00202.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512.c index 84c12c8b6..d46f08d1c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00202.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA512( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA512( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA512( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA512( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA512( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00205.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_224.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00205.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_224.c index 76804815d..3500b6548 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00205.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_224.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA512_224( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA512_224( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA512_224( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512_224, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA512_224( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA512_224( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00204.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_256.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00204.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_256.c index 8952ab85a..15f1a3b36 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00204.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SHA512_256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SHA512_256( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SHA512_256( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SHA512_256( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SHA512_256, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SHA512_256( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SHA512_256( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00192.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SM3.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00192.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SM3.c index 3ce7cc6fa..8e1ef35d6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00192.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethodSet_SM3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( IppStatus, y8_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, l9_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) IPPAPI( IppStatus, k1_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) +IPPFUN( IppStatus, sgx_disp_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethodSet_SM3( pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethodSet_SM3( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethodSet_SM3( pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI( IppStatus, p8_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) -IPPAPI( IppStatus, h9_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) - -IPPFUN( IppStatus,sgx_disp_ippsHashMethodSet_SM3, (IppsHashMethod* pMethod) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethodSet_SM3( pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethodSet_SM3( pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00175.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_MD5.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00175.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_MD5.c index 6dc25f830..8f1acf2c5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00175.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_MD5.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_MD5, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_MD5, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_MD5, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_MD5, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_MD5, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_MD5, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_MD5, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_MD5( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_MD5( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_MD5( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_MD5, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_MD5, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_MD5, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_MD5( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_MD5( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00177.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00177.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1.c index 72e1c8af8..a7b3810c0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00177.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA1, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA1, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA1( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA1( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA1, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA1, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA1( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA1( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00178.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_NI.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00178.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_NI.c index c62850ff3..a84bde762 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00178.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1_NI, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1_NI, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA1_NI, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1_NI, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1_NI, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1_NI, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA1_NI, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA1_NI( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA1_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA1_NI( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA1_NI, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA1_NI, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1_NI, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA1_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA1_NI( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00179.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_TT.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00179.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_TT.c index 5fe504516..32d4f1bb0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00179.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA1_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1_TT, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1_TT, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA1_TT, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA1_TT, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA1_TT, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1_TT, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA1_TT, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA1_TT( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA1_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA1_TT( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA1_TT, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA1_TT, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA1_TT, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA1_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA1_TT( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00183.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00183.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224.c index 8c3368d72..47b8b22d9 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00183.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA224, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA224, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA224( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA224( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA224( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA224, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA224, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA224( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA224( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00184.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_NI.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00184.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_NI.c index e546f916c..37d70475d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00184.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224_NI, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224_NI, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA224_NI, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224_NI, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224_NI, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224_NI, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA224_NI, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA224_NI( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA224_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA224_NI( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA224_NI, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA224_NI, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224_NI, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA224_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA224_NI( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00185.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_TT.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00185.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_TT.c index 2e43a4b9f..64a56a020 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00185.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA224_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224_TT, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224_TT, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA224_TT, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA224_TT, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA224_TT, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224_TT, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA224_TT, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA224_TT( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA224_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA224_TT( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA224_TT, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA224_TT, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA224_TT, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA224_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA224_TT( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00180.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00180.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256.c index 05d4ac6a4..ce118ef98 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00180.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA256, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA256, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA256( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA256( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA256, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA256, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA256( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00181.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_NI.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00181.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_NI.c index bc06781f8..938954dfb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00181.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_NI.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256_NI, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256_NI, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA256_NI, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256_NI, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256_NI, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256_NI, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA256_NI, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA256_NI( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA256_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA256_NI( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA256_NI, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA256_NI, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256_NI, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA256_NI( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA256_NI( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00182.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_TT.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00182.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_TT.c index 6b9c91ddc..0bd67389b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00182.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA256_TT.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256_TT, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256_TT, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA256_TT, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA256_TT, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA256_TT, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256_TT, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA256_TT, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA256_TT( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA256_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA256_TT( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA256_TT, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA256_TT, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA256_TT, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA256_TT( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA256_TT( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00187.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA384.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00187.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA384.c index 4afac172e..7c77b1309 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00187.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA384.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA384, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA384, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA384, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA384, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA384, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA384, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA384, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA384( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA384( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA384( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA384, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA384, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA384, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA384( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA384( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00186.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00186.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512.c index cf75736aa..aa774b47f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00186.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA512, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA512, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA512( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA512( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA512( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA512, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA512, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA512( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA512( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00189.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_224.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00189.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_224.c index 01aeac84e..b090f0dcc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00189.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_224.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512_224, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512_224, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA512_224, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512_224, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512_224, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512_224, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA512_224, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA512_224( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA512_224( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA512_224( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA512_224, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA512_224, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512_224, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA512_224( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA512_224( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00188.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_256.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00188.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_256.c index a24110c55..fb1cd7bd0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00188.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SHA512_256.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512_256, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512_256, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SHA512_256, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SHA512_256, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SHA512_256, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512_256, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SHA512_256, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SHA512_256( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SHA512_256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SHA512_256( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SHA512_256, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SHA512_256, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SHA512_256, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SHA512_256( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SHA512_256( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00176.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SM3.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00176.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SM3.c index 2983a8c00..81b8e1720 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00176.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashMethod_SM3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SM3, (void) ) -IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SM3, (void) ) IPPAPI( const IppsHashMethod*, k1_ippsHashMethod_SM3, (void) ) +IPPAPI( const IppsHashMethod*, l9_ippsHashMethod_SM3, (void) ) +IPPAPI( const IppsHashMethod*, y8_ippsHashMethod_SM3, (void) ) -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SM3, (void) ) +IPPFUN( const IppsHashMethod*, sgx_disp_ippsHashMethod_SM3, (void) ) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashMethod_SM3( ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashMethod_SM3( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashMethod_SM3( ); - } else + } else return NULL; } -#else - -IPPAPI( const IppsHashMethod*, p8_ippsHashMethod_SM3, (void) ) -IPPAPI( const IppsHashMethod*, h9_ippsHashMethod_SM3, (void) ) - -IPPFUN( const IppsHashMethod*,sgx_disp_ippsHashMethod_SM3, (void) ) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashMethod_SM3( ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashMethod_SM3( ); - } else - return NULL; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00168.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00168.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack.c index e2ad120a7..838baca79 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00168.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, l9_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) IPPAPI(IppStatus, k1_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, l9_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, y8_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) -IPPFUN(IppStatus,sgx_disp_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) +IPPFUN(IppStatus, sgx_disp_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashPack( pState, pBuffer, bufSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashPack( pState, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashPack( pState, pBuffer, bufSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, h9_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHashPack,(const IppsHashState* pState, Ipp8u* pBuffer, int bufSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashPack( pState, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashPack( pState, pBuffer, bufSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00208.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00208.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack_rmf.c index fef0e67d0..ff37a744b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00208.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashPack_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, l9_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) IPPAPI(IppStatus, k1_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, l9_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) +IPPAPI(IppStatus, y8_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) -IPPFUN(IppStatus,sgx_disp_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) +IPPFUN(IppStatus, sgx_disp_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashPack_rmf( pState, pBuffer, bufSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashPack_rmf( pState, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashPack_rmf( pState, pBuffer, bufSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) -IPPAPI(IppStatus, h9_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) - -IPPFUN(IppStatus,sgx_disp_ippsHashPack_rmf,(const IppsHashState_rmf* pState, Ipp8u* pBuffer, int bufSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashPack_rmf( pState, pBuffer, bufSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashPack_rmf( pState, pBuffer, bufSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224.c new file mode 100644 index 000000000..39630722e --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA224( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA224( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA224( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_NI.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_NI.c new file mode 100644 index 000000000..c856dd0a2 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_NI.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA224_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA224_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA224_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA224_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA224_NI( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA224_NI( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA224_NI( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_TT.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_TT.c new file mode 100644 index 000000000..db94f24a2 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA224_TT.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA224_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA224_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA224_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA224_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA224_TT( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA224_TT( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA224_TT( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256.c new file mode 100644 index 000000000..78cebdff4 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA256( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA256( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA256( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_NI.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_NI.c new file mode 100644 index 000000000..e9e8358f5 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_NI.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA256_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA256_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA256_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA256_NI, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA256_NI( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA256_NI( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA256_NI( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_TT.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_TT.c new file mode 100644 index 000000000..ad6ef2956 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA256_TT.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA256_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA256_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA256_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA256_TT, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA256_TT( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA256_TT( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA256_TT( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA384.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA384.c new file mode 100644 index 000000000..f8218e9b7 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA384.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA384, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA384, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA384, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA384, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA384( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA384( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA384( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512.c new file mode 100644 index 000000000..dd4b43dc4 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA512, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA512, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA512, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA512, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA512( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA512( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA512( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_224.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_224.c new file mode 100644 index 000000000..4b321ee06 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_224.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA512_224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA512_224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA512_224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA512_224, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA512_224( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA512_224( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA512_224( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_256.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_256.c new file mode 100644 index 000000000..dd4196db5 --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SHA512_256.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SHA512_256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SHA512_256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SHA512_256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SHA512_256, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SHA512_256( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SHA512_256( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SHA512_256( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SM3.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SM3.c new file mode 100644 index 000000000..fc8a7396f --- /dev/null +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashStateMethodSet_SM3.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "ippcp.h" + +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if defined (_M_AMD64) || defined (__x86_64__) + +#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) +#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) +#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) + +#ifdef __cplusplus +extern "C" { +#endif + +IPPAPI( IppStatus, k1_ippsHashStateMethodSet_SM3, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, l9_ippsHashStateMethodSet_SM3, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +IPPAPI( IppStatus, y8_ippsHashStateMethodSet_SM3, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) + +IPPFUN( IppStatus, sgx_disp_ippsHashStateMethodSet_SM3, (IppsHashState_rmf* pState, IppsHashMethod* pMethod) ) +{ + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); + + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { + return k1_ippsHashStateMethodSet_SM3( pState, pMethod ); + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { + return l9_ippsHashStateMethodSet_SM3( pState, pMethod ); + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { + return y8_ippsHashStateMethodSet_SM3( pState, pMethod ); + } else + return ippStsCpuNotSupportedErr; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00169.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00169.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack.c index 72e06670f..6dd3ba3d8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00169.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) -IPPAPI(IppStatus, l9_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) IPPAPI(IppStatus, k1_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) +IPPAPI(IppStatus, l9_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) +IPPAPI(IppStatus, y8_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashUnpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashUnpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashUnpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) -IPPAPI(IppStatus, h9_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashUnpack,(const Ipp8u* pBuffer, IppsHashState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashUnpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashUnpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00209.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00209.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack_rmf.c index 2ecc8d05d..8a142d62a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00209.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUnpack_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, l9_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) IPPAPI(IppStatus, k1_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, l9_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, y8_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashUnpack_rmf( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashUnpack_rmf( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashUnpack_rmf( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, h9_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashUnpack_rmf,(const Ipp8u* pBuffer, IppsHashState_rmf* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashUnpack_rmf( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashUnpack_rmf( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00171.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00171.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate.c index a173c8112..1708a7f5f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00171.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) -IPPAPI(IppStatus, l9_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) IPPAPI(IppStatus, k1_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) +IPPAPI(IppStatus, l9_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) +IPPAPI(IppStatus, y8_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashUpdate( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashUpdate( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashUpdate( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) -IPPAPI(IppStatus, h9_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashUpdate( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashUpdate( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00211.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate_rmf.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00211.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate_rmf.c index e77bb2e1b..291444f0f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00211.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsHashUpdate_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, l9_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) IPPAPI(IppStatus, k1_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, l9_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) +IPPAPI(IppStatus, y8_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) -IPPFUN(IppStatus,sgx_disp_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) +IPPFUN(IppStatus, sgx_disp_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsHashUpdate_rmf( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsHashUpdate_rmf( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsHashUpdate_rmf( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) -IPPAPI(IppStatus, h9_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsHashUpdate_rmf,(const Ipp8u* pSrc, int len, IppsHashState_rmf* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsHashUpdate_rmf( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsHashUpdate_rmf( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00250.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMAC_BN_I.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00250.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMAC_BN_I.c index da5035c29..df35c0e33 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00250.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMAC_BN_I.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMAC_BN_I( pA, pB, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMAC_BN_I( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMAC_BN_I( pA, pB, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMAC_BN_I, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMAC_BN_I( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMAC_BN_I( pA, pB, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00150.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00150.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Duplicate.c index 9397a0b2c..e40a5122d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00150.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) -IPPAPI(IppStatus, l9_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) IPPAPI(IppStatus, k1_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) +IPPAPI(IppStatus, l9_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) +IPPAPI(IppStatus, y8_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) -IPPAPI(IppStatus, h9_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Duplicate,(const IppsMD5State* pSrcState, IppsMD5State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00155.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Final.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00155.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Final.c index 16f20d298..2c10b8f25 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00155.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) -IPPAPI(IppStatus, l9_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) IPPAPI(IppStatus, k1_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) +IPPAPI(IppStatus, l9_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) +IPPAPI(IppStatus, y8_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) -IPPAPI(IppStatus, h9_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Final,(Ipp8u* pMD, IppsMD5State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00148.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00148.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetSize.c index 32a5bd472..662512216 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00148.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsMD5GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsMD5GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsMD5GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsMD5GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsMD5GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsMD5GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsMD5GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00154.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00154.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetTag.c index 39ffa7839..dce8b00b4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00154.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) -IPPAPI(IppStatus, l9_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) IPPAPI(IppStatus, k1_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) +IPPAPI(IppStatus, l9_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) +IPPAPI(IppStatus, y8_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) -IPPAPI(IppStatus, h9_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsMD5State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00149.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Init.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00149.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Init.c index 2329a852e..facf95149 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00149.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Init,(IppsMD5State* pState)) -IPPAPI(IppStatus, l9_ippsMD5Init,(IppsMD5State* pState)) IPPAPI(IppStatus, k1_ippsMD5Init,(IppsMD5State* pState)) +IPPAPI(IppStatus, l9_ippsMD5Init,(IppsMD5State* pState)) +IPPAPI(IppStatus, y8_ippsMD5Init,(IppsMD5State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Init,(IppsMD5State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Init,(IppsMD5State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Init,(IppsMD5State* pState)) -IPPAPI(IppStatus, h9_ippsMD5Init,(IppsMD5State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Init,(IppsMD5State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00156.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00156.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5MessageDigest.c index d95818298..16cf2eefc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00156.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00151.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00151.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Pack.c index b7420a551..e92a3d077 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00151.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Pack,(const IppsMD5State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00152.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00152.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Unpack.c index 78797cb33..a771838a6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00152.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) -IPPAPI(IppStatus, l9_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) IPPAPI(IppStatus, k1_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) +IPPAPI(IppStatus, l9_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) +IPPAPI(IppStatus, y8_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) -IPPAPI(IppStatus, h9_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Unpack,(const Ipp8u* pBuffer, IppsMD5State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00153.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Update.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00153.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Update.c index d99c422be..5de972334 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00153.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMD5Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) -IPPAPI(IppStatus, l9_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) IPPAPI(IppStatus, k1_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) +IPPAPI(IppStatus, l9_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) +IPPAPI(IppStatus, y8_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMD5Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMD5Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMD5Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) -IPPAPI(IppStatus, h9_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsMD5Update,(const Ipp8u* pSrc, int len, IppsMD5State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMD5Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMD5Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00217.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00217.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF.c index 13871400c..cd125e5fa 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00217.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, l9_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) IPPAPI(IppStatus, k1_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, l9_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) +IPPAPI(IppStatus, y8_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) -IPPFUN(IppStatus,sgx_disp_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) +IPPFUN(IppStatus, sgx_disp_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMGF( pSeed, seedLen, pMask, maskLen, hashAlg ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMGF( pSeed, seedLen, pMask, maskLen, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMGF( pSeed, seedLen, pMask, maskLen, hashAlg ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) -IPPAPI(IppStatus, h9_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) - -IPPFUN(IppStatus,sgx_disp_ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMGF( pSeed, seedLen, pMask, maskLen, hashAlg ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMGF( pSeed, seedLen, pMask, maskLen, hashAlg ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00218.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF1_rmf.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00218.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF1_rmf.c index eefb0508e..7580ded2e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00218.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF1_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMGF1_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMGF1_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMGF1_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsMGF1_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMGF1_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMGF1_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00219.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF2_rmf.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00219.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF2_rmf.c index 033aa2c7e..cdcb2fcd0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00219.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMGF2_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, l9_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) IPPAPI(IppStatus, k1_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, l9_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPAPI(IppStatus, y8_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPFUN(IppStatus,sgx_disp_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) +IPPFUN(IppStatus, sgx_disp_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMGF2_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMGF2_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMGF2_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -IPPAPI(IppStatus, h9_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) - -IPPFUN(IppStatus,sgx_disp_ippsMGF2_rmf,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, const IppsHashMethod* pMethod)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMGF2_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMGF2_rmf( pSeed, seedLen, pMask, maskLen, pMethod ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00254.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsModInv_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00254.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsModInv_BN.c index 46bd61fc9..5e6c9fa97 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00254.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsModInv_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) -IPPAPI(IppStatus, l9_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) IPPAPI(IppStatus, k1_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) +IPPAPI(IppStatus, l9_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) +IPPAPI(IppStatus, y8_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) -IPPFUN(IppStatus,sgx_disp_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) +IPPFUN(IppStatus, sgx_disp_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsModInv_BN( pA, pM, pInv ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsModInv_BN( pA, pM, pInv ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsModInv_BN( pA, pM, pInv ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) -IPPAPI(IppStatus, h9_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) - -IPPFUN(IppStatus,sgx_disp_ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsModInv_BN( pA, pM, pInv ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsModInv_BN( pA, pM, pInv ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00252.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMod_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00252.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMod_BN.c index 9da0c39b9..f2499a29c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00252.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMod_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMod_BN( pA, pM, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMod_BN( pA, pM, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMod_BN( pA, pM, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMod_BN( pA, pM, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMod_BN( pA, pM, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00263.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontExp.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00263.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontExp.c index 90aa90bb4..fac540ba3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00263.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontExp.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontExp( pA, pE, m, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontExp( pA, pE, m, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontExp( pA, pE, m, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMontExp, (const IppsBigNumState* pA, const IppsBigNumState* pE, IppsMontState* m, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontExp( pA, pE, m, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontExp( pA, pE, m, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00261.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontForm.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00261.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontForm.c index 09eea04d0..e8b0f8b26 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00261.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontForm.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontForm( pA, pCtx, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontForm( pA, pCtx, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontForm( pA, pCtx, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMontForm,(const IppsBigNumState* pA, IppsMontState* pCtx, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontForm( pA, pCtx, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontForm( pA, pCtx, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00260.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGet.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00260.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGet.c index 03eee0737..c4f3fdfaf 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00260.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) -IPPAPI(IppStatus, l9_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) IPPAPI(IppStatus, k1_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) +IPPAPI(IppStatus, l9_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) +IPPAPI(IppStatus, y8_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontGet( pModulo, pSize, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontGet( pModulo, pSize, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontGet( pModulo, pSize, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) -IPPAPI(IppStatus, h9_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsMontGet,(Ipp32u* pModulo, int* pSize, const IppsMontState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontGet( pModulo, pSize, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontGet( pModulo, pSize, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00257.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGetSize.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00257.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGetSize.c index a32e11495..887076099 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00257.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) -IPPAPI(IppStatus, l9_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) IPPAPI(IppStatus, k1_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) +IPPAPI(IppStatus, l9_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) +IPPAPI(IppStatus, y8_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontGetSize( method, length, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontGetSize( method, length, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontGetSize( method, length, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) -IPPAPI(IppStatus, h9_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontGetSize( method, length, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontGetSize( method, length, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00258.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontInit.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00258.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontInit.c index 90227e3eb..a6e4b080f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00258.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) -IPPAPI(IppStatus, l9_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) IPPAPI(IppStatus, k1_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) +IPPAPI(IppStatus, l9_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) +IPPAPI(IppStatus, y8_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontInit( method, length, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontInit( method, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontInit( method, length, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) -IPPAPI(IppStatus, h9_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontInit( method, length, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontInit( method, length, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00262.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontMul.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00262.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontMul.c index 553da8b43..296d322cc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00262.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontMul.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontMul( pA, pB, m, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontMul( pA, pB, m, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontMul( pA, pB, m, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontMul( pA, pB, m, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontMul( pA, pB, m, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00259.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontSet.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00259.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontSet.c index 6f8ba97bd..df84d94e8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00259.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMontSet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) -IPPAPI(IppStatus, l9_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) IPPAPI(IppStatus, k1_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) +IPPAPI(IppStatus, l9_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) +IPPAPI(IppStatus, y8_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMontSet( pModulo, size, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMontSet( pModulo, size, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMontSet( pModulo, size, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) -IPPAPI(IppStatus, h9_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMontSet( pModulo, size, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMontSet( pModulo, size, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00249.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMul_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00249.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMul_BN.c index 07fbbc723..0f51bf4ab 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00249.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsMul_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsMul_BN( pA, pB, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsMul_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsMul_BN( pA, pB, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsMul_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsMul_BN( pA, pB, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00270.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSeed.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00270.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSeed.c index 8d4977886..6e8e0b807 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00270.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSeed.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) -IPPAPI(IppStatus, l9_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) IPPAPI(IppStatus, k1_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) +IPPAPI(IppStatus, l9_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) +IPPAPI(IppStatus, y8_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGGetSeed( pCtx, pSeed ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGGetSeed( pCtx, pSeed ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGGetSeed( pCtx, pSeed ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) -IPPAPI(IppStatus, h9_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGGetSeed, (const IppsPRNGState* pCtx,IppsBigNumState* pSeed)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGGetSeed( pCtx, pSeed ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGGetSeed( pCtx, pSeed ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00264.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00264.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSize.c index 1140ecaec..9d0c0ab4c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00264.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGGetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsPRNGGetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsPRNGGetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsPRNGGetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsPRNGGetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGGetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGGetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGGetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsPRNGGetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGGetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00265.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGInit.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00265.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGInit.c index aa5655ed7..a7423800d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00265.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGInit( seedBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGInit( seedBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGInit( seedBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGInit( seedBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGInit( seedBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00268.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetAugment.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00268.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetAugment.c index 71d164055..93a2aa429 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00268.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetAugment.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGSetAugment( pAug, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGSetAugment( pAug, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGSetAugment( pAug, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetAugment,(const IppsBigNumState* pAug, IppsPRNGState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGSetAugment( pAug, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGSetAugment( pAug, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00267.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetH0.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00267.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetH0.c index abced3471..79880e740 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00267.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetH0.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGSetH0( pH0, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGSetH0( pH0, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGSetH0( pH0, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetH0, (const IppsBigNumState* pH0, IppsPRNGState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGSetH0( pH0, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGSetH0( pH0, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00266.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetModulus.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00266.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetModulus.c index 4f12eb6be..938e4182c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00266.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetModulus.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGSetModulus( pMod, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGSetModulus( pMod, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGSetModulus( pMod, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetModulus,(const IppsBigNumState* pMod, IppsPRNGState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGSetModulus( pMod, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGSetModulus( pMod, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00269.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetSeed.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00269.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetSeed.c index 7a43b5dec..64441f1ab 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00269.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGSetSeed.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGSetSeed( pSeed, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGSetSeed( pSeed, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGSetSeed( pSeed, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGSetSeed, (const IppsBigNumState* pSeed,IppsPRNGState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGSetSeed( pSeed, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGSetSeed( pSeed, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00271.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00271.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen.c index a85bfe213..0f54d9227 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00271.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGen( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGen( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGen( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGen( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGen( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00273.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00273.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND.c index df270e2a5..7723ae488 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00273.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGenRDRAND( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGenRDRAND( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGenRDRAND( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGenRDRAND, (Ipp32u* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGenRDRAND( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGenRDRAND( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00274.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00274.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND_BN.c index 026213aa3..d2cb38bc1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00274.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGenRDRAND_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGenRDRAND_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGenRDRAND_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGenRDRAND_BN( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGenRDRAND_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGenRDRAND_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGenRDRAND_BN( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00272.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen_BN.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00272.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen_BN.c index bc58ec184..5f59ea47a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00272.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPRNGen_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPRNGen_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPRNGen_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPRNGen_BN( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPRNGen_BN, (IppsBigNumState* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPRNGen_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPRNGen_BN( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00279.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00279.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen.c index fecdfb0d6..dbfca4823 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00279.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeGen( nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeGen( nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeGen( nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeGen, (int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeGen( nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeGen( nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00281.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen_BN.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00281.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen_BN.c index 9151e2e6d..4d368b5a8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00281.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGen_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeGen_BN( pPrime, nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeGen_BN( pPrime, nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeGen_BN( pPrime, nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeGen_BN,(IppsBigNumState* pPrime, int nBits, int nTrials, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeGen_BN( pPrime, nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeGen_BN( pPrime, nBits, nTrials, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00283.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00283.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet.c index 263f2e9df..ee0c46b1e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00283.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) -IPPAPI(IppStatus, l9_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) IPPAPI(IppStatus, k1_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) +IPPAPI(IppStatus, l9_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) +IPPAPI(IppStatus, y8_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeGet( pPrime, pLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeGet( pPrime, pLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeGet( pPrime, pLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) -IPPAPI(IppStatus, h9_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeGet, (Ipp32u* pPrime, int* pLen, const IppsPrimeState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeGet( pPrime, pLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeGet( pPrime, pLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00277.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGetSize.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00277.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGetSize.c index 1e4f43426..69926e62b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00277.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeGetSize,(int nMaxBits, int* pSize)) -IPPAPI(IppStatus, l9_ippsPrimeGetSize,(int nMaxBits, int* pSize)) IPPAPI(IppStatus, k1_ippsPrimeGetSize,(int nMaxBits, int* pSize)) +IPPAPI(IppStatus, l9_ippsPrimeGetSize,(int nMaxBits, int* pSize)) +IPPAPI(IppStatus, y8_ippsPrimeGetSize,(int nMaxBits, int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeGetSize,(int nMaxBits, int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeGetSize,(int nMaxBits, int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeGetSize( nMaxBits, pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeGetSize( nMaxBits, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeGetSize( nMaxBits, pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeGetSize,(int nMaxBits, int* pSize)) -IPPAPI(IppStatus, h9_ippsPrimeGetSize,(int nMaxBits, int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeGetSize,(int nMaxBits, int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeGetSize( nMaxBits, pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeGetSize( nMaxBits, pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00284.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00284.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet_BN.c index 12fcdb41c..ff4b9a51f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00284.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeGet_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) -IPPAPI(IppStatus, l9_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) IPPAPI(IppStatus, k1_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) +IPPAPI(IppStatus, l9_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) +IPPAPI(IppStatus, y8_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeGet_BN( pPrime, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeGet_BN( pPrime, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeGet_BN( pPrime, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) -IPPAPI(IppStatus, h9_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeGet_BN,(IppsBigNumState* pPrime, const IppsPrimeState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeGet_BN( pPrime, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeGet_BN( pPrime, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00278.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeInit.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00278.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeInit.c index 8f6103e9a..6ceb594a6 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00278.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, l9_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) IPPAPI(IppStatus, k1_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, l9_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, y8_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeInit( nMaxBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeInit( nMaxBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeInit( nMaxBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, h9_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeInit( nMaxBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeInit( nMaxBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00285.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00285.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet.c index 7a0357e27..8a4c22008 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00285.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, l9_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) IPPAPI(IppStatus, k1_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, l9_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, y8_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeSet( pPrime, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeSet( pPrime, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeSet( pPrime, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, h9_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeSet, (const Ipp32u* pPrime, int nBits, IppsPrimeState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeSet( pPrime, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeSet( pPrime, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00286.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00286.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet_BN.c index ef1f3e3d0..43ccd07eb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00286.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeSet_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, l9_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) IPPAPI(IppStatus, k1_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, l9_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) +IPPAPI(IppStatus, y8_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeSet_BN( pPrime, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeSet_BN( pPrime, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeSet_BN( pPrime, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) -IPPAPI(IppStatus, h9_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeSet_BN,(const IppsBigNumState* pPrime, IppsPrimeState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeSet_BN( pPrime, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeSet_BN( pPrime, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00280.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00280.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest.c index d12adc0e9..8ee64f96c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00280.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeTest( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeTest( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeTest( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeTest,(int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeTest( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeTest( nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00282.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest_BN.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00282.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest_BN.c index 65770fe3b..bcbca8fd4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00282.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsPrimeTest_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsPrimeTest_BN( pPrime, nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsPrimeTest_BN( pPrime, nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsPrimeTest_BN( pPrime, nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsPrimeTest_BN,(const IppsBigNumState* pPrime, int nTrials, Ipp32u* pResult, IppsPrimeState* pCtx, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsPrimeTest_BN( pPrime, nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsPrimeTest_BN( pPrime, nTrials, pResult, pCtx, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00306.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00306.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP.c index 26f6e0336..352ab1577 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00306.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSADecrypt_OAEP( pSrc, pLab, labLen, pDst, pDstLen, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSADecrypt_OAEP( pSrc, pLab, labLen, pDst, pDstLen, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSADecrypt_OAEP( pSrc, pLab, labLen, pDst, pDstLen, pKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_OAEP,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSADecrypt_OAEP( pSrc, pLab, labLen, pDst, pDstLen, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSADecrypt_OAEP( pSrc, pLab, labLen, pDst, pDstLen, pKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00308.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP_rmf.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00308.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP_rmf.c index 96f0a8c8b..09232d53d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00308.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_OAEP_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSADecrypt_OAEP_rmf( pSrc, pLab, labLen, pDst, pDstLen, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSADecrypt_OAEP_rmf( pSrc, pLab, labLen, pDst, pDstLen, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSADecrypt_OAEP_rmf( pSrc, pLab, labLen, pDst, pDstLen, pKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_OAEP_rmf,(const Ipp8u* pSrc, const Ipp8u* pLab, int labLen, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSADecrypt_OAEP_rmf( pSrc, pLab, labLen, pDst, pDstLen, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSADecrypt_OAEP_rmf( pSrc, pLab, labLen, pDst, pDstLen, pKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00310.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_PKCSv15.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00310.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_PKCSv15.c index 196e93060..71ac07972 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00310.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSADecrypt_PKCSv15.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSADecrypt_PKCSv15( pSrc, pDst, pDstLen, pKey, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSADecrypt_PKCSv15( pSrc, pDst, pDstLen, pKey, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSADecrypt_PKCSv15( pSrc, pDst, pDstLen, pKey, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSADecrypt_PKCSv15,(const Ipp8u* pSrc, Ipp8u* pDst, int* pDstLen, const IppsRSAPrivateKeyState* pKey, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSADecrypt_PKCSv15( pSrc, pDst, pDstLen, pKey, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSADecrypt_PKCSv15( pSrc, pDst, pDstLen, pKey, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00305.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00305.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP.c index 026621731..46120d905 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00305.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAEncrypt_OAEP( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAEncrypt_OAEP( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAEncrypt_OAEP( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAEncrypt_OAEP( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAEncrypt_OAEP( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00307.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP_rmf.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00307.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP_rmf.c index 689b19a17..ab493f150 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00307.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_OAEP_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAEncrypt_OAEP_rmf( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAEncrypt_OAEP_rmf( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAEncrypt_OAEP_rmf( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_OAEP_rmf,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pLabel, int labLen, const Ipp8u* pSeed, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAEncrypt_OAEP_rmf( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAEncrypt_OAEP_rmf( pSrc, srcLen, pLabel, labLen, pSeed, pDst, pKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00309.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_PKCSv15.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00309.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_PKCSv15.c index c397fa50a..e0ca19533 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00309.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAEncrypt_PKCSv15.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAEncrypt_PKCSv15( pSrc, srcLen, pRndPS, pDst, pKey, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAEncrypt_PKCSv15( pSrc, srcLen, pRndPS, pDst, pKey, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAEncrypt_PKCSv15( pSrc, srcLen, pRndPS, pDst, pKey, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAEncrypt_PKCSv15,(const Ipp8u* pSrc, int srcLen, const Ipp8u* pRndPS, Ipp8u* pDst, const IppsRSAPublicKeyState* pKey, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAEncrypt_PKCSv15( pSrc, srcLen, pRndPS, pDst, pKey, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAEncrypt_PKCSv15( pSrc, srcLen, pRndPS, pDst, pKey, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00315.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00315.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15.c index ca38ff789..a0d481791 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00315.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSASign_PKCS1v15( pMsg, msgLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSASign_PKCS1v15( pMsg, msgLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSASign_PKCS1v15( pMsg, msgLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSASign_PKCS1v15( pMsg, msgLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSASign_PKCS1v15( pMsg, msgLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00317.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15_rmf.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00317.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15_rmf.c index d71e41533..da4a962c5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00317.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PKCS1v15_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSASign_PKCS1v15_rmf( pMsg, msgLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSASign_PKCS1v15_rmf( pMsg, msgLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSASign_PKCS1v15_rmf( pMsg, msgLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSASign_PKCS1v15_rmf( pMsg, msgLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSASign_PKCS1v15_rmf( pMsg, msgLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00311.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00311.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS.c index 4824e1ce4..a9f561b65 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00311.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSASign_PSS( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSASign_PSS( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSASign_PSS( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSASign_PSS( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSASign_PSS( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00313.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS_rmf.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00313.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS_rmf.c index 0e1e009cf..119392b37 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00313.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSASign_PSS_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSASign_PSS_rmf( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSASign_PSS_rmf( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSASign_PSS_rmf( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSASign_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState* pPrvKey, const IppsRSAPublicKeyState* pPubKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSASign_PSS_rmf( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSASign_PSS_rmf( pMsg, msgLen, pSalt, saltLen, pSign, pPrvKey, pPubKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00316.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00316.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15.c index cad90c3a6..1c4860d5f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00316.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAVerify_PKCS1v15( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAVerify_PKCS1v15( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAVerify_PKCS1v15( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAVerify_PKCS1v15( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAVerify_PKCS1v15( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00318.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15_rmf.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00318.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15_rmf.c index 33405ba8e..e8f3d7985 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00318.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PKCS1v15_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAVerify_PKCS1v15_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAVerify_PKCS1v15_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAVerify_PKCS1v15_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PKCS1v15_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAVerify_PKCS1v15_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAVerify_PKCS1v15_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00312.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00312.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS.c index bcb69ceaa..1f786e3ed 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00312.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAVerify_PSS( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAVerify_PSS( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAVerify_PSS( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PSS,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, IppHashAlgId hashAlg, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAVerify_PSS( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAVerify_PSS( pMsg, msgLen, pSign, pIsValid, pKey, hashAlg, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00314.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS_rmf.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00314.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS_rmf.c index e0df2c779..5f95bfe3a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00314.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSAVerify_PSS_rmf.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSAVerify_PSS_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSAVerify_PSS_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSAVerify_PSS_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSAVerify_PSS_rmf,(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState* pKey, const IppsHashMethod* pMethod, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSAVerify_PSS_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSAVerify_PSS_rmf( pMsg, msgLen, pSign, pIsValid, pKey, pMethod, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00302.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Decrypt.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00302.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Decrypt.c index caac0a97c..6d7d601e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00302.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Decrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_Decrypt( pCtxt, pPtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_Decrypt( pCtxt, pPtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_Decrypt( pCtxt, pPtxt, pKey, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, IppsBigNumState* pPtxt, const IppsRSAPrivateKeyState* pKey, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_Decrypt( pCtxt, pPtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_Decrypt( pCtxt, pPtxt, pKey, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00301.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Encrypt.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00301.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Encrypt.c index 573e554b2..95f2a26cd 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00301.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_Encrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) IPPAPI(IppStatus, k1_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, l9_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, y8_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_Encrypt( pPtxt, pCtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_Encrypt( pPtxt, pCtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_Encrypt( pPtxt, pCtxt, pKey, pScratchBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, IppsBigNumState* pCtxt, const IppsRSAPublicKeyState* pKey, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_Encrypt( pPtxt, pCtxt, pKey, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_Encrypt( pPtxt, pCtxt, pKey, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00303.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GenerateKeys.c similarity index 62% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00303.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GenerateKeys.c index f3b39d4ea..44c401386 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00303.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GenerateKeys.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GenerateKeys( pSrcPublicExp, pModulus, pPublicExp, pPrivateExp, pPrivateKeyType2, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GenerateKeys( pSrcPublicExp, pModulus, pPublicExp, pPrivateExp, pPrivateKeyType2, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GenerateKeys( pSrcPublicExp, pModulus, pPublicExp, pPrivateExp, pPrivateKeyType2, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GenerateKeys,(const IppsBigNumState* pSrcPublicExp, IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pPrivateKeyType2, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GenerateKeys( pSrcPublicExp, pModulus, pPublicExp, pPrivateExp, pPrivateKeyType2, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GenerateKeys( pSrcPublicExp, pModulus, pPublicExp, pPrivateExp, pPrivateKeyType2, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00300.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePrivateKey.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00300.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePrivateKey.c index c395387fd..86ea72a91 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00300.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePrivateKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetBufferSizePrivateKey( pBufferSize, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetBufferSizePrivateKey( pBufferSize, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetBufferSizePrivateKey( pBufferSize, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetBufferSizePrivateKey( pBufferSize, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetBufferSizePrivateKey( pBufferSize, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00299.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePublicKey.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00299.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePublicKey.c index ac3f9c3d2..2887876ed 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00299.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetBufferSizePublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetBufferSizePublicKey( pBufferSize, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetBufferSizePublicKey( pBufferSize, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetBufferSizePublicKey( pBufferSize, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetBufferSizePublicKey( pBufferSize, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetBufferSizePublicKey( pBufferSize, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00294.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType1.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00294.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType1.c index 3ff7b963e..50dbf2de5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00294.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPrivateKeyType1,(IppsBigNumState* pModulus, IppsBigNumState* pPrivateExp, const IppsRSAPrivateKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00298.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType2.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00298.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType2.c index 3d5f89a21..365ca362d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00298.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPrivateKeyType2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPrivateKeyType2,(IppsBigNumState* pFactorP, IppsBigNumState* pFactorQ, IppsBigNumState* pCrtExpP, IppsBigNumState* pCrtExpQ, IppsBigNumState* pInverseQ, const IppsRSAPrivateKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00290.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPublicKey.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00290.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPublicKey.c index 0662188a9..2390fedf8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00290.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetPublicKey( pModulus, pPublicExp, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, IppsBigNumState* pPublicExp, const IppsRSAPublicKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetPublicKey( pModulus, pPublicExp, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00291.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType1.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00291.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType1.c index 859d99d5e..f7ca0d1a8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00291.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, l9_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) IPPAPI(IppStatus, k1_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, l9_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, y8_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetSizePrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKeySize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetSizePrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetSizePrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKeySize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, h9_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetSizePrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetSizePrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKeySize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00295.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType2.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00295.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType2.c index 569e852df..c62bfaf8b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00295.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePrivateKeyType2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -IPPAPI(IppStatus, l9_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) IPPAPI(IppStatus, k1_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +IPPAPI(IppStatus, l9_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +IPPAPI(IppStatus, y8_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetSizePrivateKeyType2( factorPbitSize, factorQbitSize, pKeySize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetSizePrivateKeyType2( factorPbitSize, factorQbitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetSizePrivateKeyType2( factorPbitSize, factorQbitSize, pKeySize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -IPPAPI(IppStatus, h9_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetSizePrivateKeyType2( factorPbitSize, factorQbitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetSizePrivateKeyType2( factorPbitSize, factorQbitSize, pKeySize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00287.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePublicKey.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00287.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePublicKey.c index 13870c71d..8e9a8274f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00287.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_GetSizePublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, l9_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) IPPAPI(IppStatus, k1_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, l9_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, y8_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_GetSizePublicKey( rsaModulusBitSize, pubicExpBitSize, pKeySize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_GetSizePublicKey( rsaModulusBitSize, pubicExpBitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_GetSizePublicKey( rsaModulusBitSize, pubicExpBitSize, pKeySize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, h9_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_GetSizePublicKey( rsaModulusBitSize, pubicExpBitSize, pKeySize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_GetSizePublicKey( rsaModulusBitSize, pubicExpBitSize, pKeySize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00292.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType1.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00292.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType1.c index 0cb3e600e..d3cc2fe08 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00292.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, l9_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) IPPAPI(IppStatus, k1_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, l9_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, y8_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_InitPrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_InitPrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_InitPrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKey, keyCtxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, h9_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_InitPrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_InitPrivateKeyType1( rsaModulusBitSize, privateExpBitSize, pKey, keyCtxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00296.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00296.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType2.c index 465859a09..ed5ef6061 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00296.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPrivateKeyType2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, l9_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) IPPAPI(IppStatus, k1_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, l9_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, y8_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_InitPrivateKeyType2( factorPbitSize, factorQbitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_InitPrivateKeyType2( factorPbitSize, factorQbitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_InitPrivateKeyType2( factorPbitSize, factorQbitSize, pKey, keyCtxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, h9_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_InitPrivateKeyType2( factorPbitSize, factorQbitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_InitPrivateKeyType2( factorPbitSize, factorQbitSize, pKey, keyCtxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00288.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPublicKey.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00288.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPublicKey.c index d8929fa9c..8d34cf1de 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00288.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_InitPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, l9_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) IPPAPI(IppStatus, k1_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, l9_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, y8_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_InitPublicKey( rsaModulusBitSize, publicExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_InitPublicKey( rsaModulusBitSize, publicExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_InitPublicKey( rsaModulusBitSize, publicExpBitSize, pKey, keyCtxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, h9_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, IppsRSAPublicKeyState* pKey, int keyCtxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_InitPublicKey( rsaModulusBitSize, publicExpBitSize, pKey, keyCtxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_InitPublicKey( rsaModulusBitSize, publicExpBitSize, pKey, keyCtxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00293.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType1.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00293.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType1.c index b1caf4b74..03f0f9803 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00293.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_SetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_SetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_SetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, const IppsBigNumState* pPrivateExp, IppsRSAPrivateKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_SetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_SetPrivateKeyType1( pModulus, pPrivateExp, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00297.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType2.c similarity index 64% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00297.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType2.c index e837efcd2..09f19f411 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00297.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPrivateKeyType2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_SetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_SetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_SetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, const IppsBigNumState* pFactorQ, const IppsBigNumState* pCrtExpP, const IppsBigNumState* pCrtExpQ, const IppsBigNumState* pInverseQ, IppsRSAPrivateKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_SetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_SetPrivateKeyType2( pFactorP, pFactorQ, pCrtExpP, pCrtExpQ, pInverseQ, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00289.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPublicKey.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00289.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPublicKey.c index 64684aa63..5190b4c57 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00289.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_SetPublicKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, l9_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) IPPAPI(IppStatus, k1_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, l9_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, y8_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_SetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_SetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_SetPublicKey( pModulus, pPublicExp, pKey ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, h9_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, const IppsBigNumState* pPublicExp, IppsRSAPublicKeyState* pKey)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_SetPublicKey( pModulus, pPublicExp, pKey ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_SetPublicKey( pModulus, pPublicExp, pKey ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00304.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_ValidateKeys.c similarity index 62% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00304.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_ValidateKeys.c index fca61cf62..867ecec1e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00304.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRSA_ValidateKeys.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, l9_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) IPPAPI(IppStatus, k1_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, l9_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, y8_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPFUN(IppStatus,sgx_disp_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) +IPPFUN(IppStatus, sgx_disp_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRSA_ValidateKeys( pResult, pPublicKey, pPrivateKeyType2, pPrivateKeyType1, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRSA_ValidateKeys( pResult, pPublicKey, pPrivateKeyType2, pPrivateKeyType1, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRSA_ValidateKeys( pResult, pPublicKey, pPrivateKeyType2, pPrivateKeyType1, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, h9_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) - -IPPFUN(IppStatus,sgx_disp_ippsRSA_ValidateKeys,(int* pResult, const IppsRSAPublicKeyState* pPublicKey, const IppsRSAPrivateKeyState* pPrivateKeyType2, const IppsRSAPrivateKeyState* pPrivateKeyType1, Ipp8u* pScratchBuffer, int nTrials, IppsPrimeState* pPrimeGen, IppBitSupplier rndFunc, void* pRndParam)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRSA_ValidateKeys( pResult, pPublicKey, pPrivateKeyType2, pPrivateKeyType1, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRSA_ValidateKeys( pResult, pPublicKey, pPrivateKeyType2, pPrivateKeyType1, pScratchBuffer, nTrials, pPrimeGen, rndFunc, pRndParam ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00245.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRef_BN.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00245.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRef_BN.c index c1ca34670..a520daec2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00245.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsRef_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsRef_BN( pSgn, bitSize, ppData, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsRef_BN( pSgn, bitSize, ppData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsRef_BN( pSgn, bitSize, ppData, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, const IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsRef_BN( pSgn, bitSize, ppData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsRef_BN( pSgn, bitSize, ppData, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00105.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00105.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Duplicate.c index 159aac3ec..3d696695f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00105.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) -IPPAPI(IppStatus, l9_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) IPPAPI(IppStatus, k1_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) +IPPAPI(IppStatus, l9_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) +IPPAPI(IppStatus, y8_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) -IPPAPI(IppStatus, h9_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Duplicate,(const IppsSHA1State* pSrcState, IppsSHA1State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00110.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Final.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00110.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Final.c index 81dafa132..92c5ec4b4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00110.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) -IPPAPI(IppStatus, l9_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) IPPAPI(IppStatus, k1_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) +IPPAPI(IppStatus, l9_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) +IPPAPI(IppStatus, y8_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) -IPPAPI(IppStatus, h9_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Final,(Ipp8u* pMD, IppsSHA1State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00103.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00103.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetSize.c index 829b0eb1b..a623a5491 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00103.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSHA1GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSHA1GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSHA1GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSHA1GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSHA1GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00109.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00109.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetTag.c index f020bb75e..383f649aa 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00109.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) -IPPAPI(IppStatus, l9_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) IPPAPI(IppStatus, k1_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) +IPPAPI(IppStatus, l9_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) +IPPAPI(IppStatus, y8_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) -IPPAPI(IppStatus, h9_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA1State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00104.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Init.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00104.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Init.c index dd8732d7e..e94ed519d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00104.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Init,(IppsSHA1State* pState)) -IPPAPI(IppStatus, l9_ippsSHA1Init,(IppsSHA1State* pState)) IPPAPI(IppStatus, k1_ippsSHA1Init,(IppsSHA1State* pState)) +IPPAPI(IppStatus, l9_ippsSHA1Init,(IppsSHA1State* pState)) +IPPAPI(IppStatus, y8_ippsSHA1Init,(IppsSHA1State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Init,(IppsSHA1State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Init,(IppsSHA1State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Init,(IppsSHA1State* pState)) -IPPAPI(IppStatus, h9_ippsSHA1Init,(IppsSHA1State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Init,(IppsSHA1State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00111.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00111.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1MessageDigest.c index 5fb2bc34d..4a51a3873 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00111.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00106.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00106.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Pack.c index ceb78974a..cb26b14f0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00106.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Pack,(const IppsSHA1State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00107.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00107.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Unpack.c index af9fb99d1..334c77d26 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00107.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) -IPPAPI(IppStatus, l9_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) IPPAPI(IppStatus, k1_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) +IPPAPI(IppStatus, l9_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) +IPPAPI(IppStatus, y8_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) -IPPAPI(IppStatus, h9_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Unpack,(const Ipp8u* pBuffer, IppsSHA1State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00108.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Update.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00108.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Update.c index 054495401..dee3a61e0 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00108.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA1Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) -IPPAPI(IppStatus, l9_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) IPPAPI(IppStatus, k1_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) +IPPAPI(IppStatus, l9_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) +IPPAPI(IppStatus, y8_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA1Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA1Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA1Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) -IPPAPI(IppStatus, h9_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA1Update,(const Ipp8u* pSrc, int len, IppsSHA1State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA1Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA1Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00114.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00114.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Duplicate.c index e2455ea17..1d624c3f5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00114.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) -IPPAPI(IppStatus, l9_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) IPPAPI(IppStatus, k1_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) +IPPAPI(IppStatus, l9_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) +IPPAPI(IppStatus, y8_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) -IPPAPI(IppStatus, h9_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Duplicate,(const IppsSHA224State* pSrcState, IppsSHA224State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00119.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Final.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00119.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Final.c index 603652dda..ab7a5fda2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00119.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) -IPPAPI(IppStatus, l9_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) IPPAPI(IppStatus, k1_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) +IPPAPI(IppStatus, l9_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) +IPPAPI(IppStatus, y8_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) -IPPAPI(IppStatus, h9_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Final,(Ipp8u* pMD, IppsSHA224State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00112.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00112.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetSize.c index c73bc3782..e7f801086 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00112.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSHA224GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSHA224GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSHA224GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSHA224GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSHA224GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00118.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00118.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetTag.c index 3ba4e6cb9..50d1ca64f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00118.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) -IPPAPI(IppStatus, l9_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) IPPAPI(IppStatus, k1_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) +IPPAPI(IppStatus, l9_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) +IPPAPI(IppStatus, y8_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) -IPPAPI(IppStatus, h9_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA224State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00113.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Init.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00113.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Init.c index fb009cd6f..da1d4d7d2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00113.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Init,(IppsSHA224State* pState)) -IPPAPI(IppStatus, l9_ippsSHA224Init,(IppsSHA224State* pState)) IPPAPI(IppStatus, k1_ippsSHA224Init,(IppsSHA224State* pState)) +IPPAPI(IppStatus, l9_ippsSHA224Init,(IppsSHA224State* pState)) +IPPAPI(IppStatus, y8_ippsSHA224Init,(IppsSHA224State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Init,(IppsSHA224State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Init,(IppsSHA224State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Init,(IppsSHA224State* pState)) -IPPAPI(IppStatus, h9_ippsSHA224Init,(IppsSHA224State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Init,(IppsSHA224State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00120.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00120.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224MessageDigest.c index d314029ff..cf78bd16f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00120.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00115.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00115.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Pack.c index 49be24ae8..5364a9e66 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00115.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Pack,(const IppsSHA224State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00116.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00116.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Unpack.c index 5dabc8a5b..f79d1c5b3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00116.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) -IPPAPI(IppStatus, l9_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) IPPAPI(IppStatus, k1_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) +IPPAPI(IppStatus, l9_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) +IPPAPI(IppStatus, y8_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) -IPPAPI(IppStatus, h9_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Unpack,(const Ipp8u* pBuffer, IppsSHA224State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00117.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Update.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00117.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Update.c index 2adcf5842..f8afd7e75 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00117.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA224Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) -IPPAPI(IppStatus, l9_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) IPPAPI(IppStatus, k1_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) +IPPAPI(IppStatus, l9_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) +IPPAPI(IppStatus, y8_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA224Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA224Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA224Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) -IPPAPI(IppStatus, h9_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA224Update,(const Ipp8u* pSrc, int len, IppsSHA224State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA224Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA224Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00123.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00123.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Duplicate.c index 52523fa3e..01df16096 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00123.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) -IPPAPI(IppStatus, l9_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) IPPAPI(IppStatus, k1_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) +IPPAPI(IppStatus, l9_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) +IPPAPI(IppStatus, y8_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) -IPPAPI(IppStatus, h9_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Duplicate,(const IppsSHA256State* pSrcState, IppsSHA256State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00128.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Final.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00128.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Final.c index 0ab67c085..f8c43ef10 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00128.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) -IPPAPI(IppStatus, l9_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) IPPAPI(IppStatus, k1_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) +IPPAPI(IppStatus, l9_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) +IPPAPI(IppStatus, y8_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) -IPPAPI(IppStatus, h9_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Final,(Ipp8u* pMD, IppsSHA256State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00121.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00121.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetSize.c index c0618bd94..765706204 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00121.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSHA256GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSHA256GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSHA256GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSHA256GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSHA256GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00127.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00127.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetTag.c index 93038d447..01a560880 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00127.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) -IPPAPI(IppStatus, l9_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) IPPAPI(IppStatus, k1_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) +IPPAPI(IppStatus, l9_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) +IPPAPI(IppStatus, y8_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) -IPPAPI(IppStatus, h9_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA256State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00122.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Init.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00122.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Init.c index 262f4368e..f781e0e83 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00122.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Init,(IppsSHA256State* pState)) -IPPAPI(IppStatus, l9_ippsSHA256Init,(IppsSHA256State* pState)) IPPAPI(IppStatus, k1_ippsSHA256Init,(IppsSHA256State* pState)) +IPPAPI(IppStatus, l9_ippsSHA256Init,(IppsSHA256State* pState)) +IPPAPI(IppStatus, y8_ippsSHA256Init,(IppsSHA256State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Init,(IppsSHA256State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Init,(IppsSHA256State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Init,(IppsSHA256State* pState)) -IPPAPI(IppStatus, h9_ippsSHA256Init,(IppsSHA256State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Init,(IppsSHA256State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00129.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00129.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256MessageDigest.c index 0659945f2..0f0f374ed 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00129.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00124.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00124.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Pack.c index 05dc26c3a..65ecbb330 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00124.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Pack,(const IppsSHA256State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00125.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00125.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Unpack.c index 62a67ca90..bfe9d6c10 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00125.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) -IPPAPI(IppStatus, l9_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) IPPAPI(IppStatus, k1_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) +IPPAPI(IppStatus, l9_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) +IPPAPI(IppStatus, y8_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) -IPPAPI(IppStatus, h9_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Unpack,(const Ipp8u* pBuffer, IppsSHA256State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00126.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Update.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00126.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Update.c index 9f6758696..6e560afc1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00126.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA256Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) -IPPAPI(IppStatus, l9_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) IPPAPI(IppStatus, k1_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) +IPPAPI(IppStatus, l9_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) +IPPAPI(IppStatus, y8_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA256Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA256Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA256Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) -IPPAPI(IppStatus, h9_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA256Update,(const Ipp8u* pSrc, int len, IppsSHA256State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA256Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA256Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00132.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00132.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Duplicate.c index 27c97a5e6..e708bcecf 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00132.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) -IPPAPI(IppStatus, l9_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) IPPAPI(IppStatus, k1_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) +IPPAPI(IppStatus, l9_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) +IPPAPI(IppStatus, y8_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) -IPPAPI(IppStatus, h9_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Duplicate,(const IppsSHA384State* pSrcState, IppsSHA384State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00137.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Final.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00137.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Final.c index ca6616e3c..d5d3f79e5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00137.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) -IPPAPI(IppStatus, l9_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) IPPAPI(IppStatus, k1_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) +IPPAPI(IppStatus, l9_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) +IPPAPI(IppStatus, y8_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) -IPPAPI(IppStatus, h9_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Final,(Ipp8u* pMD, IppsSHA384State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00130.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00130.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetSize.c index af84e0ef7..d7ddc38e1 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00130.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSHA384GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSHA384GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSHA384GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSHA384GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSHA384GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00136.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00136.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetTag.c index bd3d1321e..0db3c1d7a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00136.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) -IPPAPI(IppStatus, l9_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) IPPAPI(IppStatus, k1_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) +IPPAPI(IppStatus, l9_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) +IPPAPI(IppStatus, y8_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) -IPPAPI(IppStatus, h9_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA384State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00131.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Init.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00131.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Init.c index c0f28db48..0d078f18a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00131.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Init,(IppsSHA384State* pState)) -IPPAPI(IppStatus, l9_ippsSHA384Init,(IppsSHA384State* pState)) IPPAPI(IppStatus, k1_ippsSHA384Init,(IppsSHA384State* pState)) +IPPAPI(IppStatus, l9_ippsSHA384Init,(IppsSHA384State* pState)) +IPPAPI(IppStatus, y8_ippsSHA384Init,(IppsSHA384State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Init,(IppsSHA384State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Init,(IppsSHA384State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Init,(IppsSHA384State* pState)) -IPPAPI(IppStatus, h9_ippsSHA384Init,(IppsSHA384State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Init,(IppsSHA384State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00138.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00138.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384MessageDigest.c index be9f63230..95b3f7842 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00138.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00133.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00133.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Pack.c index 6c7aa366d..1f319b871 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00133.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Pack,(const IppsSHA384State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00134.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00134.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Unpack.c index 829c4b8f1..d6a90536b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00134.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) -IPPAPI(IppStatus, l9_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) IPPAPI(IppStatus, k1_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) +IPPAPI(IppStatus, l9_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) +IPPAPI(IppStatus, y8_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) -IPPAPI(IppStatus, h9_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Unpack,(const Ipp8u* pBuffer, IppsSHA384State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00135.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Update.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00135.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Update.c index 894388b11..d7e21c9f7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00135.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA384Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) -IPPAPI(IppStatus, l9_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) IPPAPI(IppStatus, k1_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) +IPPAPI(IppStatus, l9_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) +IPPAPI(IppStatus, y8_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA384Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA384Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA384Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) -IPPAPI(IppStatus, h9_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA384Update,(const Ipp8u* pSrc, int len, IppsSHA384State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA384Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA384Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00141.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00141.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Duplicate.c index 78494d127..82082ffd5 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00141.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) -IPPAPI(IppStatus, l9_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) IPPAPI(IppStatus, k1_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) +IPPAPI(IppStatus, l9_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) +IPPAPI(IppStatus, y8_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) -IPPAPI(IppStatus, h9_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Duplicate,(const IppsSHA512State* pSrcState, IppsSHA512State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00146.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Final.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00146.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Final.c index aa535c052..826d6e7f8 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00146.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) -IPPAPI(IppStatus, l9_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) IPPAPI(IppStatus, k1_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) +IPPAPI(IppStatus, l9_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) +IPPAPI(IppStatus, y8_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) -IPPAPI(IppStatus, h9_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Final,(Ipp8u* pMD, IppsSHA512State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00139.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00139.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetSize.c index a85a2c055..312d8ae7c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00139.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSHA512GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSHA512GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSHA512GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSHA512GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSHA512GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00145.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00145.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetTag.c index b874c8e95..00404c522 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00145.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) -IPPAPI(IppStatus, l9_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) IPPAPI(IppStatus, k1_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) +IPPAPI(IppStatus, l9_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) +IPPAPI(IppStatus, y8_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) -IPPAPI(IppStatus, h9_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSHA512State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00140.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Init.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00140.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Init.c index e0034133d..bd98c260e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00140.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Init,(IppsSHA512State* pState)) -IPPAPI(IppStatus, l9_ippsSHA512Init,(IppsSHA512State* pState)) IPPAPI(IppStatus, k1_ippsSHA512Init,(IppsSHA512State* pState)) +IPPAPI(IppStatus, l9_ippsSHA512Init,(IppsSHA512State* pState)) +IPPAPI(IppStatus, y8_ippsSHA512Init,(IppsSHA512State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Init,(IppsSHA512State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Init,(IppsSHA512State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Init,(IppsSHA512State* pState)) -IPPAPI(IppStatus, h9_ippsSHA512Init,(IppsSHA512State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Init,(IppsSHA512State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00147.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00147.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512MessageDigest.c index 9002052f7..70d0ec4e4 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00147.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00142.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00142.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Pack.c index 7d5b8cbb8..9316ca3af 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00142.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Pack,(const IppsSHA512State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00143.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00143.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Unpack.c index 079d0831c..b5a78915e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00143.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) -IPPAPI(IppStatus, l9_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) IPPAPI(IppStatus, k1_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) +IPPAPI(IppStatus, l9_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) +IPPAPI(IppStatus, y8_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) -IPPAPI(IppStatus, h9_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Unpack,(const Ipp8u* pBuffer, IppsSHA512State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00144.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Update.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00144.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Update.c index 02b7480fb..b59451b14 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00144.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSHA512Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) -IPPAPI(IppStatus, l9_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) IPPAPI(IppStatus, k1_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) +IPPAPI(IppStatus, l9_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) +IPPAPI(IppStatus, y8_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSHA512Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSHA512Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSHA512Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) -IPPAPI(IppStatus, h9_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSHA512Update,(const Ipp8u* pSrc, int len, IppsSHA512State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSHA512Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSHA512Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00159.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Duplicate.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00159.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Duplicate.c index c86eab3cf..ae0d2cf35 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00159.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Duplicate.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) -IPPAPI(IppStatus, l9_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) IPPAPI(IppStatus, k1_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) +IPPAPI(IppStatus, l9_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) +IPPAPI(IppStatus, y8_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Duplicate( pSrcState, pDstState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) -IPPAPI(IppStatus, h9_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Duplicate,(const IppsSM3State* pSrcState, IppsSM3State* pDstState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Duplicate( pSrcState, pDstState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Duplicate( pSrcState, pDstState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00164.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Final.c similarity index 72% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00164.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Final.c index e41749d6d..3e093c57e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00164.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Final.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) -IPPAPI(IppStatus, l9_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) IPPAPI(IppStatus, k1_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) +IPPAPI(IppStatus, l9_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) +IPPAPI(IppStatus, y8_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Final( pMD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Final( pMD, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) -IPPAPI(IppStatus, h9_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Final,(Ipp8u* pMD, IppsSM3State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Final( pMD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Final( pMD, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00157.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00157.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetSize.c index 7c2f64714..46b3d619c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00157.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3GetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSM3GetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSM3GetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSM3GetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSM3GetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSM3GetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSM3GetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3GetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSM3GetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3GetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00163.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00163.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetTag.c index d437359b4..d6691ad2d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00163.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3GetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) -IPPAPI(IppStatus, l9_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) IPPAPI(IppStatus, k1_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) +IPPAPI(IppStatus, l9_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) +IPPAPI(IppStatus, y8_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3GetTag( pTag, tagLen, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) -IPPAPI(IppStatus, h9_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3GetTag,(Ipp8u* pTag, Ipp32u tagLen, const IppsSM3State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3GetTag( pTag, tagLen, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3GetTag( pTag, tagLen, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00158.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Init.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00158.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Init.c index af5180247..c740148ed 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00158.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Init,(IppsSM3State* pState)) -IPPAPI(IppStatus, l9_ippsSM3Init,(IppsSM3State* pState)) IPPAPI(IppStatus, k1_ippsSM3Init,(IppsSM3State* pState)) +IPPAPI(IppStatus, l9_ippsSM3Init,(IppsSM3State* pState)) +IPPAPI(IppStatus, y8_ippsSM3Init,(IppsSM3State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Init,(IppsSM3State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Init,(IppsSM3State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Init( pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Init( pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Init,(IppsSM3State* pState)) -IPPAPI(IppStatus, h9_ippsSM3Init,(IppsSM3State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Init,(IppsSM3State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Init( pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Init( pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00165.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3MessageDigest.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00165.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3MessageDigest.c index 4eba930f1..ef6d4a05f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00165.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3MessageDigest.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, l9_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) IPPAPI(IppStatus, k1_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, l9_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPAPI(IppStatus, y8_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPFUN(IppStatus,sgx_disp_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) +IPPFUN(IppStatus, sgx_disp_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3MessageDigest( pMsg, len, pMD ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -IPPAPI(IppStatus, h9_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3MessageDigest,(const Ipp8u* pMsg, int len, Ipp8u* pMD)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3MessageDigest( pMsg, len, pMD ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3MessageDigest( pMsg, len, pMD ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00160.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Pack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00160.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Pack.c index 37ce9b17d..2a90376d3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00160.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Pack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, l9_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) IPPAPI(IppStatus, k1_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, l9_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) +IPPAPI(IppStatus, y8_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Pack( pState, pBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Pack( pState, pBuffer ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) -IPPAPI(IppStatus, h9_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Pack,(const IppsSM3State* pState, Ipp8u* pBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Pack( pState, pBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Pack( pState, pBuffer ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00161.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Unpack.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00161.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Unpack.c index 9f697070b..690714e09 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00161.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Unpack.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) -IPPAPI(IppStatus, l9_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) IPPAPI(IppStatus, k1_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) +IPPAPI(IppStatus, l9_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) +IPPAPI(IppStatus, y8_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Unpack( pBuffer, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Unpack( pBuffer, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) -IPPAPI(IppStatus, h9_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Unpack,(const Ipp8u* pBuffer, IppsSM3State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Unpack( pBuffer, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Unpack( pBuffer, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00162.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Update.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00162.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Update.c index 9eb60b711..39bcad78a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00162.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSM3Update.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) -IPPAPI(IppStatus, l9_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) IPPAPI(IppStatus, k1_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) +IPPAPI(IppStatus, l9_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) +IPPAPI(IppStatus, y8_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) -IPPFUN(IppStatus,sgx_disp_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) +IPPFUN(IppStatus, sgx_disp_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSM3Update( pSrc, len, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSM3Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSM3Update( pSrc, len, pState ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) -IPPAPI(IppStatus, h9_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsSM3Update,(const Ipp8u* pSrc, int len, IppsSM3State* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSM3Update( pSrc, len, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSM3Update( pSrc, len, pState ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00048.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00048.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC.c index 83ebdc0ce..aff7791cc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00048.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00049.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS1.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00049.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS1.c index d26d3b449..2b7e8e44f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00049.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00050.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00050.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS2.c index ec5a4625a..a39d7e195 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00050.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00051.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS3.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00051.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS3.c index 5e08c0520..aa6301513 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00051.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCBC_CS3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00053.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00053.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCFB.c index 6ba30b449..b4d1a6c18 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00053.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00057.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCTR.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00057.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCTR.c index 9b494adc9..fd8e6ee2b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00057.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00043.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptECB.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00043.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptECB.c index af5801a33..1a9b4f26f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00043.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptECB( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptECB( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00055.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptOFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00055.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptOFB.c index abda7e7dc..24a5aceec 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00055.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4DecryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4DecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4DecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4DecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4DecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4DecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4DecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00044.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00044.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC.c index b62788b4a..8412bb6a7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00044.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCBC( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00045.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS1.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00045.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS1.c index aee63ea2e..ebfdd92b7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00045.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS1.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS1,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCBC_CS1( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00046.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS2.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00046.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS2.c index 11aaf656e..0f1c9ebf7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00046.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS2.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS2,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCBC_CS2( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00047.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS3.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00047.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS3.c index 3533a72aa..7c41090f3 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00047.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCBC_CS3.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCBC_CS3,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCBC_CS3( pSrc, pDst, len, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00052.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00052.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCFB.c index 1c6a1bf84..64eeced64 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00052.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsSMS4Spec* pCtx, const Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00056.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCTR.c similarity index 67% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00056.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCTR.c index dcf4f4d03..4154f615b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00056.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptCTR( pSrc, pDst, len, pCtx, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00042.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptECB.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00042.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptECB.c index 42f47c726..b7cd73259 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00042.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptECB( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsSMS4Spec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptECB( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptECB( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00054.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptOFB.c similarity index 68% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00054.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptOFB.c index 934d27488..0eb3b7bd7 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00054.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4EncryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4EncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4EncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4EncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4EncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsSMS4Spec* pCtx, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4EncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4EncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00039.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4GetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00039.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4GetSize.c index 69c4f843d..80dbc8c3d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00039.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4GetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4GetSize,(int *pSize)) -IPPAPI(IppStatus, l9_ippsSMS4GetSize,(int *pSize)) IPPAPI(IppStatus, k1_ippsSMS4GetSize,(int *pSize)) +IPPAPI(IppStatus, l9_ippsSMS4GetSize,(int *pSize)) +IPPAPI(IppStatus, y8_ippsSMS4GetSize,(int *pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4GetSize,(int *pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4GetSize,(int *pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4GetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4GetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4GetSize,(int *pSize)) -IPPAPI(IppStatus, h9_ippsSMS4GetSize,(int *pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4GetSize,(int *pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4GetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4GetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00040.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4Init.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00040.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4Init.c index bfe0e1cc5..b1845c755 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00040.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4Init.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) -IPPAPI(IppStatus, l9_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) IPPAPI(IppStatus, k1_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) +IPPAPI(IppStatus, l9_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) +IPPAPI(IppStatus, y8_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4Init( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4Init( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4Init( pKey, keyLen, pCtx, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) -IPPAPI(IppStatus, h9_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4Init,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4Init( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4Init( pKey, keyLen, pCtx, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00041.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4SetKey.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00041.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4SetKey.c index 5456dbd76..09172933c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00041.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4SetKey.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4SetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4SetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4SetKey( pKey, keyLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4SetKey,(const Ipp8u* pKey, int keyLen, IppsSMS4Spec* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4SetKey( pKey, keyLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4SetKey( pKey, keyLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00064.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMDecrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00064.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMDecrypt.c index 440e2a48b..03306391c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00064.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMDecrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMDecrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMDecrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMDecrypt( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMDecrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMDecrypt( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00063.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMEncrypt.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00063.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMEncrypt.c index 8a1575563..22817efbb 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00063.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMEncrypt.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMEncrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMEncrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMEncrypt( pSrc, pDst, len, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMEncrypt( pSrc, pDst, len, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMEncrypt( pSrc, pDst, len, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00058.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetSize.c similarity index 73% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00058.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetSize.c index ea268852b..f118c802e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00058.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetSize.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMGetSize,(int* pSize)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMGetSize,(int* pSize)) IPPAPI(IppStatus, k1_ippsSMS4_CCMGetSize,(int* pSize)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMGetSize,(int* pSize)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMGetSize,(int* pSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMGetSize,(int* pSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMGetSize,(int* pSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMGetSize( pSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMGetSize( pSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMGetSize,(int* pSize)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMGetSize,(int* pSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMGetSize,(int* pSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMGetSize( pSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMGetSize( pSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00065.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetTag.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00065.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetTag.c index 616c7f2bf..aa9455bc2 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00065.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMGetTag.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMGetTag( pTag, tagLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMGetTag( pTag, tagLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMGetTag( pTag, tagLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMGetTag,(Ipp8u* pTag, int tagLen, const IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMGetTag( pTag, tagLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMGetTag( pTag, tagLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00059.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMInit.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00059.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMInit.c index 6963e2287..bbdb66189 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00059.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMInit.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) IPPAPI(IppStatus, k1_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMInit( pKey, keyLen, pCtx, ctxSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMInit,(const Ipp8u* pKey, int keyLen, IppsSMS4_CCMState* pCtx, int ctxSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMInit( pKey, keyLen, pCtx, ctxSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMInit( pKey, keyLen, pCtx, ctxSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00060.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMMessageLen.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00060.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMMessageLen.c index 4a2cd10be..a8cd0381b 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00060.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMMessageLen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMMessageLen( msgLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMMessageLen( msgLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMMessageLen( msgLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMMessageLen,(Ipp64u msgLen, IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMMessageLen( msgLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMMessageLen( msgLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00062.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMStart.c similarity index 69% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00062.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMStart.c index 79809d216..744e5ae6e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00062.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMStart.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMStart( pIV, ivLen, pAD, adLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMStart( pIV, ivLen, pAD, adLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMStart( pIV, ivLen, pAD, adLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMStart,(const Ipp8u* pIV, int ivLen, const Ipp8u* pAD, int adLen, IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMStart( pIV, ivLen, pAD, adLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMStart( pIV, ivLen, pAD, adLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00061.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMTagLen.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00061.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMTagLen.c index 7c9006118..eb801212c 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00061.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSMS4_CCMTagLen.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, l9_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) IPPAPI(IppStatus, k1_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, l9_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) +IPPAPI(IppStatus, y8_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSMS4_CCMTagLen( tagLen, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSMS4_CCMTagLen( tagLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSMS4_CCMTagLen( tagLen, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) -IPPAPI(IppStatus, h9_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsSMS4_CCMTagLen,(int tagLen, IppsSMS4_CCMState* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSMS4_CCMTagLen( tagLen, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSMS4_CCMTagLen( tagLen, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00255.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSetOctString_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00255.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSetOctString_BN.c index 0b7218a71..49743e662 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00255.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSetOctString_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSetOctString_BN( pStr, strLen, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSetOctString_BN( pStr, strLen, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSetOctString_BN( pStr, strLen, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00243.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSet_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00243.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSet_BN.c index c1658c7d1..9af25431e 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00243.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSet_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) -IPPAPI(IppStatus, l9_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) IPPAPI(IppStatus, k1_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) +IPPAPI(IppStatus, l9_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) +IPPAPI(IppStatus, y8_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) -IPPFUN(IppStatus,sgx_disp_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) +IPPFUN(IppStatus, sgx_disp_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSet_BN( sgn, length, pData, pBN ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSet_BN( sgn, length, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSet_BN( sgn, length, pData, pBN ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) -IPPAPI(IppStatus, h9_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) - -IPPFUN(IppStatus,sgx_disp_ippsSet_BN,(IppsBigNumSGN sgn, int length, const Ipp32u* pData, IppsBigNumState* pBN)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSet_BN( sgn, length, pData, pBN ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSet_BN( sgn, length, pData, pBN ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00248.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSub_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00248.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSub_BN.c index d8fd33f25..7a3abc295 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00248.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsSub_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, l9_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) IPPAPI(IppStatus, k1_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, l9_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, y8_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPFUN(IppStatus,sgx_disp_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPFUN(IppStatus, sgx_disp_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsSub_BN( pA, pB, pR ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsSub_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsSub_BN( pA, pB, pR ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, h9_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) - -IPPFUN(IppStatus,sgx_disp_ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsSub_BN( pA, pB, pR ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsSub_BN( pA, pB, pR ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00008.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCBC.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00008.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCBC.c index 4e33f907e..85da7632d 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00008.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESDecryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESDecryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESDecryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESDecryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESDecryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00010.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCFB.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00010.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCFB.c index 88b994b92..c7a499b06 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00010.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESDecryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00014.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCTR.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00014.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCTR.c index dc535cce5..4a82c4d74 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00014.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESDecryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESDecryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESDecryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESDecryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESDecryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00006.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptECB.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00006.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptECB.c index 077a084d2..5bcd29859 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00006.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESDecryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESDecryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESDecryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESDecryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESDecryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00012.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptOFB.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00012.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptOFB.c index 858e3f63f..876a1bdfe 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00012.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESDecryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESDecryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESDecryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00007.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCBC.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00007.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCBC.c index 4fe7c4950..2f9fc5ccc 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00007.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCBC.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESEncryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESEncryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESEncryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCBC,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESEncryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESEncryptCBC( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00009.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCFB.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00009.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCFB.c index 73b9f67aa..87ce91706 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00009.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int cfbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, const Ipp8u* pIV, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESEncryptCFB( pSrc, pDst, len, cfbBlkSize, pCtx1, pCtx2, pCtx3, pIV, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00013.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCTR.c similarity index 65% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00013.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCTR.c index e76957bec..6e5b50b49 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00013.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptCTR.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, l9_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) IPPAPI(IppStatus, k1_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, l9_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, y8_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPFUN(IppStatus, sgx_disp_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESEncryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESEncryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESEncryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, h9_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESEncryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESEncryptCTR( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, pCtrValue, ctrNumBitSize ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00005.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptECB.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00005.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptECB.c index 8cdc8e3c5..67d95614a 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00005.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptECB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPAPI(IppStatus, l9_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) IPPAPI(IppStatus, k1_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPAPI(IppStatus, l9_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPAPI(IppStatus, y8_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) +IPPFUN(IppStatus, sgx_disp_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESEncryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESEncryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESEncryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -IPPAPI(IppStatus, h9_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptECB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, IppsCPPadding padding)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESEncryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESEncryptECB( pSrc, pDst, len, pCtx1, pCtx2, pCtx3, padding ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00011.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptOFB.c similarity index 66% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00011.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptOFB.c index 674979398..3d4af1130 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00011.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTDESEncryptOFB.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPAPI(IppStatus, l9_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) IPPAPI(IppStatus, k1_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPAPI(IppStatus, l9_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPAPI(IppStatus, y8_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) +IPPFUN(IppStatus, sgx_disp_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTDESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTDESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTDESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -IPPAPI(IppStatus, h9_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) - -IPPFUN(IppStatus,sgx_disp_ippsTDESEncryptOFB,(const Ipp8u* pSrc, Ipp8u* pDst, int len, int ofbBlkSize, const IppsDESSpec* pCtx1, const IppsDESSpec* pCtx2, const IppsDESSpec* pCtx3, Ipp8u* pIV)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTDESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTDESEncryptOFB( pSrc, pDst, len, ofbBlkSize, pCtx1, pCtx2, pCtx3, pIV ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00275.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED.c similarity index 71% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00275.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED.c index 71d178303..dcc2fe28f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00275.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTRNGenRDSEED( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTRNGenRDSEED( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTRNGenRDSEED( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsTRNGenRDSEED, (Ipp32u* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTRNGenRDSEED( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTRNGenRDSEED( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00276.c b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED_BN.c similarity index 70% rename from sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00276.c rename to sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED_BN.c index da7f6d792..54fba285f 100644 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00276.c +++ b/sdk/tlibcrypto/ipp/ipp_disp/intel64/ippsTRNGenRDSEED_BN.c @@ -31,7 +31,10 @@ #include "ippcp.h" -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg +#ifndef IPP_CALL +#define IPP_CALL IPP_STDCALL +#endif +#define IPPFUN(type,name,arg) extern type IPP_CALL name arg #ifndef NULL #ifdef __cplusplus @@ -43,49 +46,37 @@ #if defined (_M_AMD64) || defined (__x86_64__) - #define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) #define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) #define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) +#ifdef __cplusplus +extern "C" { +#endif -IPPAPI(IppStatus, y8_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, l9_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) IPPAPI(IppStatus, k1_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, l9_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPAPI(IppStatus, y8_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPFUN(IppStatus,sgx_disp_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) +IPPFUN(IppStatus, sgx_disp_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) { - Ipp64u features; - ippcpGetCpuFeatures( &features ); + Ipp64u _features; + _features = ippcpGetEnabledCpuFeatures(); - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { + if( AVX3I_FEATURES == ( _features & AVX3I_FEATURES )) { return k1_ippsTRNGenRDSEED_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { + } else + if( ippCPUID_AVX2 == ( _features & ippCPUID_AVX2 )) { return l9_ippsTRNGenRDSEED_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { + } else + if( ippCPUID_SSE42 == ( _features & ippCPUID_SSE42 )) { return y8_ippsTRNGenRDSEED_BN( pRand, nBits, pCtx ); - } else + } else return ippStsCpuNotSupportedErr; } -#else - -IPPAPI(IppStatus, p8_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -IPPAPI(IppStatus, h9_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) - -IPPFUN(IppStatus,sgx_disp_ippsTRNGenRDSEED_BN,(IppsBigNumState* pRand, int nBits, void* pCtx)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsTRNGenRDSEED_BN( pRand, nBits, pCtx ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsTRNGenRDSEED_BN( pRand, nBits, pCtx ); - } else - return ippStsCpuNotSupportedErr; +#ifdef __cplusplus } #endif + +#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00078.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00078.c deleted file mode 100644 index 58b3f893a..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00078.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, l9_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, k1_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsAES_GCMProcessAAD( pAAD, ivAAD, pState ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsAES_GCMProcessAAD( pAAD, ivAAD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsAES_GCMProcessAAD( pAAD, ivAAD, pState ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, h9_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) - -IPPFUN(IppStatus,sgx_disp_ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, IppsAES_GCMState* pState)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsAES_GCMProcessAAD( pAAD, ivAAD, pState ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsAES_GCMProcessAAD( pAAD, ivAAD, pState ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00500.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00500.c deleted file mode 100644 index 55c44f562..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00500.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignDSA,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSignDSA( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00501.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00501.c deleted file mode 100644 index 04deb9d3a..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00501.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifyDSA,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECVerifyDSA( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00502.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00502.c deleted file mode 100644 index 4e2d6bfa0..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00502.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignNR,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSignNR( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00503.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00503.c deleted file mode 100644 index baa383f20..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00503.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifyNR,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECVerifyNR( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00504.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00504.c deleted file mode 100644 index dd215f6d2..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00504.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECSignSM2,(const IppsBigNumState* pMsgDigest, const IppsBigNumState* pRegPrivate, IppsBigNumState* pEphPrivate, IppsBigNumState* pSignR, IppsBigNumState* pSignS, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECSignSM2( pMsgDigest, pRegPrivate, pEphPrivate, pSignR, pSignS, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00505.c b/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00505.c deleted file mode 100644 index 36d08f915..000000000 --- a/sdk/tlibcrypto/ipp/ipp_disp/ippcpsgx_disp00505.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "ippcp.h" - -#define IPPFUN(type,name,arg) extern type IPP_STDCALL name arg - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#if defined (_M_AMD64) || defined (__x86_64__) - - -#define AVX3I_FEATURES ( ippCPUID_SHA|ippCPUID_AVX512VBMI|ippCPUID_AVX512VBMI2|ippCPUID_AVX512IFMA|ippCPUID_AVX512GFNI|ippCPUID_AVX512VAES|ippCPUID_AVX512VCLMUL ) -#define AVX3X_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512VL|ippCPUID_AVX512BW|ippCPUID_AVX512DQ ) -#define AVX3M_FEATURES ( ippCPUID_AVX512F|ippCPUID_AVX512CD|ippCPUID_AVX512PF|ippCPUID_AVX512ER ) - - -IPPAPI(IppStatus, y8_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, l9_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, k1_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( AVX3I_FEATURES == ( features & AVX3I_FEATURES )) { - return k1_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return l9_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return y8_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#else - - -IPPAPI(IppStatus, p8_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, h9_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) - -IPPFUN(IppStatus,sgx_disp_ippsGFpECVerifySM2,(const IppsBigNumState* pMsgDigest, const IppsGFpECPoint* pRegPublic, const IppsBigNumState* pSignR, const IppsBigNumState* pSignS, IppECResult* pResult, IppsGFpECState* pEC, Ipp8u* pScratchBuffer)) -{ - Ipp64u features; - ippcpGetCpuFeatures( &features ); - - if( ippCPUID_AVX2 == ( features & ippCPUID_AVX2 )) { - return h9_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - if( ippCPUID_SSE42 == ( features & ippCPUID_SSE42 )) { - return p8_ippsGFpECVerifySM2( pMsgDigest, pRegPublic, pSignR, pSignS, pResult, pEC, pScratchBuffer ); - } else - return ippStsCpuNotSupportedErr; -} -#endif diff --git a/sdk/tlibcxx/include/__hash_table b/sdk/tlibcxx/include/__hash_table index 521ebbf2c..8c926ad8f 100644 --- a/sdk/tlibcxx/include/__hash_table +++ b/sdk/tlibcxx/include/__hash_table @@ -2073,7 +2073,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& size_type __bc = bucket_count(); bool __inserted = false; __next_pointer __nd; - size_t __chash; + size_t __chash = 0; if (__bc != 0) { __chash = __constrain_hash(__hash, __bc); diff --git a/sdk/tlibcxx/include/memory b/sdk/tlibcxx/include/memory index 3989ceae4..185e3cf0f 100644 --- a/sdk/tlibcxx/include/memory +++ b/sdk/tlibcxx/include/memory @@ -701,7 +701,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_relaxed_load(_ValueType const* __value) { -#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) && \ +#if (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) && \ defined(__ATOMIC_RELAXED) && \ (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC)) return __atomic_load_n(__value, __ATOMIC_RELAXED); @@ -713,7 +713,7 @@ _ValueType __libcpp_relaxed_load(_ValueType const* __value) { template inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_acquire_load(_ValueType const* __value) { -#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) && \ +#if (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) && \ defined(__ATOMIC_ACQUIRE) && \ (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC)) return __atomic_load_n(__value, __ATOMIC_ACQUIRE); @@ -2452,7 +2452,8 @@ template inline _LIBCPP_INLINE_VISIBILITY _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT { -#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) +#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && \ + (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED); #else return __t += 1; @@ -2463,7 +2464,8 @@ template inline _LIBCPP_INLINE_VISIBILITY _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT { -#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) +#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && \ + (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL); #else return __t -= 1; diff --git a/sdk/tlibcxx/include/type_traits b/sdk/tlibcxx/include/type_traits index 59dfd1e9b..e4f66aa47 100644 --- a/sdk/tlibcxx/include/type_traits +++ b/sdk/tlibcxx/include/type_traits @@ -1682,12 +1682,12 @@ struct __is_core_convertible<_Tp, _Up, decltype( // is_convertible -#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) +#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) template struct _LIBCPP_TEMPLATE_VIS is_convertible - : public integral_constant {}; + : public integral_constant {}; -#else // __has_feature(is_convertible_to) +#else // __has_builtin(__is_convertible) namespace __is_convertible_imp { @@ -1754,7 +1754,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_convertible static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; }; -#endif // __has_feature(is_convertible_to) +#endif // __has_builtin(__is_convertible) #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template diff --git a/sdk/tlibcxx/src/include/atomic_support.h b/sdk/tlibcxx/src/include/atomic_support.h index ee546337d..749726e75 100644 --- a/sdk/tlibcxx/src/include/atomic_support.h +++ b/sdk/tlibcxx/src/include/atomic_support.h @@ -28,7 +28,8 @@ # define _LIBCPP_HAS_ATOMIC_BUILTINS #endif -#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) +#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && \ + (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) # if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") # else @@ -40,7 +41,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace { -#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) +#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && \ + (!defined(_LIBCPP_HAS_NO_THREADS) || defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)) enum __libcpp_atomic_order { _AO_Relaxed = __ATOMIC_RELAXED, diff --git a/sdk/trts/init_enclave.cpp b/sdk/trts/init_enclave.cpp index 4297e858f..dbdf7ecf5 100644 --- a/sdk/trts/init_enclave.cpp +++ b/sdk/trts/init_enclave.cpp @@ -58,10 +58,12 @@ int EDMM_supported __attribute__((section(RELRO_SECTION_NAME))) = 0; sdk_version_t g_sdk_version __attribute__((section(RELRO_SECTION_NAME))) = SDK_VERSION_1_5; uint64_t g_enclave_base __attribute__((section(RELRO_SECTION_NAME))) = 0; uint64_t g_enclave_size __attribute__((section(RELRO_SECTION_NAME))) = 0; +int g_aexnotify_supported __attribute__((section(RELRO_SECTION_NAME))) = 0; const volatile global_data_t g_global_data __attribute__((section(".niprod"))) = {VERSION_UINT, 1, 2, 3, 4, 5, 6, 0, 0, 0, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, {{{0, 0, 0, 0, 0, 0, 0}}}, 0, 0, 0}; + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, + {{{0, 0, 0, 0, 0, 0, 0}}}, 0, 0, 0, 0}; // Make sure to access this with atomics or the {get,set}_enclave_state assembly wrappers. uint32_t g_enclave_state __attribute__((section(".nipd"))) = ENCLAVE_INIT_NOT_STARTED; @@ -82,6 +84,7 @@ extern "C" int rsrv_mem_init(void *_rsrv_mem_base, size_t _rsrv_mem_size, size_t #ifndef SE_SIM extern "C" int init_rts_emas(size_t rts_base, layout_t *start, layout_t *end); extern "C" int sgx_mm_init(size_t, size_t); +extern "C" int emalloc_init_with_reserved_mem(size_t); #endif // init_enclave() // Initialize enclave. @@ -174,6 +177,8 @@ extern "C" int init_enclave(void *enclave_base, void *ms) { return -1; } + + g_aexnotify_supported = feature_supported((const uint64_t *)sys_features.system_feature_set, AEXNOTIFY_BIT); if (heap_init(get_heap_base(), get_heap_size(), get_heap_min_size(), EDMM_supported) != SGX_SUCCESS) return -1; @@ -301,6 +306,9 @@ sgx_status_t do_init_enclave(void *ms, void *tcs) if (sgx_mm_init(user_base, user_end)) return SGX_ERROR_UNEXPECTED; + if (emalloc_init_with_reserved_mem(g_global_data.edmm_bk_overhead)) + return SGX_ERROR_UNEXPECTED; + int ret = init_rts_emas(rts_base, layout_start, layout); if (ret != SGX_SUCCESS) { return SGX_ERROR_UNEXPECTED; diff --git a/sdk/trts/linux/Makefile b/sdk/trts/linux/Makefile index 9424be04c..374007bee 100644 --- a/sdk/trts/linux/Makefile +++ b/sdk/trts/linux/Makefile @@ -46,6 +46,14 @@ CXXFLAGS += -Werror $(ENCLAVE_CXXFLAGS) \ TCFLAGS += -nostdinc \ -I$(COMMON_DIR)/inc/tlibc/ +ifneq ($(MITIGATION-CVE-2020-0551), LOAD) +ifneq ($(MITIGATION-CVE-2020-0551), CF) +# Enable below flag to treat warning as error for assembly code +# It doesn't work for mitigation mode. + TCFLAGS += -Wa,--fatal-warnings +endif +endif + LDCFLAGS := -shared -nostdlib -nodefaultlibs -nostartfiles CPP_SRCS := $(filter-out ../trts_emm_sim.cpp, $(wildcard ../*.cpp)) diff --git a/sdk/trts/linux/trts_mitigation.S b/sdk/trts/linux/trts_mitigation.S new file mode 100644 index 000000000..3b6166139 --- /dev/null +++ b/sdk/trts/linux/trts_mitigation.S @@ -0,0 +1,388 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// Generates code that consumes `n` cycles by repeatedly moving from register +// `r` to itself. +.macro CYCLE_DELAY n r + lea (\r), \r +.if \n-1 +CYCLE_DELAY "(\n-1)" \r +.endif +.endm + + .data + .align 0x1000 /* 4KB */ +.globl aex_notify_c3_cache +aex_notify_c3_cache: + .space 0x1000 /* 4KB */ + +/* + * Description: + * The file provides mitigations for SGX-Step + */ + + .file "trts_mitigation.S" + +#include "trts_pic.h" +#include "../trts_mitigation.h" + + /* .text */ + .section .nipx,"ax",@progbits + +/* + * ------------------------------------------------------------------------- + * extern "C" + * void constant_time_apply_sgxstep_mitigation_and_continue_execution( + * sgx_exception_info_t *info, + * uintptr_t ssa_aexnotify_addr, + * uintptr_t stack_tickle_pages, + * uintptr_t code_tickle_page, + * uintptr_t data_tickle_page, + * uintptr_t c3_byte_address); + * + * Function: constant_time_apply_sgxstep_mitigation_and_continue_execution + * Mitigate SGX-Step and return to the point at which the most recent + * interrupt/exception occurred. + * Parameters: + * - info: pointer to the SGX exception info for the most recent + * interrupt/exception + * - ssa_aexnotify_addr: address of the SSA[0].GPRSGX.AEXNOTIFY byte + * - stack_tickle_pages: Base address of stack page(s) to tickle + * - code_tickle_page: Base address of code page to tickle + * - data_tickle_page: Base address of data page to tickle + * - c3_byte_address: Address of a c3 byte in code_tickle_page + * There are three additional "implicit" parameters to this function: + * 1. The low-order bit of `stack_tickle_pages` is 1 if a second stack + * page should be tickled (specifically, the stack page immediately + * below the page specified in the upper bits) + * 2. The low-order bit of `code_tickle_page` is 1 if the cycle delay + * should be added to the mitigation + * 3. The low-order bit of `data_tickle_page` is 1 if `data_tickle_page` + * is writable, and therefore should be tested for write permissions + * by the mitigation + * + * Stack: + * bottom of stack -> --------------------------- + * | Lower frame(s) | + * --------------------------- + * rsp of main flow ---+ | Stack frame of the "main | + * == | | flow" function that was | + * rsp @mitigation_begin -> | interrupted |<--+-(irq mitigation) + * --------------------------- | + * | ... |<--+-(irq c3) + * | red zone (128 bytes) | | + * | ... | | + * +- --------------------------- | + * +-|-| rsvd main-flow RIP |-1 | + * | | | rsvd main-flow RAX |-2 | + * | | | rsvd main-flow RCX |-3 | + * (main-flow regs that | | | rsvd main-flow RDX |-4 | + * will be reset in | | | rsvd main-flow RBX |-5 | + * ct_restore_state) | | | rsvd main-flow RBP |-6 | + * | | | rsvd main-flow RSI |-7 | + * | | | rsvd main-flow RDI |-8 | + * | | | rsvd main-flow FLAGS |-9 | + * +-|-| rsvd main-flow -8(rsp) |-10| + * +-|-| &SSA[0].AEXNOTIFY (rsi) |-11| + * (copy of parameters | | | ptr stack tickle (rdx) |-12| + * passed @entry) | | | ptr code tickle (rcx) |-13| + * | | | ptr data tickle (r8) |-14| + * +-|-| ptr c3 byte (r9) |-15| + * (this whole rsvd area | --------------------------- | + * is persistent and will | | ... | | + * not be touched by | | padding for alignment | | + * stage-1/2 handlers) +-| ... | | + * +-- --------------------------- | + * | | exception_type | | + * | | exception_vec | | + * | | pre-irq RIP |17 | + * | | pre-irq RFLAGS |16 | + * | | pre-irq R15 |15 | + * (pre-irq CPU state | | pre-irq R14 |14 | + * prepared by stage-1 | | pre-irq R13 |13 | + * handler in | | pre-irq R12 |12 | + * trts_handle_exception)| | pre-irq R11 |11 | + * | | pre-irq R10 |10 | + * | | pre-irq R9 |9 | + * | | pre-irq R8 |8 | + * | | pre-irq RDI |7 | + * | | pre-irq RSI |6 | + * | | pre-irq RBP |5 | + * | | pre-irq RSP |4--+ + * | | pre-irq RBX |3 + * | | pre-irq RDX |2 + * | | pre-irq RCX |1 + * rdi @entry -> | pre-irq RAX |0 + * +-- ---------------------------| + * rsp @second_phase -> | pre-irq RIP (for dbg) | + * ---------------------------| + * | Stack frame of stage-2 | + * | internal_handle_exception | + * rsp @entry -> | ... | + * --------------------------- + * ------------------------------------------------------------------------- + */ + +#define RSVD_BOTTOM (-RED_ZONE_SIZE-0*SE_WORDSIZE) +#define RSVD_RIP_OFFSET (-RED_ZONE_SIZE-1*SE_WORDSIZE) +#define RSVD_RAX_OFFSET (-RED_ZONE_SIZE-2*SE_WORDSIZE) +#define RSVD_RCX_OFFSET (-RED_ZONE_SIZE-3*SE_WORDSIZE) +#define RSVD_RDX_OFFSET (-RED_ZONE_SIZE-4*SE_WORDSIZE) +#define RSVD_RBX_OFFSET (-RED_ZONE_SIZE-5*SE_WORDSIZE) +#define RSVD_RBP_OFFSET (-RED_ZONE_SIZE-6*SE_WORDSIZE) +#define RSVD_RSI_OFFSET (-RED_ZONE_SIZE-7*SE_WORDSIZE) +#define RSVD_RDI_OFFSET (-RED_ZONE_SIZE-8*SE_WORDSIZE) +#define RSVD_FLAGS_OFFSET (-RED_ZONE_SIZE-9*SE_WORDSIZE) +#define RSVD_REDZONE_WORD_OFFSET (-RED_ZONE_SIZE-10*SE_WORDSIZE) +#define RSVD_AEXNOTIFY_ADDRESS_OFFSET (-RED_ZONE_SIZE-11*SE_WORDSIZE) +#define RSVD_STACK_TICKLE_OFFSET (-RED_ZONE_SIZE-12*SE_WORDSIZE) +#define RSVD_CODE_TICKLE_OFFSET (-RED_ZONE_SIZE-13*SE_WORDSIZE) +#define RSVD_DATA_TICKLE_OFFSET (-RED_ZONE_SIZE-14*SE_WORDSIZE) +#define RSVD_C3_ADDRESS_OFFSET (-RED_ZONE_SIZE-15*SE_WORDSIZE) +#define RSVD_TOP (-RED_ZONE_SIZE-15*SE_WORDSIZE) + +#if RSVD_SIZE_OF_MITIGATION_STACK_AREA != (RSVD_BOTTOM-RSVD_TOP) +#error "Malformed reserved mitigation stack area" +#endif + +#define INFO_RAX_OFFSET (0*SE_WORDSIZE) +#define INFO_RCX_OFFSET (1*SE_WORDSIZE) +#define INFO_RDX_OFFSET (2*SE_WORDSIZE) +#define INFO_RBX_OFFSET (3*SE_WORDSIZE) +#define INFO_RSP_OFFSET (4*SE_WORDSIZE) +#define INFO_RBP_OFFSET (5*SE_WORDSIZE) +#define INFO_RSI_OFFSET (6*SE_WORDSIZE) +#define INFO_RDI_OFFSET (7*SE_WORDSIZE) +#define INFO_R8_OFFSET (8*SE_WORDSIZE) +#define INFO_R9_OFFSET (9*SE_WORDSIZE) +#define INFO_R10_OFFSET (10*SE_WORDSIZE) +#define INFO_R11_OFFSET (11*SE_WORDSIZE) +#define INFO_R12_OFFSET (12*SE_WORDSIZE) +#define INFO_R13_OFFSET (13*SE_WORDSIZE) +#define INFO_R14_OFFSET (14*SE_WORDSIZE) +#define INFO_R15_OFFSET (15*SE_WORDSIZE) +#define INFO_FLAGS_OFFSET (16*SE_WORDSIZE) +#define INFO_RIP_OFFSET (17*SE_WORDSIZE) + +DECLARE_LOCAL_FUNC constant_time_apply_sgxstep_mitigation_and_continue_execution +/* Note: moving rsp upwards as a scratchpad register discards any data at lower + * addresses (i.e., these may be overwritten by nested exception handlers, but + * the stage-1 handler will always safeguard a red zone + rsvd area under the + * interrupted stack pointer). */ + mov INFO_RSP_OFFSET(%rdi), %rsp /* rsp: pre-irq rsp */ + mov INFO_RIP_OFFSET(%rdi), %rax /* rax: pre-irq rip */ + mov %rax, %r10 + +/* Check whether the last AEX occurred during the mitigation */ + cmpb $0xc3, (%rax) # ZF=1 if interrupted c3 (ret) + cmovz (%rsp), %rax # rax: irq c3? caller rip : pre-irq rip + mov %rsp, %rbp + lea SE_WORDSIZE(%rsp), %rbx + cmovz %rbx, %rbp # rbp: irq c3? post-ret rsp : pre-irq rsp + + lea_pic __ct_mitigation_end, %rbx + sub %rax, %rbx + cmp $(__ct_mitigation_end - __ct_mitigation_begin + 1), %rbx +// CMP will set CF=1 (B) if the mitigation was interrupted, CF=0 (NB) otherwise + cmovb %rbp, %rsp # rsp: original main flow rsp + mov %rsp, INFO_RSP_OFFSET(%rdi) + +// If the mitigation was interrupted, restore the interrupted IP from the +// reserved area + cmovb RSVD_RIP_OFFSET(%rsp), %r10 + mov %r10, RSVD_RIP_OFFSET(%rsp) + +// Copy RFLAGS onto the reserved stack area + mov INFO_FLAGS_OFFSET(%rdi), %rax + mov %rax, RSVD_FLAGS_OFFSET(%rsp) + +// If the mitigation was interrupted, restore the first q/dword of the red +// zone from the reserved area; otherwise save it to the reserved area + mov -SE_WORDSIZE(%rsp), %rax + cmovb RSVD_REDZONE_WORD_OFFSET(%rsp), %rax + mov %rax, RSVD_REDZONE_WORD_OFFSET(%rsp) + +// Save &SSA[0].GPRSGX.AEXNOTIFY to the reserved area + mov %rsi, RSVD_AEXNOTIFY_ADDRESS_OFFSET(%rsp) + +// If the mitigation was interrupted, restore tickle parameters from the +// reserved area. + cmovb RSVD_STACK_TICKLE_OFFSET(%rsp), %rdx + cmovb RSVD_CODE_TICKLE_OFFSET(%rsp), %rcx + cmovb RSVD_DATA_TICKLE_OFFSET(%rsp), %r8 + cmovb RSVD_C3_ADDRESS_OFFSET(%rsp), %r9 + mov %rdx, RSVD_STACK_TICKLE_OFFSET(%rsp) + mov %rcx, RSVD_CODE_TICKLE_OFFSET(%rsp) + mov %r8, RSVD_DATA_TICKLE_OFFSET(%rsp) + mov %r9, RSVD_C3_ADDRESS_OFFSET(%rsp) + +// If the mitigation was not interrupted (the interrupt occured in the main flow) +// then restore the registers from *info + mov INFO_R8_OFFSET(%rdi), %r8 + mov INFO_R9_OFFSET(%rdi), %r9 + mov INFO_R10_OFFSET(%rdi), %r10 + mov INFO_R11_OFFSET(%rdi), %r11 + mov INFO_R12_OFFSET(%rdi), %r12 + mov INFO_R13_OFFSET(%rdi), %r13 + mov INFO_R14_OFFSET(%rdi), %r14 + mov INFO_R15_OFFSET(%rdi), %r15 + mov INFO_RAX_OFFSET(%rdi), %rax + mov INFO_RCX_OFFSET(%rdi), %rcx + mov INFO_RDX_OFFSET(%rdi), %rdx + mov INFO_RBX_OFFSET(%rdi), %rbx + mov INFO_RBP_OFFSET(%rdi), %rbp + mov INFO_RSI_OFFSET(%rdi), %rsi + mov INFO_RDI_OFFSET(%rdi), %rdi + +// If the mitigation was interrupted, restore registers from the reserved area +// on the stack. + cmovb RSVD_RAX_OFFSET(%rsp), %rax + cmovb RSVD_RCX_OFFSET(%rsp), %rcx + cmovb RSVD_RDX_OFFSET(%rsp), %rdx + cmovb RSVD_RBX_OFFSET(%rsp), %rbx + cmovb RSVD_RBP_OFFSET(%rsp), %rbp + cmovb RSVD_RSI_OFFSET(%rsp), %rsi + cmovb RSVD_RDI_OFFSET(%rsp), %rdi + + mov %rax, RSVD_RAX_OFFSET(%rsp) + mov %rcx, RSVD_RCX_OFFSET(%rsp) + mov %rdx, RSVD_RDX_OFFSET(%rsp) + mov %rbx, RSVD_RBX_OFFSET(%rsp) + mov %rbp, RSVD_RBP_OFFSET(%rsp) + mov %rsi, RSVD_RSI_OFFSET(%rsp) + mov %rdi, RSVD_RDI_OFFSET(%rsp) + +# Restore tickle addresses + mov RSVD_STACK_TICKLE_OFFSET(%rsp), %rbp + mov RSVD_CODE_TICKLE_OFFSET(%rsp), %rsi + mov RSVD_DATA_TICKLE_OFFSET(%rsp), %rdx + mov RSVD_C3_ADDRESS_OFFSET(%rsp), %rdi + +# Restore flags + lea RSVD_FLAGS_OFFSET(%rsp), %rax + xchg %rax, %rsp + popf + xchg %rax, %rsp + +# NOTHING AFTER THIS POINT CAN MODIFY EFLAGS/RFLAGS + +################################################################################ +# BEGIN MITIGATION CODE +################################################################################ + +#define MITIGATION_CODE_ALIGNMENT 0x200 +.align MITIGATION_CODE_ALIGNMENT + +# Enable AEX Notify +.ct_enable_aexnotify: + mov RSVD_AEXNOTIFY_ADDRESS_OFFSET(%rsp), %rax + movb $1, (%rax) + + .global __ct_mitigation_begin +__ct_mitigation_begin: +# Step 1: Inject random cycle noise + movzx %sil, %rcx # The lowest byte in %xsi indicates whether cycles should be added + mov $0, %sil + lfence + jrcxz .ct_set_up_tickles + CYCLE_DELAY 20, %rax + +.ct_set_up_tickles: + lfence + movzx %bpl, %rcx # The lowest byte in %rbp indicates whether a second stack page can be tickled + jrcxz .ct_set_up_tickles_with_one_stack_page + mov $0x00, %bpl + lea -0x1000(%rbp), %rbx + jmp .ct_warm_caches_and_tlbs +.ct_set_up_tickles_with_one_stack_page: + lea 0x08(%rbp), %rbx + +# Load all working set cache lines and warm the TLB entries +.ct_warm_caches_and_tlbs: + movzx %dl, %rcx # The lowest byte in %rdx indicates whether data_tickle_page can be written to + mov $0x10, %dl # avoid sequencing uops, in case rbp and rdx alias + jrcxz .ct_warm_caches_and_tlbs_data_read_pre + +.ct_warm_caches_and_tlbs_data_write_pre: + mov $0x1000, %ecx +.align 0x10 +.ct_warm_caches_and_tlbs_data_write: + lea -0x40(%ecx), %ecx + call *%rdi + mov (%rsi, %rcx), %eax + mov (%rbp, %rcx), %eax + mov %eax, (%rbp, %rcx) + mov (%rbx, %rcx), %eax + mov %eax, (%rbx, %rcx) + mov (%rdx, %rcx), %eax + mov %eax, (%rdx, %rcx) + jrcxz .ct_restore_state + jmp .ct_warm_caches_and_tlbs_data_write # loops 64 times + +// This block is identical to the previous one, except that it doesn't write +// to data_tickle_page. +.ct_warm_caches_and_tlbs_data_read_pre: + mov $0x1000, %ecx +.align 0x10 +.ct_warm_caches_and_tlbs_data_read: + lea -0x40(%ecx), %ecx + call *%rdi + mov (%rsi, %rcx), %eax + mov (%rbp, %rcx), %eax + mov %eax, (%rbp, %rcx) + mov (%rbx, %rcx), %eax + mov %eax, (%rbx, %rcx) + mov (%rdx, %rcx), %eax + jrcxz .ct_restore_state + jmp .ct_warm_caches_and_tlbs_data_read # loops 64 times + +.ct_restore_state: + mov RSVD_REDZONE_WORD_OFFSET(%rsp), %rdi + mov %rdi, -SE_WORDSIZE(%rsp) # restore the first q/dword of the red zone + mov RSVD_RDI_OFFSET(%rsp), %rdi + mov RSVD_RSI_OFFSET(%rsp), %rsi + mov RSVD_RBP_OFFSET(%rsp), %rbp + mov RSVD_RBX_OFFSET(%rsp), %rbx + mov RSVD_RDX_OFFSET(%rsp), %rdx + mov RSVD_RCX_OFFSET(%rsp), %rcx + mov RSVD_RAX_OFFSET(%rsp), %rax +__ct_mitigation_end: + jmp *RSVD_RIP_OFFSET(%rsp) + +.global __ct_mitigation_ret +__ct_mitigation_ret: + ret + +.ct_aexnotify_end: + +.sect _to_be_discarded, "e", @nobits +.space MITIGATION_CODE_ALIGNMENT - (.ct_aexnotify_end - .ct_enable_aexnotify) +.previous diff --git a/sdk/trts/linux/trts_pic.S b/sdk/trts/linux/trts_pic.S index d7ba3d88c..65fb96390 100644 --- a/sdk/trts/linux/trts_pic.S +++ b/sdk/trts/linux/trts_pic.S @@ -29,7 +29,6 @@ * */ - /* * Description: * The file provides `enclave_entry' function to switch code between @@ -191,6 +190,27 @@ DECLARE_GLOBAL_FUNC enclave_entry call restore_xregs lfence +#ifndef SE_SIM + mov -3*SE_WORDSIZE(%xbp), %xax /* cssa */ + cmp $0, %xax + jne .Lrestore_untrust_stack + + READ_TD_DATA self_addr /* xax: td */ + cmp $0, %xax /* check if td is initialized */ + je .Lrestore_untrust_stack + mov first_ssa_gpr(%xax), %xdx + movb aex_notify(%xdx), %cl + cmpb $0, %cl + je .Lrestore_untrust_stack + /* + * clear aexnotify bit to disable aexnotify temporarily and + * set td.aex_notify_flag to indicate aexnotify is enabled + * before EEXIT + */ + movb $0, aex_notify(%xdx) + movl $0x1, aex_notify_flag(%xax) +#endif +.Lrestore_untrust_stack: /* set xdi and xsi */ mov $OCMD_ERET, %xdi mov %xbx, %xsi @@ -376,9 +396,22 @@ DECLARE_LOCAL_FUNC do_ocall mov SE_WORDSIZE*12(%xsp), %xdi /* restore xdi */ mov SE_WORDSIZE*13(%xsp), %xsi /* restore xdi */ #endif - /* restore outside stack context */ mov first_ssa_gpr(%xbx), %xdx +#ifndef SE_SIM + movb aex_notify(%xdx), %cl + cmpb $0, %cl + je .Lrestore_outside_stack + + /* + * clear aexnotify to disable aexnotify temporarily and + * set td.aex_notify_flag to indicate aexnotify is enabled + * before EEXIT + */ + movb $0, aex_notify(%xdx) + movl $0x1, aex_notify_flag(%xbx) +#endif +.Lrestore_outside_stack: mov ssa_bp_u(%xdx), %xbp mov ssa_sp_u(%xdx), %xsp /* @@ -657,4 +690,18 @@ DECLARE_LOCAL_FUNC continue_execution pop %xcx /* restore xcx */ pop %xsp /* xsp: xax */ xchg %xax, %xsp + ret $(RED_ZONE_SIZE) /* pop xip and red zone (if any) */ + +/* + * ------------------------------------------------------------------------- + * extern "C" __attribute__((regparm(1))) void second_phase(sgx_exception_info_t *info, + * void *new_sp, void *second_phase_handler_addr); + * ------------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC second_phase + movq %xsi, %xsp + mov $SE_EDECCSSA, %xax + enclu /* DECCSSA */ + jmp *%xdx + diff --git a/sdk/trts/linux/trts_pic.h b/sdk/trts/linux/trts_pic.h index 1f769bedc..0fbd69610 100644 --- a/sdk/trts/linux/trts_pic.h +++ b/sdk/trts/linux/trts_pic.h @@ -67,12 +67,14 @@ #define xsave_size (SE_WORDSIZE * 7) #define self_addr 0 #define stack_guard (SE_WORDSIZE * 5) +#define aex_notify_flag (SE_WORDSIZE * 10) /* SSA GPR */ #define ssa_sp_t 32 #define ssa_sp_u 144 #define ssa_bp_u 152 #define ssa_exit_info 160 +#define aex_notify 167 #endif #define EXIT_INFO_VALID 0x80000000 diff --git a/sdk/trts/trts.cpp b/sdk/trts/trts.cpp index 1ddd5f6eb..749a699c0 100644 --- a/sdk/trts/trts.cpp +++ b/sdk/trts/trts.cpp @@ -40,6 +40,8 @@ #include "trts_internal.h" #include "internal/rts.h" #include "trts_util.h" +#include "sgx_utils.h" +#include "sgx_report.h" #ifdef SE_SIM #include "t_instructions.h" /* for `g_global_data_sim' */ @@ -352,3 +354,4 @@ int SGXAPI sgx_wrpkru(uint32_t val) : "a" (val), "c"(c), "d"(d)); return 1; } + diff --git a/sdk/trts/trts_add_trim.cpp b/sdk/trts/trts_add_trim.cpp index 59e1e11a2..e44150705 100644 --- a/sdk/trts/trts_add_trim.cpp +++ b/sdk/trts/trts_add_trim.cpp @@ -261,7 +261,7 @@ sgx_status_t do_add_thread(void *ptcs) const volatile layout_t *layout = get_dynamic_layout_by_id(id); if (layout && (layout->entry.attributes & PAGE_ATTR_DYN_THREAD)) { - ret = mm_commit((void *)(enclave_base + layout->entry.rva + offset), layout->entry.page_count << SE_PAGE_SHIFT); + ret = mm_commit((void *)(enclave_base + layout->entry.rva + offset), (uint64_t)layout->entry.page_count << SE_PAGE_SHIFT); if (ret != 0) return SGX_ERROR_UNEXPECTED; } diff --git a/sdk/trts/trts_aex.cpp b/sdk/trts/trts_aex.cpp new file mode 100644 index 000000000..984c07f05 --- /dev/null +++ b/sdk/trts/trts_aex.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: trts_aex.cpp + * Description: + * This file implements the APIs for AEX notify support. + */ + +#include "sgx_trts_aex.h" +#include +#include "sgx_trts.h" +#include "arch.h" +#include "thread_data.h" +#include "trts_internal.h" +#include "trts_inst.h" +#include "util.h" +#include "trts_util.h" +#include "trts_shared_constants.h" +#include "se_cdefs.h" +#include "sgx_utils.h" + + +sgx_status_t SGXAPI sgx_set_ssa_aexnotify(int flag) +{ + thread_data_t *thread_data = get_thread_data(); + ssa_gpr_t *ssa_gpr = NULL; + + if(thread_data == NULL) + { + return SGX_ERROR_UNEXPECTED; + } + + auto *report = sgx_self_report(); + if(!(report->body.attributes.flags & SGX_FLAGS_AEX_NOTIFY)) + { + return SGX_ERROR_UNEXPECTED; + } + + // no need to check the result of ssa_gpr because thread_data is always trusted + ssa_gpr = reinterpret_cast(thread_data->first_ssa_gpr); + if (flag) + ssa_gpr->aex_notify|= SSA_AEXNOTIFY_MASK; + else + ssa_gpr->aex_notify &= (uint8_t)(~SSA_AEXNOTIFY_MASK); + return SGX_SUCCESS; +} + + +sgx_status_t SGXAPI sgx_register_aex_handler(sgx_aex_mitigation_node_t *aex_node, sgx_aex_mitigation_fn_t handler, const void *argv) +{ + if (aex_node == NULL || handler == NULL) + return SGX_ERROR_INVALID_PARAMETER; + thread_data_t *thread_data = get_thread_data(); + sgx_aex_mitigation_node_t *head = (sgx_aex_mitigation_node_t *)thread_data->aex_mitigation_list; + + aex_node->handler = handler; + aex_node->args = argv; + aex_node->next = head; + head = aex_node; + + thread_data->aex_mitigation_list = (sys_word_t) head; + + return SGX_SUCCESS; +} + +sgx_status_t SGXAPI sgx_unregister_aex_handler(sgx_aex_mitigation_fn_t handler) +{ + if(handler == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + // Search and find out the aex_node corresponding to the handler + thread_data_t *thread_data = get_thread_data(); + sgx_aex_mitigation_node_t *node = (sgx_aex_mitigation_node_t *)thread_data->aex_mitigation_list; + sgx_aex_mitigation_node_t *prev_node = NULL; + if(node == NULL) + return SGX_ERROR_UNEXPECTED; + + while(node) + { + if(node->handler == handler) + break; + prev_node = node; + node = node->next; + } + // Remove the node from the list + if(node != NULL) + { + if(prev_node == NULL) + { + // It is the first node + thread_data->aex_mitigation_list = (sys_word_t)node->next; + } + else + { + prev_node->next = node->next; + } + } + else // node not found + { + return SGX_ERROR_INVALID_PARAMETER; + } + return SGX_SUCCESS; +} + + +extern "C" sgx_status_t sgx_apply_mitigations(const sgx_exception_info_t *info) +{ + thread_data_t *thread_data = get_thread_data(); + sgx_aex_mitigation_node_t *node = (sgx_aex_mitigation_node_t *)thread_data->aex_mitigation_list; + while(node) + { + // Call mitigation handlers + node->handler(info, node->args); + node = node->next; + } + return SGX_SUCCESS; +} + + diff --git a/sdk/trts/trts_ecall.cpp b/sdk/trts/trts_ecall.cpp index 6e5717905..a4ea8e2a6 100644 --- a/sdk/trts/trts_ecall.cpp +++ b/sdk/trts/trts_ecall.cpp @@ -37,6 +37,7 @@ #include "util.h" #include "xsave.h" #include "sgx_trts.h" +#include "sgx_trts_aex.h" #include "sgx_lfence.h" #include "sgx_spinlock.h" #include "global_init.h" @@ -337,6 +338,7 @@ sgx_status_t do_init_thread(void *tcs, bool enclave_init) thread_data->stack_limit_addr += (size_t)tcs; thread_data->stack_commit_addr = thread_data->stack_limit_addr; thread_data->first_ssa_gpr += (size_t)tcs; + thread_data->first_ssa_xsave += (size_t)tcs; thread_data->tls_array += (size_t)tcs; thread_data->tls_addr += (size_t)tcs; thread_data->last_sp -= (size_t)STATIC_STACK_SIZE; @@ -401,6 +403,15 @@ sgx_status_t do_ecall(int index, void *ms, void *tcs) } } thread_data = get_thread_data(); + // If aexnotify is enabled but we disable it temporarily before last EEXIT, + // we need to enable it again +#ifndef SE_SIM + if(thread_data->aex_notify_flag == 1) + { + thread_data->aex_notify_flag = 0; + sgx_set_ssa_aexnotify(1); + } +#endif if(thread_data->stack_base_addr == thread_data->last_sp) { //root ecall diff --git a/sdk/trts/trts_mitigation.h b/sdk/trts/trts_mitigation.h new file mode 100644 index 000000000..d6ef85d52 --- /dev/null +++ b/sdk/trts/trts_mitigation.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef TRTS_MIITGATION_H__ +#define TRTS_MIITGATION_H__ + +#define RSVD_SIZE_OF_MITIGATION_STACK_AREA (15 * 8) + +#endif diff --git a/sdk/trts/trts_nsp.cpp b/sdk/trts/trts_nsp.cpp index dfc614142..eff5ca82c 100644 --- a/sdk/trts/trts_nsp.cpp +++ b/sdk/trts/trts_nsp.cpp @@ -112,7 +112,7 @@ extern "C" int enter_enclave(int index, void *ms, void *tcs, int cssa) error = do_uninit_enclave(tcs); } } - else if((cssa == 1) && (index == ECMD_EXCEPT)) + else if(cssa == 1) { error = trts_handle_exception(tcs); if (check_static_stack_canary(tcs) != 0) diff --git a/sdk/trts/trts_ocall.cpp b/sdk/trts/trts_ocall.cpp index 8f6daeb7a..c63615409 100644 --- a/sdk/trts/trts_ocall.cpp +++ b/sdk/trts/trts_ocall.cpp @@ -37,6 +37,8 @@ #include "rts.h" #include "util.h" #include "trts_internal.h" +#include "sgx_trts.h" +#include "sgx_trts_aex.h" extern "C" sgx_status_t asm_oret(uintptr_t sp, void *ms); extern "C" sgx_status_t __morestack(const unsigned int index, void *ms); @@ -96,6 +98,15 @@ uintptr_t update_ocall_lastsp(ocall_context_t* context) sgx_status_t do_oret(void *ms) { thread_data_t *thread_data = get_thread_data(); +#ifndef SE_SIM + // If aexnotify is enabled but we disable it temporarily before EEXIT + // we need to enable it again after stack switch in oret + if(thread_data->aex_notify_flag == 1) + { + thread_data->aex_notify_flag = 0; + sgx_set_ssa_aexnotify(1); + } +#endif uintptr_t last_sp = thread_data->last_sp; ocall_context_t *context = reinterpret_cast(thread_data->last_sp); if(0 == last_sp || last_sp <= (uintptr_t)&context) diff --git a/sdk/trts/trts_util.cpp b/sdk/trts/trts_util.cpp index eca41cb60..70238c2e7 100644 --- a/sdk/trts/trts_util.cpp +++ b/sdk/trts/trts_util.cpp @@ -223,3 +223,20 @@ size_t get_xsave_size() { return (size_t)g_global_data.td_template.xsave_size; } + +int get_ssa_aexnotify() +{ + int flag = 0; + thread_data_t *thread_data = get_thread_data(); + ssa_gpr_t *ssa_gpr = NULL; + + if(thread_data == NULL) + { + return 0; + } + + ssa_gpr = reinterpret_cast(thread_data->first_ssa_gpr); + flag = ssa_gpr->aex_notify & SSA_AEXNOTIFY_MASK; + + return flag; +} diff --git a/sdk/trts/trts_util.h b/sdk/trts/trts_util.h index d1dd6b9dc..1fd11fea0 100644 --- a/sdk/trts/trts_util.h +++ b/sdk/trts/trts_util.h @@ -64,6 +64,9 @@ bool is_tcs_binding_mode(); size_t get_xsave_size(); +int get_ssa_aexnotify(); + + #ifdef __cplusplus } #endif diff --git a/sdk/trts/trts_veh.cpp b/sdk/trts/trts_veh.cpp index 2d860caa8..526fdfc70 100644 --- a/sdk/trts/trts_veh.cpp +++ b/sdk/trts/trts_veh.cpp @@ -38,6 +38,7 @@ #include "sgx_trts_exception.h" #include +#include #include "sgx_trts.h" #include "xsave.h" #include "arch.h" @@ -45,6 +46,7 @@ #include "thread_data.h" #include "global_data.h" #include "trts_internal.h" +#include "trts_mitigation.h" #include "trts_inst.h" #include "util.h" #include "trts_util.h" @@ -52,6 +54,9 @@ #include "se_cdefs.h" #include "emm_private.h" #include "sgx_mm_rt_abstraction.h" +#include "sgx_trts_aex.h" + +#include "se_memcpy.h" typedef struct _handler_node_t { uintptr_t callback; @@ -65,6 +70,11 @@ static uintptr_t g_veh_cookie = 0; sgx_mm_pfhandler_t g_mm_pfhandler = NULL; #define ENC_VEH_POINTER(x) (uintptr_t)(x) ^ g_veh_cookie #define DEC_VEH_POINTER(x) (sgx_exception_handler_t)((x) ^ g_veh_cookie) +extern int g_aexnotify_supported; +extern "C" sgx_status_t sgx_apply_mitigations(const sgx_exception_info_t *); + +extern uint16_t aex_notify_c3_cache[2048]; +extern uint8_t *__ct_mitigation_ret; // sgx_register_exception_handler() @@ -76,7 +86,6 @@ sgx_mm_pfhandler_t g_mm_pfhandler = NULL; // exception_handler - a pointer to the handler to be called. // Return Value // handler - success -// NULL - fail void *sgx_register_exception_handler(int is_first_handler, sgx_exception_handler_t exception_handler) { // initialize g_veh_cookie for the first time sgx_register_exception_handler is called. @@ -181,14 +190,99 @@ int sgx_unregister_exception_handler(void *handler) return status; } +extern "C" __attribute__((regparm(1))) void second_phase(sgx_exception_info_t *info, + void *new_sp, void *second_phase_handler_addr); + // continue_execution(sgx_exception_info_t *info): -// try to restore the thread context saved in info to current execution context. +// try to restore the thread context saved in info to current execution context. extern "C" __attribute__((regparm(1))) void continue_execution(sgx_exception_info_t *info); +extern "C" void restore_xregs(uint8_t *buf); + +extern "C" void constant_time_apply_sgxstep_mitigation_and_continue_execution(sgx_exception_info_t *info, + uintptr_t ssa_aexnotify_addr, uintptr_t stack_tickle_pages, uintptr_t code_tickle_page, uintptr_t data_tickle_page, uintptr_t c3_byte_address); + + +// apply the constant time mitigation handler +static void apply_constant_time_sgxstep_mitigation_and_continue_execution(sgx_exception_info_t *info) +{ + thread_data_t *thread_data = get_thread_data(); + uintptr_t code_tickle_page, c3_byte_address, stack_tickle_pages, data_tickle_page, + stack_base_page = ((thread_data->stack_base_addr & ~0xFFF) == 0) ? + (thread_data->stack_base_addr) - 0x1000 : + (thread_data->stack_base_addr & ~0xFFF), + stack_limit_page = thread_data->stack_limit_addr & ~0xFFF; + + // Determine which stack pages can be tickled + if (((uintptr_t)info & ~0xFFF) == stack_base_page) { + if (stack_base_page == stack_limit_page) { + // The stack is only a single page, so we tickle that page + stack_tickle_pages = stack_base_page; + } else { + // The current stack page is the base page, but there are more + // pages so we tickle the next one as well. + stack_tickle_pages = stack_base_page | 1; + } + } else { + // If the current stack page is not the base page, then it's generally + // better to also tickle the previous page. For example, the mitigation + // code and the interrupted code may have separate but adjacent stack + // pages (in this case, the interrupted code's stack frame must be on + // the page with a higher address). + stack_tickle_pages = (((uintptr_t)info & ~0xFFF) + 0x1000) | 1; + } + + // Determine which data page can be tickled. + // FIXME: This will eventually call the CTD to obtain the page. For + // now, we redundantly tickle a stack page. + data_tickle_page = stack_tickle_pages & ~1; + + // Look up the code page in the c3 cache + code_tickle_page = info->cpu_context.REG(ip) & ~0xFFF; + c3_byte_address = code_tickle_page + *(aex_notify_c3_cache + ((code_tickle_page >> 12) & 0x07FF)); + if (*(uint8_t *)c3_byte_address != 0xc3) { + uint8_t *i = (uint8_t *)code_tickle_page, *e = i + 4096; + for (; i != e && *i != 0xc3; ++i) {} + if (i == e) { // code_tickle_page does not contain a c3 byte + c3_byte_address = (uintptr_t)&__ct_mitigation_ret; + } else { + c3_byte_address = (uintptr_t)i; + *(aex_notify_c3_cache + ((code_tickle_page >> 12) & 0x07FF)) = + (uint16_t)(c3_byte_address & 0xFFF); + } + } + + // Pop an entropy byte from the entropy cache + if (--thread_data->aex_notify_entropy_remaining < 0) { + if (0 == do_rdrand(&thread_data->aex_notify_entropy_cache)) + { + thread_data->exception_flag = -1; + abort(); + } + thread_data->aex_notify_entropy_remaining = 31; + } + code_tickle_page |= thread_data->aex_notify_entropy_cache & 1; + thread_data->aex_notify_entropy_cache >>= 1; + + // There are three additional "implicit" parameters to this function: + // 1. The low-order bit of `stack_tickle_pages` is 1 if a second stack + // page should be tickled (specifically, the stack page immediately + // below the page specified in the upper bits) + // 2. The low-order bit of `code_tickle_page` is 1 if the cycle delay + // should be added to the mitigation + // 3. The low-order bit of `data_tickle_page` is 1 if `data_tickle_page` + // is writable, and therefore should be tested for write permissions + // by the mitigation + constant_time_apply_sgxstep_mitigation_and_continue_execution( + info, thread_data->first_ssa_gpr + offsetof(ssa_gpr_t, aex_notify), + stack_tickle_pages, code_tickle_page, + data_tickle_page, c3_byte_address); +} -// internal_handle_exception(sgx_exception_info_t *info): // the 2nd phrase exception handing, which traverse registered exception handlers. // if the exception can be handled, then continue execution // otherwise, throw abortion, go back to 1st phrase, and call the default handler. +// if the exception can be handled, then continue execution +// otherwise, throw abortion, go back to 1st phrase, and call the default handler. extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_exception_info_t *info) { int status = EXCEPTION_CONTINUE_SEARCH; @@ -199,6 +293,14 @@ extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_except uintptr_t *ntmp = NULL; uintptr_t xsp = 0; + // AEX Notify allows this handler to handle interrupts + if (info == NULL) { + goto failed_end; + } + else if (info->exception_valid == 0) { + goto exception_handling_end; + } + if (thread_data->exception_flag < 0) goto failed_end; thread_data->exception_flag++; @@ -211,7 +313,7 @@ extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_except if(SGX_MM_EXCEPTION_CONTINUE_EXECUTION == g_mm_pfhandler(pfinfo)) { //instruction triggering the exception will be executed again. - continue_execution(info); + goto exception_handling_end; } //restore old flag, and fall thru thread_data->exception_flag++; @@ -234,8 +336,7 @@ extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_except //exception cannot be handled thread_data->exception_flag = -1; - //instruction triggering the exception will be executed again. - continue_execution(info); + goto exception_handling_end; } // The customer handler may never return, use alloca instead of malloc if ((nhead = (uintptr_t *)alloca(size)) == NULL) @@ -288,9 +389,22 @@ extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_except thread_data->exception_flag = -1; } +exception_handling_end: //instruction triggering the exception will be executed again. - continue_execution(info); - + if(info->do_aex_mitigation == 1) + { + // apply customized mitigation handlers + // Note that we don't enable AEX-notify for customized mitigation handler + sgx_apply_mitigations(info); + restore_xregs(info->xsave_area); + apply_constant_time_sgxstep_mitigation_and_continue_execution(info); + } + else + { + //instruction triggering the exception will be executed again. + restore_xregs(info->xsave_area); + continue_execution(info); + } failed_end: thread_data->exception_flag = -1; // mark the current exception cannot be handled abort(); // throw abortion @@ -316,7 +430,6 @@ extern "C" const char Leverifyreport2_inst; // the pointer of TCS // Return Value // none zero - success -// 0 - fail extern "C" sgx_status_t trts_handle_exception(void *tcs) { thread_data_t *thread_data = get_thread_data(); @@ -324,6 +437,8 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) sgx_exception_info_t *info = NULL; uintptr_t sp_u, sp, *new_sp = NULL; size_t size = 0; + uint8_t *ssa_xsave = NULL; + bool is_exception_handled = false; if ((thread_data == NULL) || (tcs == NULL)) goto default_handler; if (check_static_stack_canary(tcs) != 0) @@ -375,10 +490,17 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) // after the return addr and includes func's arguments size += RED_ZONE_SIZE; + // Add space for reserved slot for GPRs that will be used by mitigation + // assembly code RIP, RAX, RBX, RCX, RDX, RBP, RSI, RDI Saved flags, 1st + // D/QWORD of red zone, &SSA[0].GPRSGX.AEXNOTIFY, stack_tickle_pages, + // code_tickle_page, data_tickle_page, c3_byte_address + size += RSVD_SIZE_OF_MITIGATION_STACK_AREA; + // decrease the stack to give space for info size += sizeof(sgx_exception_info_t); + size += thread_data->xsave_size; sp -= size; - sp = sp & ~0xF; + sp = sp & ~0x3F; // check the decreased sp to make sure it is in the trusted stack range if(!is_stack_addr((void *)sp, size)) @@ -396,28 +518,32 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } - - // sp is within limit_addr and commit_addr, currently only SGX 2.0 under hardware mode will enter this branch. - if((size_t)sp < thread_data->stack_commit_addr) - { - int ret = -1; - size_t page_aligned_delta = 0; + + if(ssa_gpr->exit_info.valid == 1) + { /* try to allocate memory dynamically */ - page_aligned_delta = ROUND_TO(thread_data->stack_commit_addr - (size_t)sp, SE_PAGE_SIZE); - if ((thread_data->stack_commit_addr > page_aligned_delta) - && ((thread_data->stack_commit_addr - page_aligned_delta) >= thread_data->stack_limit_addr)) - { - ret = expand_stack_by_pages((void *)(thread_data->stack_commit_addr - page_aligned_delta), (page_aligned_delta >> SE_PAGE_SHIFT)); - } - if (ret == 0) - { - thread_data->stack_commit_addr -= page_aligned_delta; - return SGX_SUCCESS; - } - else - { - set_enclave_state(ENCLAVE_CRASHED); - return SGX_ERROR_STACK_OVERRUN; + if((size_t)sp < thread_data->stack_commit_addr) + { + int ret = -1; + size_t page_aligned_delta = 0; + /* try to allocate memory dynamically */ + page_aligned_delta = ROUND_TO(thread_data->stack_commit_addr - (size_t)sp, SE_PAGE_SIZE); + if ((thread_data->stack_commit_addr > page_aligned_delta) + && ((thread_data->stack_commit_addr - page_aligned_delta) >= thread_data->stack_limit_addr)) + { + ret = expand_stack_by_pages((void *)(thread_data->stack_commit_addr - page_aligned_delta), (page_aligned_delta >> SE_PAGE_SHIFT)); + } + if (ret == 0) + { + thread_data->stack_commit_addr -= page_aligned_delta; + is_exception_handled = true; // The exception has been handled in the 1st phase exception handler + goto handler_end; + } + else + { + set_enclave_state(ENCLAVE_CRASHED); + return SGX_ERROR_STACK_OVERRUN; + } } } if (size_t(&Lereport_inst) == ssa_gpr->REG(ip) && SE_EREPORT == ssa_gpr->REG(ax)) @@ -425,7 +551,8 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) // Handle the exception raised by EREPORT instruction ssa_gpr->REG(ip) += 3; // Skip ENCLU, which is always a 3-byte instruction ssa_gpr->REG(flags) |= 1; // Set CF to indicate error condition, see implementation of do_report() - return SGX_SUCCESS; + is_exception_handled = true; // The exception has been handled in the 1st phase exception handler. + goto handler_end; } if (size_t(&Leverifyreport2_inst) == ssa_gpr->REG(ip) && SE_EVERIFYREPORT2 == ssa_gpr->REG(ax)) { @@ -433,17 +560,24 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) ssa_gpr->REG(ip) += 3; // Skip ENCLU, which is always a 3-byte instruction ssa_gpr->REG(flags) |= 64; // Set ZF to indicate error condition, see implementation of do_everifyreport2() ssa_gpr->REG(ax) = EVERIFYREPORT2_INVALID_LEAF; - return SGX_SUCCESS; + is_exception_handled = true; // The exception has been handled in the 1st phase exception handler. + goto handler_end; } - if(ssa_gpr->exit_info.valid != 1) - { // exception handlers are not allowed to call in a non-exception state + if(g_aexnotify_supported == 0 && ssa_gpr->exit_info.valid != 1) + { + // exception handlers are not allowed to call in a non-exception state + // add aexnotify check here to skip the case of interrupts goto default_handler; } - +handler_end: // initialize the info with SSA[0] + info->exception_valid = is_exception_handled ? 0 : ssa_gpr->exit_info.valid; info->exception_vector = (sgx_exception_vector_t)ssa_gpr->exit_info.vector; info->exception_type = (sgx_exception_type_t)ssa_gpr->exit_info.exit_type; + info->xsave_size = thread_data->xsave_size; + ssa_xsave = (uint8_t*)ROUND_TO_PAGE(thread_data->first_ssa_gpr) - ROUND_TO_PAGE(get_xsave_size() + sizeof(ssa_gpr_t)); + memcpy_s(info->xsave_area, info->xsave_size, ssa_xsave, info->xsave_size); info->cpu_context.REG(ax) = ssa_gpr->REG(ax); info->cpu_context.REG(cx) = ssa_gpr->REG(cx); @@ -474,16 +608,41 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) info->exinfo.error_code = exinfo->errcd; } new_sp = (uintptr_t *)sp; - ssa_gpr->REG(ip) = (size_t)internal_handle_exception; // prepare the ip for 2nd phrase handling - ssa_gpr->REG(sp) = (size_t)new_sp; // new stack for internal_handle_exception - ssa_gpr->REG(ax) = (size_t)info; // 1st parameter (info) for LINUX32 - ssa_gpr->REG(di) = (size_t)info; // 1st parameter (info) for LINUX64, LINUX32 also uses it while restoring the context + if(!(g_aexnotify_supported || is_exception_handled == true)) + { + // Two cases that we don't need to run below code: + // 1. AEXNotify is enabled + // 2. stack expansion or EREPORT exception. We have handled it + // in the first phase and we should not change anything in the ssa_gpr + // + ssa_gpr->REG(ip) = (size_t)internal_handle_exception; // prepare the ip for 2nd phrase handling + ssa_gpr->REG(sp) = (size_t)new_sp; // new stack for internal_handle_exception + ssa_gpr->REG(ax) = (size_t)info; // 1st parameter (info) for LINUX32 + ssa_gpr->REG(di) = (size_t)info; // 1st parameter (info) for LINUX64, LINUX32 also uses it while restoring the context + } *new_sp = info->cpu_context.REG(ip); // for debugger to get call trace - - //mark valid to 0 to prevent eenter again - ssa_gpr->exit_info.valid = 0; - - return SGX_SUCCESS; +#ifndef SE_SIM + if(g_aexnotify_supported) + { + info->do_aex_mitigation = get_ssa_aexnotify(); + void *first_ssa_xsave = reinterpret_cast(thread_data->first_ssa_xsave); + restore_xregs((uint8_t*)first_ssa_xsave); + // With AEX Notify, we don't need to do a return here (phase-1 handler). + // Instead, we jump to internal_handle_exception (phase-2 handler). + // We should not make a function call either, because ideally the return at + // the end of phase-2 handler should directly return to the interrupted enclave code. + // Disable aexnotify before EDCSSA + if(info->do_aex_mitigation == 1) + { + sgx_set_ssa_aexnotify(0); + } + second_phase(info, new_sp, (void *)internal_handle_exception); + } + else +#endif + { + return SGX_SUCCESS; + } default_handler: set_enclave_state(ENCLAVE_CRASHED); diff --git a/sdk/ttls/Makefile b/sdk/ttls/Makefile index 8b5d9ac4b..3b41a05df 100644 --- a/sdk/ttls/Makefile +++ b/sdk/ttls/Makefile @@ -57,6 +57,7 @@ INCLUDE += -I$(COMMON_DIR)/inc/tlibc \ -I$(SGX_QV_PATH)/dcap_tvl \ -include./tsgxsslio.h \ -I$(PREBUILT_OPENSSL_PATH)/inc +INCLUDE_TDX := $(filter-out -I$(PREBUILT_OPENSSL_PATH)/inc,$(INCLUDE)) CXXFLAGS_TDX := $(CXXFLAGS) $(COMMON_FLAGS) $(COMMON_LDFLAGS) -fPIC -Werror -Wno-unused-parameter -g CXXFLAGS += $(COMMON_FLAGS) $(ENCLAVE_CXXFLAGS) @@ -93,7 +94,7 @@ $(OBJ): $(TLSNAME)_t.h $(OBJ): %.o :%.cpp $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(OBJ_TDX): tdx_%.o :%.cpp - $(CXX) $(CXXFLAGS_TDX) $(INCLUDE) -DTDX_ENV -c $< -o $@ + $(CXX) $(CXXFLAGS_TDX) $(INCLUDE_TDX) -DTDX_ENV -c $< -o $@ .PHONY: clean clean: diff --git a/sdk/ttls/ttls.cpp b/sdk/ttls/ttls.cpp index a48d58c82..cf345725e 100644 --- a/sdk/ttls/ttls.cpp +++ b/sdk/ttls/ttls.cpp @@ -81,7 +81,6 @@ extern "C" quote3_error_t tee_get_certificate_with_evidence( #else tdx_attest_error_t tdx_ret = TDX_ATTEST_ERROR_UNEXPECTED; tdx_uuid_t selected_att_key_id = { 0 }; - SHA256_CTX sha_handle; tdx_report_data_t report_data = { 0 }; #endif sgx_status_t ret = SGX_ERROR_UNEXPECTED; @@ -163,17 +162,7 @@ extern "C" quote3_error_t tee_get_certificate_with_evidence( if (func_ret != SGX_QL_SUCCESS) break; #else - if (!SHA256_Init(&sha_handle)) { - func_ret = SGX_QL_ERROR_UNEXPECTED; - break; - } - - if (!SHA256_Update(&sha_handle, p_pub_key, public_key_size)) { - func_ret = SGX_QL_ERROR_UNEXPECTED; - break; - } - - if (!SHA256_Final(reinterpret_cast(&report_data), &sha_handle)) { + if (!SHA256(p_pub_key, public_key_size, reinterpret_cast(&report_data))) { func_ret = SGX_QL_ERROR_UNEXPECTED; break; }