From 7d6ac349507258f49d00909df33d5dea4ff77f39 Mon Sep 17 00:00:00 2001 From: ipl_ci Date: Fri, 7 Jun 2024 06:16:15 -0700 Subject: [PATCH] WW23'24 source code update [dfa2adb4] --- BUILD.md | 7 +- CHANGELOG.md | 3 + include/ippversion.h | 10 +-- sources/dispatcher/gen_disp_lin32.nonpic.py | 2 +- .../include/fips_cert_internal/bn_common.h | 4 +- sources/include/lms_internal/lmots.h | 6 +- sources/include/lms_internal/lms.h | 2 +- sources/include/owndefs.h | 20 ++--- sources/include/stateful_sig_common/common.h | 2 +- sources/include/xmss_internal/wots.h | 6 +- sources/include/xmss_internal/xmss.h | 2 +- sources/ippcp/CMakeLists.txt | 18 +++- sources/ippcp/asm_intel64/pcpaesgcme9as.asm | 16 ++-- .../ippcp/crypto_mb/include/crypto_mb/defs.h | 8 +- .../crypto_mb/include/crypto_mb/fips_cert.h | 24 +++--- .../crypto_mb/include/crypto_mb/status.h | 24 +++--- .../crypto_mb/include/crypto_mb/version.h | 8 +- .../include/internal/common/ifma_math.h | 34 ++++---- .../include/internal/common/mem_fns.h | 4 +- .../include/internal/ecnist/ifma_arith_p256.h | 18 ++-- .../include/internal/ecnist/ifma_arith_p384.h | 16 ++-- .../include/internal/ecnist/ifma_arith_p521.h | 16 ++-- .../internal/ecnist/ifma_ecpoint_p256.h | 8 +- .../internal/ecnist/ifma_ecpoint_p384.h | 8 +- .../internal/ecnist/ifma_ecpoint_p521.h | 8 +- .../internal/ed25519/ifma_arith_ed25519.h | 20 ++--- .../internal/ed25519/ifma_arith_p25519.h | 20 ++--- .../include/internal/sm2/ifma_arith_sm2.h | 16 ++-- .../include/internal/sm2/ifma_ecpoint_sm2.h | 8 +- .../include/internal/sm3/sm3_common.h | 12 +-- .../include/internal/sm4/sm4_gcm_mb.h | 8 +- .../crypto_mb/include/internal/sm4/sm4_mb.h | 24 +++--- .../ippcp/crypto_mb/src/common/cpu_features.c | 2 +- .../ippcp/crypto_mb/src/common/ifma_cvt52.c | 8 +- .../crypto_mb/src/ecnist/ifma_arith_n384.c | 2 +- .../crypto_mb/src/ecnist/ifma_arith_n521.c | 6 +- .../crypto_mb/src/ecnist/ifma_arith_p384.c | 4 +- .../crypto_mb/src/ecnist/ifma_arith_p521.c | 8 +- .../crypto_mb/src/ecnist/ifma_ecpoint_p256.c | 10 +-- .../crypto_mb/src/ecnist/ifma_ecpoint_p384.c | 12 +-- .../crypto_mb/src/ecnist/ifma_ecpoint_p521.c | 10 +-- .../src/ed25519/ifma_arith_ed25519.c | 10 +-- .../crypto_mb/src/ed25519/ifma_arith_p25519.c | 12 +-- .../crypto_mb/src/sm2/ifma_ecpoint_sm2.c | 10 +-- .../ippcp/crypto_mb/src/sm3/sm3_avx512_mb16.c | 16 ++-- .../gcm/internal/sm4_gcm_gctr_kernel_mb16.c | 2 +- .../sm4_gcm_update_ghash_full_blocks_mb16.c | 4 +- ...sm4_gcm_update_ghash_partial_blocks_mb16.c | 2 +- .../ippcp/crypto_mb/src/sm4/sm4_ctr_mb16.c | 2 +- .../ippcp/crypto_mb/src/x25519/ifma_x25519.c | 84 +++++++++---------- sources/ippcp/ecnist/ifma_arith_n256.c | 2 +- sources/ippcp/ecnist/ifma_arith_n384.c | 2 +- sources/ippcp/ecnist/ifma_arith_n521.c | 2 +- sources/ippcp/ecnist/ifma_arith_p256.c | 6 +- sources/ippcp/ecnist/ifma_arith_p256.h | 4 +- sources/ippcp/ecnist/ifma_arith_p384.c | 6 +- sources/ippcp/ecnist/ifma_arith_p384.h | 4 +- sources/ippcp/ecnist/ifma_arith_p521.c | 6 +- sources/ippcp/ecnist/ifma_defs.h | 4 +- sources/ippcp/ecnist/ifma_defs_p521.h | 4 +- sources/ippcp/ecnist/ifma_ecpoint_p256.c | 6 +- sources/ippcp/ecnist/ifma_ecpoint_p256.h | 4 +- sources/ippcp/ecnist/ifma_ecpoint_p384.c | 6 +- sources/ippcp/ecnist/ifma_ecpoint_p384.h | 4 +- sources/ippcp/ecnist/ifma_ecpoint_p521.c | 6 +- sources/ippcp/ecnist/ifma_ecpoint_p521.h | 4 +- sources/ippcp/gsmod_montinv.c | 8 +- sources/ippcp/gsmodmethod.h | 10 +-- sources/ippcp/gsmodstuff.h | 4 +- sources/ippcp/ifma_exp52x20.c | 2 +- sources/ippcp/ifma_exp52x20_dual.c | 2 +- sources/ippcp/ifma_exp52x30_dual.c | 2 +- sources/ippcp/ifma_exp52x40_dual.c | 2 +- sources/ippcp/ifma_math_avx512vl.h | 22 ++--- sources/ippcp/owncp.h | 2 +- sources/ippcp/pcpaes_avx2_vaes.h | 24 +++--- sources/ippcp/pcpaes_cfbdecrypt_vaes512.c | 4 +- sources/ippcp/pcpaes_cmac_stuff.h | 6 +- sources/ippcp/pcpaes_ctr_process.h | 18 ++-- .../pcpaes_ctrencrypt_rij128pipe_vaes512.c | 4 +- sources/ippcp/pcpaes_gcm_vaes512.h | 8 +- sources/ippcp/pcpaes_gcmmul_vaes512.c | 6 +- sources/ippcp/pcpaes_sivstuff.h | 14 ++-- sources/ippcp/pcpaes_xts_vaes512.c | 4 +- sources/ippcp/pcpaesauthgcm.h | 16 ++-- sources/ippcp/pcpaesgcmtbl2k_mulpx.c | 18 ++-- sources/ippcp/pcpaesm.h | 12 +-- sources/ippcp/pcpaesmxts.h | 10 +-- sources/ippcp/pcpaesmxtsstuff.h | 10 +-- sources/ippcp/pcpaesnoise.h | 6 +- sources/ippcp/pcpbn.h | 26 +++--- sources/ippcp/pcpbnu32misc.h | 8 +- sources/ippcp/pcpbnuarith.h | 18 ++-- sources/ippcp/pcpbnumisc.h | 18 ++-- sources/ippcp/pcpeccp.h | 14 ++-- sources/ippcp/pcpgfpecessm2.h | 2 +- sources/ippcp/pcpgfpecstuff.h | 22 ++--- sources/ippcp/pcpgfpstuff.h | 26 +++--- sources/ippcp/pcpgfpxmethod_binom_epid2.c | 4 +- sources/ippcp/pcpgfpxmethod_binom_epid2.h | 2 +- sources/ippcp/pcpgfpxstuff.h | 14 ++-- sources/ippcp/pcphash.h | 16 ++-- sources/ippcp/pcphashsha1px.c | 12 +-- sources/ippcp/pcphashsm3px.c | 14 ++-- sources/ippcp/pcphashupdate.c | 8 +- sources/ippcp/pcpmask_ct.h | 28 +++---- sources/ippcp/pcpmont_set.c | 6 +- sources/ippcp/pcpmontgomery.h | 32 +++---- sources/ippcp/pcpmontred.h | 6 +- sources/ippcp/pcpngmontexpstuff.h | 16 ++-- sources/ippcp/pcpngmontexpstuff_avx2.c | 4 +- sources/ippcp/pcpngmontexpstuff_avx2.h | 6 +- sources/ippcp/pcpngmontexpstuff_avx512.h | 8 +- sources/ippcp/pcpngmontexpstuff_sse2.h | 6 +- sources/ippcp/pcpprng_genhw.h | 16 ++-- sources/ippcp/pcprij128safe.h | 14 ++-- sources/ippcp/pcprij128safe2.h | 14 ++-- sources/ippcp/pcprij128safedec2pxca.c | 20 ++--- sources/ippcp/pcprij128safeenc2pxca.c | 16 ++-- sources/ippcp/pcprij128safeencpxca.c | 12 +-- sources/ippcp/pcprijkeysca.c | 2 +- sources/ippcp/pcprsa_pkcs1v15_preproc.h | 4 +- sources/ippcp/pcprsa_pss_preproc.h | 4 +- sources/ippcp/pcpscramble.h | 14 ++-- sources/ippcp/pcpsha256stuff.h | 12 +-- sources/ippcp/pcpsha512stuff.h | 14 ++-- sources/ippcp/pcpsms4.h | 22 ++--- sources/ippcp/pcpsms4_ctr_gfni.c | 4 +- sources/ippcp/pcpsms4ctrl9cn.c | 6 +- sources/ippcp/pcpsms4ctry8cn.c | 2 +- sources/ippcp/pcpsms4ecb_setkeysy8cn.c | 12 +-- sources/ippcp/pcptool.h | 36 ++++---- sources/ippcp/sm2/ifma_arith_nsm2.c | 4 +- sources/ippcp/sm2/ifma_arith_psm2.c | 6 +- sources/ippcp/sm2/ifma_arith_psm2.h | 4 +- sources/ippcp/sm2/ifma_defs_sm2.h | 4 +- sources/ippcp/sm2/ifma_ecpoint_sm2.c | 6 +- sources/ippcp/sm2/ifma_ecpoint_sm2.h | 4 +- .../sm2/ifma_sm2_key_exchange_shared_key.c | 4 +- sources/ippcp/sm2/sm2_stuff.c | 4 +- sources/ippcp/sm2/sm2_stuff.h | 12 +-- .../gui/settings_panel.py | 2 +- .../tool/utils.py | 20 ++--- 143 files changed, 750 insertions(+), 730 deletions(-) diff --git a/BUILD.md b/BUILD.md index 1f501fa7..e6b0fe9d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -213,10 +213,10 @@ To build the Intel IPP Cryptography library on macOS\*, complete the following s - `-DPLATFORM_LIST=""` - optional, works only if `-DMERGED_BLD:BOOL=off` is set. Sets target platforms for the code to be compiled. See the supported platforms list [here](./OVERVIEW.md). - Example for Linux\* OS and the IA-32 architecture: - `-DPLATFORM_LIST="w7;s8;p8;g9;h9"` + `-DPLATFORM_LIST="m7;s8;p8;g9;h9"` - Example for Linux\* OS and the IntelĀ® 64 architecture: - `-DPLATFORM_LIST="m7;n8;y8;e9;l9;k0;k1"` + `-DPLATFORM_LIST="w7;n8;y8;e9;l9;k0"` - `-DNO_CRYPTO_MB:BOOL=TRUE` - optional, turns off the build of [Crypto Multi Buffer library](./sources/ippcp/crypto_mb/Readme.md) and, as a consequence, removes all dependencies on OpenSSL library. - `-DBABASSL:BOOL=on`, `-DBORINGSSL:BOOL=on` - required only if forks of OpenSSL library are used to resolve OpenSSL dependencies - Tongsuo and BoringSSL respectively. These flags make sense when [Crypto Multi Buffer library](./sources/ippcp/crypto_mb/Readme.md) is built. - `-DIPPCP_CUSTOM_BUILD=""` - optional, works only if `-DMERGED_BLD:BOOL=off` is set, i.e. only for 1CPU libraries. Enables the CPU feature dispatching mask at compile-time based on the provided list. @@ -239,6 +239,9 @@ To build the Intel IPP Cryptography library on macOS\*, complete the following s - `-DMBX_FIPS_MODE:BOOL=on`: enables all FIPS-compliance changes in Crypto Multi-buffer Library. - `-DMBX_FIPS_MODE:BOOL=off`: default configuration. Crypto Multi-buffer Library build with such option is not FIPS-compliant. + +- `-DFIPS_CUSTOM_IPPCP_API_HEADER=` - optional flag which allows to use FIPS self-tests with IPPCP API with a different prefix to support capabilities of the custom dispatcher generated by Custom Library Tool (Please, note that it is only intended for a very specific use case of [Custom Library](./OVERVIEW.md/#static-library-with-custom-functionality)).The header should contain redefinitions of IPPCP public API, e.g. `#define ippcpGetLibVersion custom_prefix_ippcpGetLibVersion`. The flag is applicable only when IPPCP FIPS mode is enabled (`-DIPPCP_FIPS_MODE:BOOL=on`). + ### Windows\* OS - `-G""` - defines the native build system CMake will generate from the input files. diff --git a/CHANGELOG.md b/CHANGELOG.md index d60c9cad..a3d628b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ This is a list of notable changes to Intel(R) IPP Cryptography, in reverse chronological order. +## Intel(R) IPP Cryptography 2021.12.1 +- Added `FIPS_CUSTOM_IPPCP_API_HEADER` build flag to support FIPS self-tests for a specific use case when Custom Library Tool is used with custom prefix for IPPCP API. + ## Intel(R) IPP Cryptography 2021.12 - Added single-buffer implementation of Leighton-Micali Hash-Based Signatures(LMS) algorithm, verification part. - Added support of Clang 16.0 compiler for Linux. diff --git a/include/ippversion.h b/include/ippversion.h index 54bf8f9f..a6459e8e 100644 --- a/include/ippversion.h +++ b/include/ippversion.h @@ -26,14 +26,14 @@ #if !defined( IPPVERSION_H__ ) #define IPPVERSION_H__ -#define IPP_VERSION_MAJOR 1 -#define IPP_VERSION_MINOR 0 -#define IPP_VERSION_UPDATE 0 +#define IPP_VERSION_MAJOR 2021 +#define IPP_VERSION_MINOR 12 +#define IPP_VERSION_UPDATE 1 // Major interface version -#define IPP_INTERFACE_VERSION_MAJOR 12 +#define IPP_INTERFACE_VERSION_MAJOR 11 // Minor interface version -#define IPP_INTERFACE_VERSION_MINOR 0 +#define IPP_INTERFACE_VERSION_MINOR 15 #define IPP_VERSION_STR STR(IPP_VERSION_MAJOR) "." STR(IPP_VERSION_MINOR) "." STR(IPP_VERSION_UPDATE) " (" STR(IPP_INTERFACE_VERSION_MAJOR) "." STR(IPP_INTERFACE_VERSION_MINOR) " )" diff --git a/sources/dispatcher/gen_disp_lin32.nonpic.py b/sources/dispatcher/gen_disp_lin32.nonpic.py index a59b6d60..457dceb4 100644 --- a/sources/dispatcher/gen_disp_lin32.nonpic.py +++ b/sources/dispatcher/gen_disp_lin32.nonpic.py @@ -107,7 +107,7 @@ {FunName}: {endbr32} mov eax, dword [ippcpJumpIndexForMergedLibs] - jmp dword [arraddr_{FunName} + eax*4] + jmp dword [rel arraddr_{FunName} + eax*4] .LEnd{FunName}: """.format(FunName=FunName, size=size, endbr32='db 0xf3, 0x0f, 0x1e, 0xfb')) ASMDISP.close() diff --git a/sources/include/fips_cert_internal/bn_common.h b/sources/include/fips_cert_internal/bn_common.h index a2e8dc63..6a36dfa8 100644 --- a/sources/include/fips_cert_internal/bn_common.h +++ b/sources/include/fips_cert_internal/bn_common.h @@ -31,9 +31,9 @@ * \param[in] sgn sign of big number * \param[in] pdata pointer to integer big number * \param[in] data_word_len length of integer big number in 32bit size - * + * */ -__IPPCP_INLINE IppStatus ippcp_init_set_bn(IppsBigNumState *pbn, int max_word_len, +__INLINE IppStatus ippcp_init_set_bn(IppsBigNumState *pbn, int max_word_len, IppsBigNumSGN sgn, const Ipp32u *pdata, int data_word_len) { IppStatus sts; diff --git a/sources/include/lms_internal/lmots.h b/sources/include/lms_internal/lmots.h index bb3f480c..b9ae5a41 100644 --- a/sources/include/lms_internal/lmots.h +++ b/sources/include/lms_internal/lmots.h @@ -58,7 +58,7 @@ typedef struct { * Output parameters: * params LMOTS parameters (w, p, ls, n, hash_method) */ -__IPPCP_INLINE IppStatus setLMOTSParams(IppsLMOTSAlgo lmotsOIDAlgo, cpLMOTSParams* params) { +__INLINE IppStatus setLMOTSParams(IppsLMOTSAlgo lmotsOIDAlgo, cpLMOTSParams* params) { switch (lmotsOIDAlgo) { case LMOTS_SHA256_N32_W1: { params->w = 1; @@ -134,11 +134,11 @@ __IPPCP_INLINE IppStatus setLMOTSParams(IppsLMOTSAlgo lmotsOIDAlgo, cpLMOTSParam * Target element of a specified length * */ -__IPPCP_INLINE Ipp32u cpCoef(Ipp8u* S, Ipp32u i, Ipp32u w) { +__INLINE Ipp32u cpCoef(Ipp8u* S, Ipp32u i, Ipp32u w) { return ((1 << w) - 1) & ( S[(i * w) / 8] >> (8 - (w * (i % (8 / w)) + w))); } -__IPPCP_INLINE Ipp32u cpCksm(Ipp8u* S, cpLMOTSParams lmotsParams) { +__INLINE Ipp32u cpCksm(Ipp8u* S, cpLMOTSParams lmotsParams) { Ipp32u w = lmotsParams.w; Ipp32u n = lmotsParams.n; Ipp32u ls = lmotsParams.ls; diff --git a/sources/include/lms_internal/lms.h b/sources/include/lms_internal/lms.h index 94a341d8..ab345ff0 100644 --- a/sources/include/lms_internal/lms.h +++ b/sources/include/lms_internal/lms.h @@ -86,7 +86,7 @@ struct _cpLMSSignatureState { * Output parameters: * params LMS parameters (h, m, hash_method) */ -__IPPCP_INLINE IppStatus setLMSParams(IppsLMSAlgo lmsOIDAlgo, cpLMSParams* params) { +__INLINE IppStatus setLMSParams(IppsLMSAlgo lmsOIDAlgo, cpLMSParams* params) { /* Set h */ switch (lmsOIDAlgo % 5) { case 0: { params->h = 5; break; } // LMS_SHA256_M32_H5 and LMS_SHA256_M24_H5 diff --git a/sources/include/owndefs.h b/sources/include/owndefs.h index 15df89d1..b14b24d9 100644 --- a/sources/include/owndefs.h +++ b/sources/include/owndefs.h @@ -34,15 +34,15 @@ #include "ippcpdefs.h" #endif -#if !defined(__IPPCP_INLINE) +#if !defined(__INLINE) #if defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) || defined(_MSC_VER) - #define __IPPCP_INLINE static __inline + #define __INLINE static __inline #elif defined( __GNUC__ ) - #define __IPPCP_INLINE static __inline__ + #define __INLINE static __inline__ #else - #define __IPPCP_INLINE static + #define __INLINE static #endif -#endif /*__IPPCP_INLINE*/ +#endif /*__INLINE*/ /* TODO: to check ICX compiler */ #if !defined(__NOINLINE) @@ -59,7 +59,7 @@ #if defined(_MSC_VER) #define __FORCEINLINE __forceinline #elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) || defined( __GNUC__ ) - #define __FORCEINLINE __IPPCP_INLINE __attribute__((always_inline)) + #define __FORCEINLINE __INLINE __attribute__((always_inline)) #else #define __FORCEINLINE #endif @@ -267,7 +267,7 @@ #endif #if ((_IPP_ARCH == _IPP_ARCH_IA32)) -__IPPCP_INLINE Ipp32s IPP_INT_PTR ( const void* ptr ) +__INLINE Ipp32s IPP_INT_PTR ( const void* ptr ) { union { void* Ptr; @@ -277,7 +277,7 @@ __IPPCP_INLINE Ipp32s IPP_INT_PTR ( const void* ptr ) return dd.Int; } -__IPPCP_INLINE Ipp32u IPP_UINT_PTR( const void* ptr ) +__INLINE Ipp32u IPP_UINT_PTR( const void* ptr ) { union { void* Ptr; @@ -287,7 +287,7 @@ __IPPCP_INLINE Ipp32u IPP_UINT_PTR( const void* ptr ) return dd.Int; } #elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2)) -__IPPCP_INLINE Ipp64s IPP_INT_PTR( const void* ptr ) +__INLINE Ipp64s IPP_INT_PTR( const void* ptr ) { union { void* Ptr; @@ -297,7 +297,7 @@ __IPPCP_INLINE Ipp64s IPP_INT_PTR( const void* ptr ) return dd.Int; } -__IPPCP_INLINE Ipp64u IPP_UINT_PTR( const void* ptr ) +__INLINE Ipp64u IPP_UINT_PTR( const void* ptr ) { union { void* Ptr; diff --git a/sources/include/stateful_sig_common/common.h b/sources/include/stateful_sig_common/common.h index 7f4bf150..51ad5dc4 100644 --- a/sources/include/stateful_sig_common/common.h +++ b/sources/include/stateful_sig_common/common.h @@ -25,7 +25,7 @@ * out resulted array of bytes */ -__IPPCP_INLINE void toByte(Ipp8u *out, Ipp32s outlen, Ipp32u in) { +__INLINE void toByte(Ipp8u *out, Ipp32s outlen, Ipp32u in) { /* Iterate over out in decreasing order, for big-endianness. */ for (Ipp32s i = outlen - 1; i >= 0; i--) { out[i] = (Ipp8u)(in & 0xff); diff --git a/sources/include/xmss_internal/wots.h b/sources/include/xmss_internal/wots.h index 89cc8832..07410707 100644 --- a/sources/include/xmss_internal/wots.h +++ b/sources/include/xmss_internal/wots.h @@ -62,7 +62,7 @@ IPP_OWN_DECL(IppStatus, WOTS_pkFromSig, (const Ipp8u* M, Ipp8u* sig, Ipp8u* pSee * adrs changed array of bytes */ -__IPPCP_INLINE void set_adrs_idx(Ipp8u* adrs, Ipp32u idx, int word_id){ +__INLINE void set_adrs_idx(Ipp8u* adrs, Ipp32u idx, int word_id){ adrs[4 * word_id + 3] = (Ipp8u) idx & 0xff; adrs[4 * word_id + 2] = (Ipp8u)(idx >> 8) & 0xff; adrs[4 * word_id + 1] = (Ipp8u)(idx >> 16) & 0xff; @@ -79,7 +79,7 @@ __IPPCP_INLINE void set_adrs_idx(Ipp8u* adrs, Ipp32u idx, int word_id){ * word_id int32 idx in the adrs array */ -__IPPCP_INLINE Ipp8u set_adrs_1_byte(int word_id){ +__INLINE Ipp8u set_adrs_1_byte(int word_id){ return (Ipp8u)(4 * word_id + 3); } @@ -90,7 +90,7 @@ __IPPCP_INLINE Ipp8u set_adrs_1_byte(int word_id){ * x double precision floating point value */ -__IPPCP_INLINE Ipp32s cpCeil(double x) { +__INLINE Ipp32s cpCeil(double x) { Ipp32s int_val = (Ipp32s) x; if(int_val == x || x <= 0.0){ return int_val; diff --git a/sources/include/xmss_internal/xmss.h b/sources/include/xmss_internal/xmss.h index b765bd74..6145cda7 100644 --- a/sources/include/xmss_internal/xmss.h +++ b/sources/include/xmss_internal/xmss.h @@ -98,7 +98,7 @@ IPP_OWN_DECL(IppStatus, rand_hash, (Ipp8u* left, Ipp8u* right, Ipp8u* seed, * params WOTS parameters (w, log2_w, n, len, len_1, hash_method) */ -__IPPCP_INLINE IppStatus setXMSSParams(IppsXMSSAlgo OIDAlgo, Ipp32s* h, cpWOTSParams* params) { +__INLINE IppStatus setXMSSParams(IppsXMSSAlgo OIDAlgo, Ipp32s* h, cpWOTSParams* params) { // Digits below are from the XMSS algo spec // don't depend on the algo diff --git a/sources/ippcp/CMakeLists.txt b/sources/ippcp/CMakeLists.txt index 18c9be24..34acf9be 100644 --- a/sources/ippcp/CMakeLists.txt +++ b/sources/ippcp/CMakeLists.txt @@ -273,7 +273,18 @@ if(IPPCP_FIPS_MODE) ) list(APPEND IPPCP_PUBLIC_HEADERS "${IPPCP_FIPS_CERT_PUBLIC_HEADERS}") list(APPEND LIBRARY_HEADERS "${IPPCP_FIPS_CERT_INTERNAL_HEADERS}") - list(APPEND LIBRARY_C_SOURCES_ORIGINAL "${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES}") + + set_source_files_properties(${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} PROPERTIES INCLUDE_DIRECTORIES "${C_INCLUDE_DIRECTORIES}") + + # Add FIPS custom API header + if(FIPS_CUSTOM_IPPCP_API_HEADER) + message (STATUS "Using FIPS_CUSTOM_IPPCP_API_HEADER ......................... " ${FIPS_CUSTOM_IPPCP_API_HEADER}) + if(WIN32) + set_source_files_properties(${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} PROPERTIES COMPILE_FLAGS "/FI${FIPS_CUSTOM_IPPCP_API_HEADER}") + else() + set_source_files_properties(${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} PROPERTIES COMPILE_FLAGS "-imacros ${FIPS_CUSTOM_IPPCP_API_HEADER}") + endif() + endif() endif() # Because of CMake bug (https://gitlab.kitware.com/cmake/cmake/issues/19178) it is impossible to add @@ -370,6 +381,7 @@ foreach(opt ${PLATFORM_LIST}) pcpver.rc ${LIBRARY_HEADERS} ${LIBRARY_C_SOURCES_${opt}} + ${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} $) set_target_properties(${IPPCP_DYN_ITER} PROPERTIES LINK_FLAGS ${LINK_FLAG_DYNAMIC_WINDOWS}) @@ -383,6 +395,7 @@ foreach(opt ${PLATFORM_LIST}) add_library(${IPPCP_DYN_ITER_ASMOBJS} OBJECT ${LIBRARY_ASM_SOURCES_${opt}}) add_library(${IPPCP_DYN_ITER} SHARED ${LIBRARY_HEADERS} ${LIBRARY_C_SOURCES_${opt}} + ${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} $) if(APPLE) ## gres: copy LINK_FLAG_DYNAMIC_LINUX @@ -433,7 +446,7 @@ foreach(opt ${PLATFORM_LIST}) set(IPPCP_ST_ITER ${TARGET_NAME}_s_${opt}) set(IPPCP_ST_ITER_ASMOBJS ${TARGET_NAME}_s_${opt}-asmobjs) if(MERGED_BLD) - add_library(${IPPCP_ST_ITER} OBJECT ${LIBRARY_HEADERS} ${LIBRARY_C_SOURCES_${opt}}) + add_library(${IPPCP_ST_ITER} OBJECT ${LIBRARY_HEADERS} ${LIBRARY_C_SOURCES_${opt}} ${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES}) add_library(${IPPCP_ST_ITER_ASMOBJS} OBJECT ${LIBRARY_ASM_SOURCES_${opt}}) set(merged_dependency ${merged_dependency} $ $) @@ -441,6 +454,7 @@ foreach(opt ${PLATFORM_LIST}) add_library(${IPPCP_ST_ITER_ASMOBJS} OBJECT ${LIBRARY_ASM_SOURCES_${opt}}) add_library(${IPPCP_ST_ITER} STATIC ${LIBRARY_HEADERS} ${LIBRARY_C_SOURCES_${opt}} + ${IPPCP_FIPS_CERT_LIBRARY_C_SOURCES} $) endif() diff --git a/sources/ippcp/asm_intel64/pcpaesgcme9as.asm b/sources/ippcp/asm_intel64/pcpaesgcme9as.asm index 62384c3b..a9dd108d 100644 --- a/sources/ippcp/asm_intel64/pcpaesgcme9as.asm +++ b/sources/ippcp/asm_intel64/pcpaesgcme9as.asm @@ -248,7 +248,7 @@ IPPASM AesGcmPrecompute_avx,PUBLIC %xdefine pPrecomData rdi ; (rdi) pointer to the reflected multipliers reflect(hkey),(hkey<<1), (hkey^2)<<1, (hkey^4)<<1, %xdefine pHKey rsi ; (rsi) pointer to the Hkey value - movdqu xmm0, oword [pHKey] ; xmm0 holds HashKey + movdqu xmm0, oword [rel pHKey] ; xmm0 holds HashKey pshufb xmm0, [rel SHUF_CONST] ;movdqu oword [pPrecomData+sizeof_oword_*0], xmm0 @@ -296,7 +296,7 @@ IPPASM AesGcmPrecompute_avx2_vaes,PUBLIC %xdefine pPrecomputedData rdi ; (rdi) pointer to the reflected multipliers reflect(hkey),(hkey<<1), (hkey^2)<<1, (hkey^4)<<1, %xdefine pHKey rsi ; (rsi) pointer to the Hkey value - movdqu xmm0, oword [pHKey] ; xmm0 holds HashKey + movdqu xmm0, oword [rel pHKey] ; xmm0 holds HashKey pshufb xmm0, [rel SHUF_CONST] ; precompute HashKey<<1 mod poly from the HashKey @@ -381,14 +381,14 @@ IPPASM AesGcmMulGcm_avx,PUBLIC %xdefine pHash rdi ; (rdi) pointer to the Hash value %xdefine pHKey rsi ; (rsi) pointer to the (hkey<<1) value - movdqa xmm0, oword [pHash] + movdqa xmm0, oword [rel pHash] pshufb xmm0, [rel SHUF_CONST] - movdqa xmm1, oword [pHKey] + movdqa xmm1, oword [rel pHKey] sse_clmul_gcm xmm0, xmm1, xmm2, xmm3, xmm4 ; xmm0 holds Hash*HKey mod poly pshufb xmm0, [rel SHUF_CONST] - movdqa oword [pHash], xmm0 + movdqa oword [rel pHash], xmm0 REST_XMM REST_GPR @@ -413,15 +413,15 @@ IPPASM AesGcmAuth_avx,PUBLIC %assign BYTES_PER_BLK (16) - movdqa xmm0, oword [pHash] + movdqa xmm0, oword [rel pHash] pshufb xmm0, [rel SHUF_CONST] - movdqa xmm1, oword [pHKey] + movdqa xmm1, oword [rel pHKey] movsxd rdx, edx align IPP_ALIGN_FACTOR .auth_loop: - movdqu xmm2, oword [pSrc] ; src[] + movdqu xmm2, oword [rel pSrc] ; src[] pshufb xmm2, [rel SHUF_CONST] add pSrc, BYTES_PER_BLK pxor xmm0, xmm2 ; hash ^= src[] diff --git a/sources/ippcp/crypto_mb/include/crypto_mb/defs.h b/sources/ippcp/crypto_mb/include/crypto_mb/defs.h index a52516ab..085376ae 100644 --- a/sources/ippcp/crypto_mb/include/crypto_mb/defs.h +++ b/sources/ippcp/crypto_mb/include/crypto_mb/defs.h @@ -33,8 +33,8 @@ typedef unsigned long long int64u; #define __ALIGN64 __attribute__((aligned(64))) #endif - #if !defined(__MBX_INLINE) - #define __MBX_INLINE static __inline__ + #if !defined(__INLINE) + #define __INLINE static __inline__ #endif #if !defined(__NOINLINE) @@ -45,8 +45,8 @@ typedef unsigned long long int64u; #define __ALIGN64 __declspec(align(64)) #endif - #if !defined(__MBX_INLINE) - #define __MBX_INLINE static __forceinline + #if !defined(__INLINE) + #define __INLINE static __forceinline #endif #if !defined(__NOINLINE) diff --git a/sources/ippcp/crypto_mb/include/crypto_mb/fips_cert.h b/sources/ippcp/crypto_mb/include/crypto_mb/fips_cert.h index 0f6461fe..5a06286b 100644 --- a/sources/ippcp/crypto_mb/include/crypto_mb/fips_cert.h +++ b/sources/ippcp/crypto_mb/include/crypto_mb/fips_cert.h @@ -109,7 +109,7 @@ EXTERN_C fips_test_status fips_selftest_mbx_rsa4k_private_crt_ssl_mb8(void); #endif // BN_OPEN_SSL_DISABLE -/* +/* // Enumerator that contains information about FIPS-approved // functions inside the crypto_mb cryptographic boundary */ @@ -138,11 +138,11 @@ enum FIPS_CRYPTO_MB_FUNC { nistp256_ecdsa_verify_mb8, nistp384_ecdsa_verify_mb8, nistp521_ecdsa_verify_mb8, - + ed25519_public_key_mb8, ed25519_sign_mb8, ed25519_verify_mb8, - + rsa_public_mb8, rsa_private_mb8, rsa_private_crt_mb8, @@ -170,7 +170,7 @@ enum FIPS_CRYPTO_MB_FUNC { nistp256_ecdsa_verify_ssl_mb8, nistp384_ecdsa_verify_ssl_mb8, nistp521_ecdsa_verify_ssl_mb8, - + rsa_public_ssl_mb8, rsa_private_ssl_mb8, rsa_private_crt_ssl_mb8, @@ -184,7 +184,7 @@ enum FIPS_CRYPTO_MB_FUNC { x25519_public_key_mb8, x25519_mb8, - + sm2_ecpublic_key_mb8, sm2_ecdh_mb8, sm2_ecdsa_sign_mb8, @@ -233,20 +233,20 @@ enum FIPS_CRYPTO_MB_FUNC { /** * \brief * - * An indicator if a function is FIPS-approved or not - * - * \param[in] function member of FIPS_CRYPTO_MB_FUNC enumerator + * An indicator if a function is FIPS-approved or not + * + * \param[in] function member of FIPS_CRYPTO_MB_FUNC enumerator * that corresponds to API being checked. * \return func_fips_approved equal to 1 if FIPS-approved algorithm is used * - * Example: - * Library API FIPS_CRYPTO_MB_FUNC + * Example: + * Library API FIPS_CRYPTO_MB_FUNC * mbx_rsa_public_mb8 -> rsa_public_mb8 * mbx_nistp256_ecdh_mb8 -> nistp256_ecdh_mb8 * mbx_ -> - * + * */ -__MBX_INLINE func_fips_approved mbx_is_fips_approved_func(enum FIPS_CRYPTO_MB_FUNC function) +__INLINE func_fips_approved mbx_is_fips_approved_func(enum FIPS_CRYPTO_MB_FUNC function) { return ((int)function > 0); } diff --git a/sources/ippcp/crypto_mb/include/crypto_mb/status.h b/sources/ippcp/crypto_mb/include/crypto_mb/status.h index 7d5f3722..16b395cd 100644 --- a/sources/ippcp/crypto_mb/include/crypto_mb/status.h +++ b/sources/ippcp/crypto_mb/include/crypto_mb/status.h @@ -29,23 +29,23 @@ typedef int64u mbx_status16; #define MBX_STATUS_LOW_ORDER_ERR (4) #define MBX_STATUS_SIGNATURE_ERR (8) -__MBX_INLINE mbx_status MBX_SET_STS(mbx_status status, int numb, mbx_status sttVal) +__INLINE mbx_status MBX_SET_STS(mbx_status status, int numb, mbx_status sttVal) { numb &= 7; /* 0 <= numb < 8 */ status &= (mbx_status)(~(0xF << (numb*4))); return status |= (sttVal & 0xF) << (numb*4); } -__MBX_INLINE mbx_status MBX_GET_STS(mbx_status status, int numb) +__INLINE mbx_status MBX_GET_STS(mbx_status status, int numb) { return (status >>(numb*4)) & 0xF; } -__MBX_INLINE mbx_status MBX_SET_STS_ALL(mbx_status stsVal) +__INLINE mbx_status MBX_SET_STS_ALL(mbx_status stsVal) { return (stsVal<<4*7) | (stsVal<<4*6) | (stsVal<<4*5) | (stsVal<<4*4) | (stsVal<<4*3) | (stsVal<<4*2) | (stsVal<<4*1) | stsVal; } -__MBX_INLINE mbx_status MBX_SET_STS_BY_MASK(mbx_status status, int8u mask, mbx_status sttVal) +__INLINE mbx_status MBX_SET_STS_BY_MASK(mbx_status status, int8u mask, mbx_status sttVal) { int numb; @@ -56,7 +56,7 @@ __MBX_INLINE mbx_status MBX_SET_STS_BY_MASK(mbx_status status, int8u mask, mbx_s return status; } -__MBX_INLINE int MBX_IS_ANY_OK_STS(mbx_status status) +__INLINE int MBX_IS_ANY_OK_STS(mbx_status status) { int ret = MBX_STATUS_OK==MBX_GET_STS(status, 0) || MBX_STATUS_OK==MBX_GET_STS(status, 1) @@ -74,30 +74,30 @@ __MBX_INLINE int MBX_IS_ANY_OK_STS(mbx_status status) */ /* Accessors for the low and high part of 64-bit status */ -__MBX_INLINE mbx_status MBX_GET_HIGH_PART_STS16(mbx_status16 status16) +__INLINE mbx_status MBX_GET_HIGH_PART_STS16(mbx_status16 status16) { return ((mbx_status)(((mbx_status16)(status16) >> 32) & 0xFFFFFFFF)); } -__MBX_INLINE mbx_status MBX_GET_LOW_PART_STS16(mbx_status16 status16) +__INLINE mbx_status MBX_GET_LOW_PART_STS16(mbx_status16 status16) { return ((mbx_status)(status16)); } -__MBX_INLINE mbx_status16 MBX_SET_STS16_ALL(mbx_status16 stsVal) +__INLINE mbx_status16 MBX_SET_STS16_ALL(mbx_status16 stsVal) { return (stsVal<<4*15) | (stsVal<<4*14) | (stsVal<<4*13) | (stsVal<<4*12) | (stsVal<<4*11) | (stsVal<<4*10) | (stsVal<<4*9) | (stsVal<<4*8) | \ (stsVal<<4*7) | (stsVal<<4*6) | (stsVal<<4*5) | (stsVal<<4*4) | (stsVal<<4*3) | (stsVal<<4*2) | (stsVal<<4*1) | stsVal; } - -__MBX_INLINE mbx_status16 MBX_SET_STS16(mbx_status16 status, int numb, mbx_status16 sttVal) + +__INLINE mbx_status16 MBX_SET_STS16(mbx_status16 status, int numb, mbx_status16 sttVal) { numb &= 15; /* 0 <= numb < 16 */ status &= (mbx_status16)(~((int64u)0xF << (numb*4))); return status |= (sttVal & 0xF) << (numb*4); } -__MBX_INLINE mbx_status16 MBX_SET_STS16_BY_MASK(mbx_status16 status, int16u mask, mbx_status16 sttVal) +__INLINE mbx_status16 MBX_SET_STS16_BY_MASK(mbx_status16 status, int16u mask, mbx_status16 sttVal) { int numb; for (numb = 0; numb < 16; numb++) { @@ -107,7 +107,7 @@ __MBX_INLINE mbx_status16 MBX_SET_STS16_BY_MASK(mbx_status16 status, int16u mask return status; } -__MBX_INLINE int MBX_IS_ANY_OK_STS16(mbx_status16 status) +__INLINE int MBX_IS_ANY_OK_STS16(mbx_status16 status) { return MBX_IS_ANY_OK_STS(MBX_GET_HIGH_PART_STS16(status)) || \ MBX_IS_ANY_OK_STS(MBX_GET_LOW_PART_STS16(status)); diff --git a/sources/ippcp/crypto_mb/include/crypto_mb/version.h b/sources/ippcp/crypto_mb/include/crypto_mb/version.h index e9927c28..5e7b9b19 100644 --- a/sources/ippcp/crypto_mb/include/crypto_mb/version.h +++ b/sources/ippcp/crypto_mb/include/crypto_mb/version.h @@ -21,14 +21,14 @@ /* crypto_mb name & version */ #define MBX_LIB_NAME() "crypto_mb" -#define MBX_VER_MAJOR 2 +#define MBX_VER_MAJOR 1 #define MBX_VER_MINOR 0 -#define MBX_VER_REV 0 +#define MBX_VER_REV 14 /* major interface version */ -#define MBX_INTERFACE_VERSION_MAJOR 12 +#define MBX_INTERFACE_VERSION_MAJOR 11 /* minor interface version */ -#define MBX_INTERFACE_VERSION_MINOR 0 +#define MBX_INTERFACE_VERSION_MINOR 15 typedef struct { int major; /* e.g. 1 */ diff --git a/sources/ippcp/crypto_mb/include/internal/common/ifma_math.h b/sources/ippcp/crypto_mb/include/internal/common/ifma_math.h index 3614e017..3218b4d2 100644 --- a/sources/ippcp/crypto_mb/include/internal/common/ifma_math.h +++ b/sources/ippcp/crypto_mb/include/internal/common/ifma_math.h @@ -34,30 +34,30 @@ #define SIMD_BYTES (SIMD_LEN/8) #define MB_WIDTH (SIMD_LEN/64) - __MBX_INLINE U64 loadu64(const void *p) { + __INLINE U64 loadu64(const void *p) { return _mm512_loadu_si512((U64*)p); } - __MBX_INLINE U64 loadstream64(const void *p) { + __INLINE U64 loadstream64(const void *p) { return _mm512_stream_load_si512 ((U64*)p); } - __MBX_INLINE void storeu64(const void *p, U64 v) { + __INLINE void storeu64(const void *p, U64 v) { _mm512_storeu_si512((U64*)p, v); } #define mask_mov64 _mm512_mask_mov_epi64 #define set64 _mm512_set1_epi64 - __MBX_INLINE U64 fma52lo(U64 a, U64 b, U64 c) { + __INLINE U64 fma52lo(U64 a, U64 b, U64 c) { return _mm512_madd52lo_epu64(a, b, c); } - __MBX_INLINE U64 fma52hi(U64 a, U64 b, U64 c) { + __INLINE U64 fma52hi(U64 a, U64 b, U64 c) { return _mm512_madd52hi_epu64(a, b, c); } - __MBX_INLINE U64 mul52lo(U64 b, U64 c) { + __INLINE U64 mul52lo(U64 b, U64 c) { return _mm512_madd52lo_epu64(_mm512_setzero_si512(), b, c); } @@ -73,7 +73,7 @@ __asm__ ( "vpmadd52huq " #o "(%2), %1, %0" : "+x" (r): "x" (b), "r" (c) ); \ } - __MBX_INLINE U64 select64(__mb_mask k, U64 v, U64 *d) { + __INLINE U64 select64(__mb_mask k, U64 v, U64 *d) { __asm__("vmovdqu64 %2, %%zmm0 \n" "vpblendmq %%zmm0, %0, %0 %{%1%} \n" : "+v"(v) @@ -93,7 +93,7 @@ } #pragma optimize("", off) - __MBX_INLINE U64 select64(__mb_mask k, U64 v, U64 *d) { + __INLINE U64 select64(__mb_mask k, U64 v, U64 *d) { return _mm512_mask_blend_epi64(k, v, _mm512_load_si512(d)); } @@ -103,38 +103,38 @@ #define fma52lo_mem(r, a, b, c, o) _mm512_madd52lo_epu64_(r, a, b, c, o) // gres #define fma52hi_mem(r, a, b, c, o) _mm512_madd52hi_epu64_(r, a, b, c, o) // gres - __MBX_INLINE U64 add64(U64 a, U64 b) { + __INLINE U64 add64(U64 a, U64 b) { return _mm512_add_epi64(a, b); } - __MBX_INLINE U64 sub64(U64 a, U64 b) { + __INLINE U64 sub64(U64 a, U64 b) { return _mm512_sub_epi64(a, b); } - __MBX_INLINE U64 get_zero64() { + __INLINE U64 get_zero64() { return _mm512_setzero_si512(); } - __MBX_INLINE void set_zero64(U64 *a) { + __INLINE void set_zero64(U64 *a) { *a = _mm512_xor_si512(*a, *a); } - __MBX_INLINE U64 set1(unsigned long long a) { + __INLINE U64 set1(unsigned long long a) { return _mm512_set1_epi64((long long)a); } - __MBX_INLINE U64 srli64(U64 a, int s) { + __INLINE U64 srli64(U64 a, int s) { return _mm512_srli_epi64(a, s); } #define srai64 _mm512_srai_epi64 #define slli64 _mm512_slli_epi64 - __MBX_INLINE U64 and64_const(U64 a, unsigned long long mask) { + __INLINE U64 and64_const(U64 a, unsigned long long mask) { return _mm512_and_epi64(a, _mm512_set1_epi64((long long)mask)); } - __MBX_INLINE U64 and64(U64 a, U64 mask) { + __INLINE U64 and64(U64 a, U64 mask) { return _mm512_and_epi64(a, mask); } @@ -150,7 +150,7 @@ #define mask_sub64 _mm512_mask_sub_epi64 #define maskz_sub64 _mm512_maskz_sub_epi64 - __MBX_INLINE __mb_mask is_zero(U64* p, int len) { + __INLINE __mb_mask is_zero(U64* p, int len) { U64 Z = p[0]; for(int i = 1; i < len; i++) { Z = or64(Z, p[i]); diff --git a/sources/ippcp/crypto_mb/include/internal/common/mem_fns.h b/sources/ippcp/crypto_mb/include/internal/common/mem_fns.h index 6dfa9db5..8695e0f4 100644 --- a/sources/ippcp/crypto_mb/include/internal/common/mem_fns.h +++ b/sources/ippcp/crypto_mb/include/internal/common/mem_fns.h @@ -17,7 +17,7 @@ /* * Auxiliary functions to set and copy memory */ -__MBX_INLINE void CopyBlock(const void* pSrc, void* pDst, int numBytes) +__INLINE void CopyBlock(const void* pSrc, void* pDst, int numBytes) { const int8u* s = (int8u*)pSrc; int8u* d = (int8u*)pDst; @@ -26,7 +26,7 @@ __MBX_INLINE void CopyBlock(const void* pSrc, void* pDst, int numBytes) d[k] = s[k]; } -__MBX_INLINE void PadBlock(int8u paddingByte, void* pDst, int numBytes) +__INLINE void PadBlock(int8u paddingByte, void* pDst, int numBytes) { int8u* d = (int8u*)pDst; int k; diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p256.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p256.h index ca3d26ba..cce0614d 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p256.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p256.h @@ -49,23 +49,23 @@ static const int64u VMASK52[sizeof(U64)/sizeof(int64u)] = { /* set FE to zero */ -__MBX_INLINE void MB_FUNC_NAME(zero_FE256_)(U64 T[]) +__INLINE void MB_FUNC_NAME(zero_FE256_)(U64 T[]) { T[0] = T[1] = T[2] = T[3] = T[4] = get_zero64(); } /* check if FE is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_FE256_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_FE256_)(const U64 T[]) { U64 Z = or64(or64(T[0], T[1]), or64(or64(T[2], T[3]), T[4])); return cmpeq64_mask(Z, get_zero64()); } -__MBX_INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) +__INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) { return mask_mov64 (a, kmask, b); } /* move field element */ -__MBX_INLINE void MB_FUNC_NAME(mov_FE256_)(U64 r[], const U64 a[]) +__INLINE void MB_FUNC_NAME(mov_FE256_)(U64 r[], const U64 a[]) { r[0] = a[0]; r[1] = a[1]; @@ -76,7 +76,7 @@ __MBX_INLINE void MB_FUNC_NAME(mov_FE256_)(U64 r[], const U64 a[]) /* move coordinate using mask: R = k? A : B */ OPTIMIZE_OFF_VS19 -__MBX_INLINE void MB_FUNC_NAME(mask_mov_FE256_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(mask_mov_FE256_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) { R[0] = mask_mov64(B[0], k, A[0]); R[1] = mask_mov64(B[1], k, A[1]); @@ -85,7 +85,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_mov_FE256_)(U64 R[], const U64 B[], __mb_mas R[4] = mask_mov64(B[4], k, A[4]); } -__MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE256_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(secure_mask_mov_FE256_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) { R[0] = select64(k, B[0], (U64*)(&A[0])); R[1] = select64(k, B[1], (U64*)(&A[1])); @@ -95,7 +95,7 @@ __MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE256_)(U64 R[], U64 B[], __mb_ma } /* compare two FE */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE256_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE256_)(const U64 A[], const U64 B[]) { /* r = a - b */ U64 r0 = sub64(A[0], B[0]); @@ -114,7 +114,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE256_)(const U64 A[], const U64 B[]) return cmp64_mask(r4, get_zero64(), _MM_CMPINT_LT); } -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE256_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE256_)(const U64 A[], const U64 B[]) { __ALIGN64 U64 msg[P256_LEN52]; @@ -123,7 +123,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE256_)(const U64 A[], const U64 B[]) msg[2] = xor64(A[2], B[2]); msg[3] = xor64(A[3], B[3]); msg[4] = xor64(A[4], B[4]); - + return MB_FUNC_NAME(is_zero_FE256_)(msg); } diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p384.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p384.h index 2f043a09..a5ab6980 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p384.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p384.h @@ -53,24 +53,24 @@ static const int64u VMASK52[sizeof(U64)/sizeof(int64u)] = { /* set FE to zero */ -__MBX_INLINE void MB_FUNC_NAME(zero_FE384_)(U64 T[]) +__INLINE void MB_FUNC_NAME(zero_FE384_)(U64 T[]) { T[0] = T[1] = T[2] = T[3] = T[4] = T[5] = T[6] = T[7] = get_zero64(); } /* check if FE is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_FE384_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_FE384_)(const U64 T[]) { //U64 Z = or64(or64(or64(or64(or64(or64(or64(T[0], T[1]), T[2]), T[3]), T[4]), T[5]), T[6]), T[7]); U64 Z = or64(or64(or64(T[0], T[1]), or64(T[2], T[3])), or64(or64(T[4], T[5]), or64(T[6], T[7]))); return cmpeq64_mask(Z, get_zero64()); } -__MBX_INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) +__INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) { return mask_mov64 (a, kmask, b); } /* move field element */ -__MBX_INLINE void MB_FUNC_NAME(mov_FE384_)(U64 r[], const U64 a[]) +__INLINE void MB_FUNC_NAME(mov_FE384_)(U64 r[], const U64 a[]) { r[0] = a[0]; r[1] = a[1]; @@ -84,7 +84,7 @@ __MBX_INLINE void MB_FUNC_NAME(mov_FE384_)(U64 r[], const U64 a[]) /* move coordinate using mask: R = k? A : B */ OPTIMIZE_OFF_VS19 -__MBX_INLINE void MB_FUNC_NAME(mask_mov_FE384_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(mask_mov_FE384_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) { R[0] = mask_mov64(B[0], k, A[0]); R[1] = mask_mov64(B[1], k, A[1]); @@ -96,7 +96,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_mov_FE384_)(U64 R[], const U64 B[], __mb_mas R[7] = mask_mov64(B[7], k, A[7]); } -__MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE384_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(secure_mask_mov_FE384_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) { R[0] = select64(k, B[0], (U64*)(&A[0])); R[1] = select64(k, B[1], (U64*)(&A[1])); @@ -108,7 +108,7 @@ __MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE384_)(U64 R[], U64 B[], __mb_ma R[7] = select64(k, B[7], (U64*)(&A[7])); } -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE384_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE384_)(const U64 A[], const U64 B[]) { /* r = a - b */ U64 r0 = sub64(A[0], B[0]); @@ -135,7 +135,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE384_)(const U64 A[], const U64 B[]) } /* compare two FE */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE384_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE384_)(const U64 A[], const U64 B[]) { U64 T[P384_LEN52]; T[0] = xor64(A[0], B[0]); diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p521.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p521.h index 1426a982..aed99c8e 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p521.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_arith_p521.h @@ -56,23 +56,23 @@ static const int64u VMASK52[sizeof(U64)/sizeof(int64u)] = { /* set FE to zero */ -__MBX_INLINE void MB_FUNC_NAME(zero_FE521_)(U64 T[]) +__INLINE void MB_FUNC_NAME(zero_FE521_)(U64 T[]) { T[0] = T[1] = T[2] = T[3] = T[4] = T[5] = T[6] = T[7] = T[8] = T[9] = T[10] = get_zero64(); } /* check if FE is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_FE521_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_FE521_)(const U64 T[]) { U64 Z = or64(or64(or64(or64(T[0], T[1]), or64(T[2], T[3])), or64(or64(T[4], T[5]), or64(T[6], T[7]))), or64(or64(T[8], T[9]), T[10])); return cmpeq64_mask(Z, get_zero64()); } -__MBX_INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) +__INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) { return mask_mov64 (a, kmask, b); } /* move field element */ -__MBX_INLINE void MB_FUNC_NAME(mov_FE521_)(U64 r[], const U64 a[]) +__INLINE void MB_FUNC_NAME(mov_FE521_)(U64 r[], const U64 a[]) { r[0] = a[0]; r[1] = a[1]; @@ -89,7 +89,7 @@ __MBX_INLINE void MB_FUNC_NAME(mov_FE521_)(U64 r[], const U64 a[]) /* move coordinate using mask: R = k? A : B */ OPTIMIZE_OFF_VS19 -__MBX_INLINE void MB_FUNC_NAME(mask_mov_FE521_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(mask_mov_FE521_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) { R[0] = mask_mov64(B[0], k, A[0]); R[1] = mask_mov64(B[1], k, A[1]); @@ -104,7 +104,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_mov_FE521_)(U64 R[], const U64 B[], __mb_mas R[10]= mask_mov64(B[10],k, A[10]); } -__MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE521_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(secure_mask_mov_FE521_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) { R[0] = select64(k, B[0], (U64*)(&A[0])); R[1] = select64(k, B[1], (U64*)(&A[1])); @@ -119,7 +119,7 @@ __MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FE521_)(U64 R[], U64 B[], __mb_ma R[10]= select64(k,B[10], (U64*)(&A[10])); } -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE521_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE521_)(const U64 A[], const U64 B[]) { /* r = a - b */ U64 r0 = sub64(A[0], B[0]); @@ -150,7 +150,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FE521_)(const U64 A[], const U64 B[]) return cmp64_mask(r10, get_zero64(), _MM_CMPINT_LT); } -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE521_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FE521_)(const U64 A[], const U64 B[]) { U64 T[P521_LEN52]; diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p256.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p256.h index 99d8ff3e..4b5f37e7 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p256.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p256.h @@ -38,13 +38,13 @@ typedef struct { /* check if coordinate is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) { return MB_FUNC_NAME(is_zero_FE256_)(T); } /* set point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P256_POINT* r) +__INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P256_POINT* r) { r->X[0] = r->X[1] = r->X[2] = r->X[3] = r->X[4] = get_zero64(); r->Y[0] = r->Y[1] = r->Y[2] = r->Y[3] = r->Y[4] = get_zero64(); @@ -52,7 +52,7 @@ __MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P256_POINT* r) } /* set point to infinity by mask */ -__MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P256_POINT* r, __mb_mask mask) +__INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P256_POINT* r, __mb_mask mask) { U64 zeros = get_zero64(); @@ -76,7 +76,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P256_POINT* r, __mb_ } /* set affine point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P256_POINT_AFFINE* r) +__INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P256_POINT_AFFINE* r) { r->x[0] = r->x[1] = r->x[2] = r->x[3] = r->x[4] = get_zero64(); r->y[0] = r->y[1] = r->y[2] = r->y[3] = r->y[4] = get_zero64(); diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p384.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p384.h index 180e497d..9d224750 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p384.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p384.h @@ -38,13 +38,13 @@ typedef struct { /* check if coordinate is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) { return MB_FUNC_NAME(is_zero_FE384_)(T); } /* set point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P384_POINT* r) +__INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P384_POINT* r) { r->X[0] = r->X[1] = r->X[2] = r->X[3] = r->X[4] = r->X[5] = r->X[6] = r->X[7] = get_zero64(); r->Y[0] = r->Y[1] = r->Y[2] = r->Y[3] = r->Y[4] = r->Y[5] = r->Y[6] = r->Y[7] = get_zero64(); @@ -52,7 +52,7 @@ __MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P384_POINT* r) } /* set point to infinity by mask */ -__MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P384_POINT* r, __mb_mask mask) +__INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P384_POINT* r, __mb_mask mask) { U64 zeros = get_zero64(); @@ -85,7 +85,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P384_POINT* r, __mb_ } /* set affine point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P384_POINT_AFFINE* r) +__INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P384_POINT_AFFINE* r) { r->x[0] = r->x[1] = r->x[2] = r->x[3] = r->x[4] = r->x[5] = r->x[6] = r->x[7] = get_zero64(); r->y[0] = r->y[1] = r->y[2] = r->y[3] = r->y[4] = r->y[5] = r->y[6] = r->y[7] = get_zero64(); diff --git a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p521.h b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p521.h index 66b5eb0a..c6a3d71e 100644 --- a/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p521.h +++ b/sources/ippcp/crypto_mb/include/internal/ecnist/ifma_ecpoint_p521.h @@ -38,13 +38,13 @@ typedef struct { /* check if coordinate is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) { return MB_FUNC_NAME(is_zero_FE521_)(T); } /* set point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P521_POINT* r) +__INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P521_POINT* r) { r->X[0] = r->X[1] = r->X[2] = r->X[3] = r->X[4] = r->X[5] = r->X[6] = r->X[7] = r->X[8] = r->X[9] = r->X[10] = get_zero64(); r->Y[0] = r->Y[1] = r->Y[2] = r->Y[3] = r->Y[4] = r->Y[5] = r->Y[6] = r->Y[7] = r->Y[8] = r->Y[9] = r->Y[10] = get_zero64(); @@ -52,7 +52,7 @@ __MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(P521_POINT* r) } /* set point to infinity by mask */ -__MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P521_POINT* r, __mb_mask mask) +__INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P521_POINT* r, __mb_mask mask) { U64 zeros = get_zero64(); @@ -94,7 +94,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(P521_POINT* r, __mb_ } /* set affine point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P521_POINT_AFFINE* r) +__INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(P521_POINT_AFFINE* r) { r->x[0] = r->x[1] = r->x[2] = r->x[3] = r->x[4] = r->x[5] = r->x[6] = r->x[7] = r->x[8] = r->x[9] = r->x[10] = get_zero64(); r->y[0] = r->y[1] = r->y[2] = r->y[3] = r->y[4] = r->y[5] = r->y[6] = r->y[7] = r->y[8] = r->y[9] = r->y[10] = get_zero64(); diff --git a/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_ed25519.h b/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_ed25519.h index f28aa980..a56ad98d 100644 --- a/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_ed25519.h +++ b/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_ed25519.h @@ -72,7 +72,7 @@ typedef struct ge52_cached_mb_t { */ /* ext => homo */ -__MBX_INLINE void ge52_ext_to_homo_mb(ge52_homo_mb*r, const ge52_ext_mb* p) +__INLINE void ge52_ext_to_homo_mb(ge52_homo_mb*r, const ge52_ext_mb* p) { fe52_copy_mb(r->X, p->X); fe52_copy_mb(r->Y, p->Y); @@ -80,7 +80,7 @@ __MBX_INLINE void ge52_ext_to_homo_mb(ge52_homo_mb*r, const ge52_ext_mb* p) } /* p1p1 => homo */ -__MBX_INLINE void ge52_p1p1_to_homo_mb(ge52_homo_mb *r, const ge52_p1p1_mb *p) +__INLINE void ge52_p1p1_to_homo_mb(ge52_homo_mb *r, const ge52_p1p1_mb *p) { fe52_mul(r->X, p->X, p->T); fe52_mul(r->Y, p->Y, p->Z); @@ -88,7 +88,7 @@ __MBX_INLINE void ge52_p1p1_to_homo_mb(ge52_homo_mb *r, const ge52_p1p1_mb *p) } /* p1p1 => ext */ -__MBX_INLINE void ge52_p1p1_to_ext_mb(ge52_ext_mb *r, const ge52_p1p1_mb *p) +__INLINE void ge52_p1p1_to_ext_mb(ge52_ext_mb *r, const ge52_p1p1_mb *p) { fe52_mul(r->X, p->X, p->T); fe52_mul(r->Y, p->Y, p->Z); @@ -98,26 +98,26 @@ __MBX_INLINE void ge52_p1p1_to_ext_mb(ge52_ext_mb *r, const ge52_p1p1_mb *p) /* set GE to neutral */ -__MBX_INLINE void neutral_ge52_homo_mb(ge52_homo_mb* ge) +__INLINE void neutral_ge52_homo_mb(ge52_homo_mb* ge) { fe52_0_mb(ge->X); fe52_1_mb(ge->Y); fe52_1_mb(ge->Z); } -__MBX_INLINE void neutral_ge52_ext_mb(ge52_ext_mb* ge) +__INLINE void neutral_ge52_ext_mb(ge52_ext_mb* ge) { fe52_0_mb(ge->X); fe52_1_mb(ge->Y); fe52_0_mb(ge->T); fe52_1_mb(ge->Z); } -__MBX_INLINE void neutral_ge52_precomp_mb(ge52_precomp_mb *ge) +__INLINE void neutral_ge52_precomp_mb(ge52_precomp_mb *ge) { fe52_1_mb(ge->ysubx); fe52_1_mb(ge->yaddx); fe52_0_mb(ge->t2d); } -__MBX_INLINE void neutral_ge52_cached_mb(ge52_cached_mb* ge) +__INLINE void neutral_ge52_cached_mb(ge52_cached_mb* ge) { fe52_1_mb(ge->YsubX); fe52_1_mb(ge->YaddX); @@ -126,19 +126,19 @@ __MBX_INLINE void neutral_ge52_cached_mb(ge52_cached_mb* ge) } /* move GE under mask (conditionally): r = k? a : b */ -__MBX_INLINE void ge52_cmov1_precomp_mb(ge52_precomp_mb* r, const ge52_precomp_mb* b, __mb_mask k, const ge52_precomp* a) +__INLINE void ge52_cmov1_precomp_mb(ge52_precomp_mb* r, const ge52_precomp_mb* b, __mb_mask k, const ge52_precomp* a) { fe52_cmov1_mb(r->ysubx, b->ysubx, k, a->ysubx); fe52_cmov1_mb(r->yaddx, b->yaddx, k, a->yaddx); fe52_cmov1_mb(r->t2d, b->t2d, k, a->t2d); } -__MBX_INLINE void cmov_ge52_precomp_mb(ge52_precomp_mb* r, const ge52_precomp_mb* b, __mb_mask k, const ge52_precomp_mb* a) +__INLINE void cmov_ge52_precomp_mb(ge52_precomp_mb* r, const ge52_precomp_mb* b, __mb_mask k, const ge52_precomp_mb* a) { fe52_cmov_mb(r->ysubx, b->ysubx, k, a->ysubx); fe52_cmov_mb(r->yaddx, b->yaddx, k, a->yaddx); fe52_cmov_mb(r->t2d, b->t2d, k, a->t2d); } -__MBX_INLINE void cmov_ge52_cached_mb(ge52_cached_mb* r, const ge52_cached_mb* b, __mb_mask k, const ge52_cached_mb* a) +__INLINE void cmov_ge52_cached_mb(ge52_cached_mb* r, const ge52_cached_mb* b, __mb_mask k, const ge52_cached_mb* a) { fe52_cmov_mb(r->YsubX, b->YsubX, k, a->YsubX); fe52_cmov_mb(r->YaddX, b->YaddX, k, a->YaddX); diff --git a/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_p25519.h b/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_p25519.h index 10d7f9a5..3baa124d 100644 --- a/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_p25519.h +++ b/sources/ippcp/crypto_mb/include/internal/ed25519/ifma_arith_p25519.h @@ -47,19 +47,19 @@ typedef U64 fe52_mb[FE_LEN52]; /* set FE to zero */ -__MBX_INLINE void fe52_0_mb(fe52_mb fe) +__INLINE void fe52_0_mb(fe52_mb fe) { fe[0] = fe[1] = fe[2] = fe[3] = fe[4] = get_zero64(); } /* set FE to 1 */ -__MBX_INLINE void fe52_1_mb(fe52_mb fe) +__INLINE void fe52_1_mb(fe52_mb fe) { fe[0] = set1(1LL); fe[1] = fe[2] = fe[3] = fe[4] = get_zero64(); } /* copy FE */ -__MBX_INLINE void fe52_copy_mb(fe52_mb r, const fe52_mb a) +__INLINE void fe52_copy_mb(fe52_mb r, const fe52_mb a) { r[0] = a[0]; r[1] = a[1]; @@ -69,7 +69,7 @@ __MBX_INLINE void fe52_copy_mb(fe52_mb r, const fe52_mb a) } /* convert fe52_mb => fe64_mb */ -__MBX_INLINE void fe52_to_fe64_mb(fe64_mb r, const fe52_mb a) +__INLINE void fe52_to_fe64_mb(fe64_mb r, const fe52_mb a) { r[0] = xor64(slli64(a[1],52), a[0]); r[1] = xor64(slli64(a[2],40), srli64(a[1],12)); @@ -78,14 +78,14 @@ __MBX_INLINE void fe52_to_fe64_mb(fe64_mb r, const fe52_mb a) } /* check if FE is zero */ -__MBX_INLINE __mb_mask fe52_mb_is_zero(const fe52_mb a) +__INLINE __mb_mask fe52_mb_is_zero(const fe52_mb a) { U64 t = or64(or64(a[0], a[1]), or64(or64(a[2], a[3]), a[4])); return cmpeq64_mask(t, get_zero64()); } /* check if a==b */ -__MBX_INLINE __mb_mask fe52_mb_is_equ(const fe52_mb a, const fe52_mb b) +__INLINE __mb_mask fe52_mb_is_equ(const fe52_mb a, const fe52_mb b) { __ALIGN64 fe52_mb t; t[0] = xor64(a[0], b[0]); @@ -97,7 +97,7 @@ __MBX_INLINE __mb_mask fe52_mb_is_equ(const fe52_mb a, const fe52_mb b) } /* move FE under mask (conditionally): r = k? a : b */ -__MBX_INLINE void fe52_cmov1_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const fe52 a) +__INLINE void fe52_cmov1_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const fe52 a) { r[0] = mask_mov64(b[0], k, set1(a[0])); r[1] = mask_mov64(b[1], k, set1(a[1])); @@ -106,7 +106,7 @@ __MBX_INLINE void fe52_cmov1_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const f r[4] = mask_mov64(b[4], k, set1(a[4])); } OPTIMIZE_OFF_VS19 -__MBX_INLINE void fe52_cmov_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const fe52_mb a) +__INLINE void fe52_cmov_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const fe52_mb a) { r[0] = mask_mov64(b[0], k, a[0]); r[1] = mask_mov64(b[1], k, a[1]); @@ -116,13 +116,13 @@ __MBX_INLINE void fe52_cmov_mb(fe52_mb r, const fe52_mb b, __mb_mask k, const fe } /* swap FE under mask (conditionally): r = k? a : b */ -__MBX_INLINE void cswap_U64(U64* x, __mb_mask k, U64* y) +__INLINE void cswap_U64(U64* x, __mb_mask k, U64* y) { *x = _mm512_mask_xor_epi64(*x, k, *x, *y); *y = _mm512_mask_xor_epi64(*y, k, *y, *x); *x = _mm512_mask_xor_epi64(*x, k, *x, *y); } -__MBX_INLINE void fe52_cswap_mb(fe52_mb a, __mb_mask k, fe52_mb b) +__INLINE void fe52_cswap_mb(fe52_mb a, __mb_mask k, fe52_mb b) { cswap_U64(&a[0], k, &b[0]); cswap_U64(&a[1], k, &b[1]); diff --git a/sources/ippcp/crypto_mb/include/internal/sm2/ifma_arith_sm2.h b/sources/ippcp/crypto_mb/include/internal/sm2/ifma_arith_sm2.h index 4e06dd4c..7957b63a 100644 --- a/sources/ippcp/crypto_mb/include/internal/sm2/ifma_arith_sm2.h +++ b/sources/ippcp/crypto_mb/include/internal/sm2/ifma_arith_sm2.h @@ -29,20 +29,20 @@ #define PSM2_LEN8 NUMBER_OF_DIGITS(PSM2_BITSIZE,8) /* set FE to zero */ -__MBX_INLINE void MB_FUNC_NAME(zero_FESM2_)(U64 T[]) +__INLINE void MB_FUNC_NAME(zero_FESM2_)(U64 T[]) { T[0] = T[1] = T[2] = T[3] = T[4] = get_zero64(); } /* check if FE is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_FESM2_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_FESM2_)(const U64 T[]) { U64 Z = or64(or64(T[0], T[1]), or64(or64(T[2], T[3]), T[4])); return cmpeq64_mask(Z, get_zero64()); } /* move field element */ -__MBX_INLINE void MB_FUNC_NAME(mov_FESM2_)(U64 r[], const U64 a[]) +__INLINE void MB_FUNC_NAME(mov_FESM2_)(U64 r[], const U64 a[]) { r[0] = a[0]; r[1] = a[1]; @@ -52,7 +52,7 @@ __MBX_INLINE void MB_FUNC_NAME(mov_FESM2_)(U64 r[], const U64 a[]) } /* move coordinate using mask: R = k? A : B */ -__MBX_INLINE void MB_FUNC_NAME(mask_mov_FESM2_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(mask_mov_FESM2_)(U64 R[], const U64 B[], __mb_mask k, const U64 A[]) { R[0] = mask_mov64(B[0], k, A[0]); R[1] = mask_mov64(B[1], k, A[1]); @@ -61,7 +61,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_mov_FESM2_)(U64 R[], const U64 B[], __mb_mas R[4] = mask_mov64(B[4], k, A[4]); } -__MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FESM2_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) +__INLINE void MB_FUNC_NAME(secure_mask_mov_FESM2_)(U64 R[], U64 B[], __mb_mask k, const U64 A[]) { R[0] = select64(k, B[0], (U64*)(&A[0])); R[1] = select64(k, B[1], (U64*)(&A[1])); @@ -71,7 +71,7 @@ __MBX_INLINE void MB_FUNC_NAME(secure_mask_mov_FESM2_)(U64 R[], U64 B[], __mb_ma } /* compare two FE */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FESM2_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FESM2_)(const U64 A[], const U64 B[]) { /* r = a - b */ U64 r0 = sub64(A[0], B[0]); @@ -90,7 +90,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_lt_FESM2_)(const U64 A[], const U64 B[]) return cmp64_mask(r4, get_zero64(), _MM_CMPINT_LT); } -__MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FESM2_)(const U64 A[], const U64 B[]) +__INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FESM2_)(const U64 A[], const U64 B[]) { __ALIGN64 U64 msg[PSM2_LEN52]; @@ -99,7 +99,7 @@ __MBX_INLINE __mb_mask MB_FUNC_NAME(cmp_eq_FESM2_)(const U64 A[], const U64 B[]) msg[2] = xor64(A[2], B[2]); msg[3] = xor64(A[3], B[3]); msg[4] = xor64(A[4], B[4]); - + return MB_FUNC_NAME(is_zero_FESM2_)(msg); } diff --git a/sources/ippcp/crypto_mb/include/internal/sm2/ifma_ecpoint_sm2.h b/sources/ippcp/crypto_mb/include/internal/sm2/ifma_ecpoint_sm2.h index 11ee909e..00831ab5 100644 --- a/sources/ippcp/crypto_mb/include/internal/sm2/ifma_ecpoint_sm2.h +++ b/sources/ippcp/crypto_mb/include/internal/sm2/ifma_ecpoint_sm2.h @@ -36,13 +36,13 @@ typedef struct { } SINGLE_SM2_POINT_AFFINE; /* check if coordinate is zero */ -__MBX_INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) +__INLINE __mb_mask MB_FUNC_NAME(is_zero_point_cordinate_)(const U64 T[]) { return MB_FUNC_NAME(is_zero_FESM2_)(T); } /* set point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(SM2_POINT* r) +__INLINE void MB_FUNC_NAME(set_point_to_infinity_)(SM2_POINT* r) { r->X[0] = r->X[1] = r->X[2] = r->X[3] = r->X[4] = get_zero64(); r->Y[0] = r->Y[1] = r->Y[2] = r->Y[3] = r->Y[4] = get_zero64(); @@ -50,7 +50,7 @@ __MBX_INLINE void MB_FUNC_NAME(set_point_to_infinity_)(SM2_POINT* r) } /* set point to infinity by mask */ -__MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(SM2_POINT* r, __mb_mask mask) +__INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(SM2_POINT* r, __mb_mask mask) { U64 zeros = get_zero64(); @@ -74,7 +74,7 @@ __MBX_INLINE void MB_FUNC_NAME(mask_set_point_to_infinity_)(SM2_POINT* r, __mb_m } /* set affine point to infinity */ -__MBX_INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(SM2_POINT_AFFINE* r) +__INLINE void MB_FUNC_NAME(set_point_affine_to_infinity_)(SM2_POINT_AFFINE* r) { r->x[0] = r->x[1] = r->x[2] = r->x[3] = r->x[4] = get_zero64(); r->y[0] = r->y[1] = r->y[2] = r->y[3] = r->y[4] = get_zero64(); diff --git a/sources/ippcp/crypto_mb/include/internal/sm3/sm3_common.h b/sources/ippcp/crypto_mb/include/internal/sm3/sm3_common.h index f0b0f408..1dbe59fc 100644 --- a/sources/ippcp/crypto_mb/include/internal/sm3/sm3_common.h +++ b/sources/ippcp/crypto_mb/include/internal/sm3/sm3_common.h @@ -46,7 +46,7 @@ #define HASH_BUFF(ctx) ((ctx)->msg_buffer) /* -// constants +// constants */ static const int32u sm3_iv[] = { 0x7380166F, 0x4914B2B9, 0x172442D7, 0xDA8A0600, @@ -65,11 +65,11 @@ __ALIGN64 static const int32u tj_calculated[] = { 0x79CC4519,0xF3988A32,0xE73114 0x879D8A7A,0x0F3B14F5,0x1E7629EA,0x3CEC53D4,0x79D8A7A8,0xF3B14F50,0xE7629EA1,0xCEC53D43 }; /* -// internal functions +// internal functions */ -__MBX_INLINE void pad_block(int8u padding_byte, void* dst_p, int num_bytes) +__INLINE void pad_block(int8u padding_byte, void* dst_p, int num_bytes) { int8u* d = (int8u*)dst_p; int k; @@ -77,7 +77,7 @@ __MBX_INLINE void pad_block(int8u padding_byte, void* dst_p, int num_bytes) d[k] = padding_byte; } -__MBX_INLINE void TRANSPOSE_8X8_I32(__m256i *v0, __m256i *v1, __m256i *v2, __m256i *v3, +__INLINE void TRANSPOSE_8X8_I32(__m256i *v0, __m256i *v1, __m256i *v2, __m256i *v3, __m256i *v4, __m256i *v5, __m256i *v6, __m256i *v7) { __m256i w0, w1, w2, w3, w4, w5, w6, w7; @@ -134,7 +134,7 @@ __MBX_INLINE void TRANSPOSE_8X8_I32(__m256i *v0, __m256i *v1, __m256i *v2, __m25 *v7 = _mm256_permute2x128_si256(x3, x7, 0b110001); } -__MBX_INLINE void MASK_TRANSPOSE_8X8_I32(int32u* out[8], const int32u* const inp[8], __mmask16 mb_mask) { +__INLINE void MASK_TRANSPOSE_8X8_I32(int32u* out[8], const int32u* const inp[8], __mmask16 mb_mask) { __m256i v0 = _mm256_loadu_si256((__m256i*)inp[0]); __m256i v1 = _mm256_loadu_si256((__m256i*)inp[1]); __m256i v2 = _mm256_loadu_si256((__m256i*)inp[2]); @@ -158,7 +158,7 @@ __MBX_INLINE void MASK_TRANSPOSE_8X8_I32(int32u* out[8], const int32u* const inp } -__MBX_INLINE void TRANSPOSE_8X16_I32(int32u* out[16], const int32u* const inp[8], __mmask16 mb_mask) { +__INLINE void TRANSPOSE_8X16_I32(int32u* out[16], const int32u* const inp[8], __mmask16 mb_mask) { __m256i v0 = _mm256_loadu_si256((__m256i*)inp[0]); __m256i v1 = _mm256_loadu_si256((__m256i*)inp[1]); __m256i v2 = _mm256_loadu_si256((__m256i*)inp[2]); diff --git a/sources/ippcp/crypto_mb/include/internal/sm4/sm4_gcm_mb.h b/sources/ippcp/crypto_mb/include/internal/sm4/sm4_gcm_mb.h index e826715a..e1d18aca 100644 --- a/sources/ippcp/crypto_mb/include/internal/sm4/sm4_gcm_mb.h +++ b/sources/ippcp/crypto_mb/include/internal/sm4/sm4_gcm_mb.h @@ -22,12 +22,12 @@ #define SM4_GCM_MB_H ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/* -// Constant from NIST Special Publication 800-38D +/* +// Constant from NIST Special Publication 800-38D // (Recommendation for GCMmode, p.5.2.1.1 Input Data) // len(P) <= 2^39-256 bits */ -static const int64u MAX_TXT_LEN = ((int64u)1 << 36) - 32; // length in bytes +static const int64u MAX_TXT_LEN = ((int64u)1 << 36) - 32; // length in bytes /* // Internal functions @@ -167,7 +167,7 @@ static const int rearrangeOrder[] = { 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, to[14] = from[11]; \ to[15] = from[15]; -__MBX_INLINE __m512i inc_block32(__m512i x, const int8u *increment) { return mask_add_epi32(x, 0x1111, x, M512(increment)); } +__INLINE __m512i inc_block32(__m512i x, const int8u *increment) { return mask_add_epi32(x, 0x1111, x, M512(increment)); } static __ALIGN64 const int8u initialInc[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/sources/ippcp/crypto_mb/include/internal/sm4/sm4_mb.h b/sources/ippcp/crypto_mb/include/internal/sm4/sm4_mb.h index d080e03f..99cd25a2 100644 --- a/sources/ippcp/crypto_mb/include/internal/sm4/sm4_mb.h +++ b/sources/ippcp/crypto_mb/include/internal/sm4/sm4_mb.h @@ -320,25 +320,25 @@ EXTERN_C void sm4_xts_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[ const int8u* pa_tweak[SM4_LINES], __mmask16 mb_mask, const int dir); // The transformation based on SM4 sbox algebraic structure, parameters were computed manually -__MBX_INLINE __m512i sBox512(__m512i block) +__INLINE __m512i sBox512(__m512i block) { block = _mm512_gf2p8affine_epi64_epi8(block, M512(affineIn), 0x65); block = _mm512_gf2p8affineinv_epi64_epi8(block, M512(affineOut), 0xd3); return block; } -__MBX_INLINE __m512i Lblock512(__m512i x) +__INLINE __m512i Lblock512(__m512i x) { return _mm512_ternarylogic_epi32(_mm512_xor_si512(_mm512_rol_epi32(x, 2), _mm512_rol_epi32(x, 10)), _mm512_rol_epi32(x, 18), _mm512_shuffle_epi8 (x, _mm512_loadu_si512(shuf8)), 0x96); } -__MBX_INLINE __m512i Lkey512(__m512i x) +__INLINE __m512i Lkey512(__m512i x) { return _mm512_xor_epi32(_mm512_rol_epi32(x, 13), _mm512_rol_epi32(x, 23)); } -__MBX_INLINE __m512i IncBlock512(__m512i x, const int8u* increment) +__INLINE __m512i IncBlock512(__m512i x, const int8u* increment) { __m512i t = _mm512_add_epi64(x, M512(increment)); __mmask8 carryMask = _mm512_cmplt_epu64_mask(t, x); @@ -472,7 +472,7 @@ __MBX_INLINE __m512i IncBlock512(__m512i x, const int8u* increment) \ T0=K0,T1=K1,T2=K2,T3=K3 -__MBX_INLINE void TRANSPOSE_16x4_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const int8u* p_inp[16], __mmask16 mb_mask) { +__INLINE void TRANSPOSE_16x4_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const int8u* p_inp[16], __mmask16 mb_mask) { __mmask16 loc_mb_mask = mb_mask; // L0 - L3 @@ -510,7 +510,7 @@ __MBX_INLINE void TRANSPOSE_16x4_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2 *t3 = _mm512_unpackhi_epi64(z1, z3); } -__MBX_INLINE void TRANSPOSE_16x4_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const __m128i in[16]) { +__INLINE void TRANSPOSE_16x4_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const __m128i in[16]) { // L0 - L3 __m512i z0 = _mm512_castsi128_si512(in[0]); __m512i z1 = _mm512_castsi128_si512(in[1]); @@ -546,7 +546,7 @@ __MBX_INLINE void TRANSPOSE_16x4_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i *t3 = _mm512_unpackhi_epi64(z1, z3); } -__MBX_INLINE void TRANSPOSE_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], __mmask16 mb_mask) { +__INLINE void TRANSPOSE_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], __mmask16 mb_mask) { #define STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti) \ _mm512_mask_storeu_epi32(OUT, store_mask * (0x1&loc_mb_mask), Ti); \ @@ -591,7 +591,7 @@ __MBX_INLINE void TRANSPOSE_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2 } -__MBX_INLINE void TRANSPOSE_4x16_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i out[16]) { +__INLINE void TRANSPOSE_4x16_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i out[16]) { __m512i z0 = _mm512_unpacklo_epi32(*t0, *t1); __m512i z1 = _mm512_unpackhi_epi32(*t0, *t1); @@ -630,7 +630,7 @@ __MBX_INLINE void TRANSPOSE_4x16_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i } -__MBX_INLINE void TRANSPOSE_4x16_I32_O128_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i p_out[16], __mmask16 mb_mask) { +__INLINE void TRANSPOSE_4x16_I32_O128_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i p_out[16], __mmask16 mb_mask) { #define STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti) \ _mm512_mask_storeu_epi32(OUT, store_mask * (0x1&loc_mb_mask), Ti); \ @@ -675,7 +675,7 @@ __MBX_INLINE void TRANSPOSE_4x16_I32_O128_EPI32(__m512i* t0, __m512i* t1, __m512 } -__MBX_INLINE void TRANSPOSE_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], int* p_loc_len, __mmask16 mb_mask) { +__INLINE void TRANSPOSE_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], int* p_loc_len, __mmask16 mb_mask) { #define STORE_RESULT_EPI8(OUT, store_mask, loc_mb_mask, Ti) \ _mm512_mask_storeu_epi8(OUT, store_mask * (0x1&loc_mb_mask), Ti); \ @@ -737,7 +737,7 @@ __MBX_INLINE void TRANSPOSE_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __ STORE_RESULT_EPI8((__m128i*)p_out[15] - 3, stream_mask << 48, loc_mb_mask, t3); } -__MBX_INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], const int8u* p_iv[16], __mmask16 mb_mask) { +__INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], const int8u* p_iv[16], __mmask16 mb_mask) { #define XOR_AND_STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti, IV, TMP) \ TMP = _mm512_maskz_loadu_epi32(store_mask * (0x1&loc_mb_mask), IV); \ @@ -787,7 +787,7 @@ __MBX_INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m XOR_AND_STORE_RESULT((__m128i*)p_out[15] - 3, 0xF000, loc_mb_mask, *t3, (__m128i*)p_iv[15] - 3, z3); } -__MBX_INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], const int8u* p_iv[16], int* p_loc_len, __mmask16 mb_mask) { +__INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], const int8u* p_iv[16], int* p_loc_len, __mmask16 mb_mask) { #define XOR_AND_STORE_RESULT_EPI8(OUT, store_mask, loc_mb_mask, Ti, IV, TMP) \ TMP = _mm512_maskz_loadu_epi8(store_mask * (0x1&loc_mb_mask), IV); \ diff --git a/sources/ippcp/crypto_mb/src/common/cpu_features.c b/sources/ippcp/crypto_mb/src/common/cpu_features.c index d3e0fb53..1b794629 100644 --- a/sources/ippcp/crypto_mb/src/common/cpu_features.c +++ b/sources/ippcp/crypto_mb/src/common/cpu_features.c @@ -61,7 +61,7 @@ #define edx_ (3) -__MBX_INLINE void _mbcp_cpuid(int32u buf[4], int32u leaf, int32u subleaf) +__INLINE void _mbcp_cpuid(int32u buf[4], int32u leaf, int32u subleaf) { #ifdef __GNUC__ __asm__ ("cpuid" : "=a" (buf[0]), "=b" (buf[1]), "=c" (buf[2]), "=d" (buf[3]) : "a" (leaf), "c" (subleaf)); diff --git a/sources/ippcp/crypto_mb/src/common/ifma_cvt52.c b/sources/ippcp/crypto_mb/src/common/ifma_cvt52.c index 8898ef79..e6db178c 100644 --- a/sources/ippcp/crypto_mb/src/common/ifma_cvt52.c +++ b/sources/ippcp/crypto_mb/src/common/ifma_cvt52.c @@ -33,11 +33,11 @@ #define MIN(a, b) ( ((a) < (b)) ? a : b ) -__MBX_INLINE __mmask8 MB_MASK(int L) { +__INLINE __mmask8 MB_MASK(int L) { return (L > 0) ? (__mmask8)0xFF : (__mmask8)0; } -__MBX_INLINE __mmask64 SB_MASK1(int L, int REV) +__INLINE __mmask64 SB_MASK1(int L, int REV) { if (L <= 0) return (__mmask64)0x0; @@ -65,7 +65,7 @@ __MBX_INLINE __mmask64 SB_MASK1(int L, int REV) // - 8 hex strings -> mb8 */ DISABLE_OPTIMIZATION -__MBX_INLINE void transform_8sb_to_mb8(U64 out_mb8[], int bitLen, int8u *inp[8], int inpLen[8], int flag) { +__INLINE void transform_8sb_to_mb8(U64 out_mb8[], int bitLen, int8u *inp[8], int inpLen[8], int flag) { // inverse bytes (reverse=1) const __m512i bswap_mask = _mm512_set_epi64( 0x0001020304050607, 0x08090a0b0c0d0e0f, @@ -254,7 +254,7 @@ int8u ifma_HexStr8_to_mb8(int64u out_mb8[][8], const int8u* const pStr[8], int b // - mb8 -> 8 hex strings */ DISABLE_OPTIMIZATION -__MBX_INLINE void transform_mb8_to_8sb(int8u* out[8], int outLen[8], const U64 inp_mb8[], int bitLen, int flag) +__INLINE void transform_mb8_to_8sb(int8u* out[8], int outLen[8], const U64 inp_mb8[], int bitLen, int flag) { // inverse bytes (reverse=1) const __m512i bswap_mask = _mm512_set_epi64( diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n384.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n384.c index 38a5de23..3752da68 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n384.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n384.c @@ -310,7 +310,7 @@ void MB_FUNC_NAME(ifma_frommont52_n384_)(U64 r[], const U64 a[]) #define fe52_mul MB_FUNC_NAME(ifma_amm52_n384_) /* r = base^(2^n) */ -__MBX_INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) +__INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) { if(r!=base) { fe52_sqr(r,base); diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n521.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n521.c index 37b3b6f0..c92a2d6e 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n521.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_n521.c @@ -237,7 +237,7 @@ void MB_FUNC_NAME(ifma_ams52_n521_)(U64 r[], const U64 va[]) U64 r20, r21; U64 u; - r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = r10 = + r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = r16 = r17 = r18 = r19 = r20 = r21 = get_zero64(); // full square @@ -399,7 +399,7 @@ void MB_FUNC_NAME(ifma_frommont52_n521_)(U64 r[], const U64 a[]) #define fe52_mul MB_FUNC_NAME(ifma_amm52_n521_) /* r = base^(2^n) */ -__MBX_INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) +__INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) { if(r!=base) { fe52_sqr(r,base); @@ -504,7 +504,7 @@ void MB_FUNC_NAME(ifma_aminv52_n521_)(U64 r[], const U64 z[]) Specialized single operations over n521 add, sub, neg =====================================================================*/ -__MBX_INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) +__INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) { U64 d = mask_sub64(sub64(a, b), lt_mask, sub64(a, b), set1(1)); return cmp64_mask(d, get_zero64(), _MM_CMPINT_LT); diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p384.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p384.c index 57232dc5..20391df5 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p384.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p384.c @@ -332,7 +332,7 @@ void MB_FUNC_NAME(ifma_frommont52_p384_)(U64 r[], const U64 a[]) #define fe52_mul MB_FUNC_NAME(ifma_amm52_p384_) /* r = base^(2^n) */ -__MBX_INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) +__INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) { if(r!=base) MB_FUNC_NAME(mov_FE384_)(r, base); @@ -402,7 +402,7 @@ void MB_FUNC_NAME(ifma_aminv52_p384_)(U64 r[], const U64 z[]) Specialized single operations over p384: add, sub, neg =====================================================================*/ -__MBX_INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) +__INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) { U64 d = mask_sub64(sub64(a, b), lt_mask, sub64(a, b), set1(1)); return cmp64_mask(d, get_zero64(), _MM_CMPINT_LT); diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p521.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p521.c index ea6896f9..28c7979a 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p521.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_arith_p521.c @@ -99,7 +99,7 @@ void MB_FUNC_NAME(ifma_amm52_p521_)(U64 r[], const U64 va[], const U64 vb[]) U64 r10, r11, r12, r13, r14, r15, r16, r17, r18, r19; U64 r20, r21; - r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = + r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = r16 = r17 = r18 = r19= r20 = r21 = get_zero64(); @@ -282,7 +282,7 @@ void MB_FUNC_NAME(ifma_ams52_p521_)(U64 r[], const U64 va[]) U64 r10, r11, r12, r13, r14, r15, r16, r17, r18, r19; U64 r20, r21; - r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = r10 = + r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = r16 = r17 = r18 = r19 = r20 = r21 = get_zero64(); // full square @@ -486,7 +486,7 @@ void MB_FUNC_NAME(ifma_frommont52_p521_)(U64 r[], const U64 a[]) #define fe52_mul MB_FUNC_NAME(ifma_amm52_p521_) /* r = base^(2^n) */ -__MBX_INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) +__INLINE void fe52_sqr_pwr(U64 r[], const U64 base[], int n) { if(r!=base) MB_FUNC_NAME(mov_FE521_)(r, base); @@ -574,7 +574,7 @@ void MB_FUNC_NAME(ifma_aminv52_p521_)(U64 r[], const U64 z[]) Specialized single operations over p521: add, sub, neg =====================================================================*/ -__MBX_INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) +__INLINE __mb_mask MB_FUNC_NAME(lt_mbx_digit_)(const U64 a, const U64 b, const __mb_mask lt_mask) { U64 d = mask_sub64(sub64(a, b), lt_mask, sub64(a, b), set1(1)); return cmp64_mask(d, get_zero64(), _MM_CMPINT_LT); diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p256.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p256.c index 0ef12318..ecb00a06 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p256.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p256.c @@ -30,8 +30,8 @@ /* // Presentation of point at infinity: -// - projective (X : Y : 0) -// - affine (0 : 0) +// - projective (X : Y : 0) +// - affine (0 : 0) */ /* @@ -330,7 +330,7 @@ static __NOINLINE void clear_secret_context(U64* wval, U64* dval, __mb_mask* dsi *sign = s & 1; *digit = (Ipp8u)d; */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -493,7 +493,7 @@ void MB_FUNC_NAME(ifma_ec_nistp256_mul_point_)(P256_POINT* r, const P256_POINT* #define BP_WIN_SIZE MUL_BASEPOINT_WIN_SIZE /* defined in the header above */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -509,7 +509,7 @@ __MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U } /* extract affine affine point */ -__MBX_INLINE void MB_FUNC_NAME(extract_point_affine_)(P256_POINT_AFFINE* r, const SINGLE_P256_POINT_AFFINE* tbl, U64 idx) +__INLINE void MB_FUNC_NAME(extract_point_affine_)(P256_POINT_AFFINE* r, const SINGLE_P256_POINT_AFFINE* tbl, U64 idx) { /* decrement index (the table does not contain [0]*P */ U64 targIdx = sub64(idx, set1(1)); diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p384.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p384.c index a82d7ff8..9ef01bff 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p384.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p384.c @@ -30,8 +30,8 @@ /* // Presentation of point at infinity: -// - projective (X : Y : 0) -// - affine (0 : 0) +// - projective (X : Y : 0) +// - affine (0 : 0) */ /* @@ -329,7 +329,7 @@ static __NOINLINE void clear_secret_context(U64* wval, U64* dval, __mb_mask* dsi *sign = s & 1; *digit = (Ipp8u)d; */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -492,7 +492,7 @@ void MB_FUNC_NAME(ifma_ec_nistp384_mul_point_)(P384_POINT* r, const P384_POINT* #define BP_WIN_SIZE MUL_BASEPOINT_WIN_SIZE /* defined in the header above */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -508,7 +508,7 @@ __MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U } /* extract affine affine point */ -__MBX_INLINE void MB_FUNC_NAME(extract_point_affine_)(P384_POINT_AFFINE* r, const SINGLE_P384_POINT_AFFINE* tbl, U64 idx) +__INLINE void MB_FUNC_NAME(extract_point_affine_)(P384_POINT_AFFINE* r, const SINGLE_P384_POINT_AFFINE* tbl, U64 idx) { /* decrement index (the table does not contain [0]*P */ U64 targIdx = sub64(idx, set1(1)); @@ -517,7 +517,7 @@ __MBX_INLINE void MB_FUNC_NAME(extract_point_affine_)(P384_POINT_AFFINE* r, cons U64 ay0, ay1, ay2, ay3, ay4, ay5, ay6, ay7; /* assume the point at infinity is what need */ - ax0 = ax1 = ax2 = ax3 = ax4 = ax5 = ax6 = ax7= + ax0 = ax1 = ax2 = ax3 = ax4 = ax5 = ax6 = ax7= ay0 = ay1 = ay2 = ay3 = ay4 = ay5 = ay6 = ay7 = get_zero64(); /* find out what we actually need or just keep original infinity */ diff --git a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p521.c b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p521.c index e7fc8d90..ab22335d 100644 --- a/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p521.c +++ b/sources/ippcp/crypto_mb/src/ecnist/ifma_ecpoint_p521.c @@ -30,8 +30,8 @@ /* // Presentation of point at infinity: -// - projective (X : Y : 0) -// - affine (0 : 0) +// - projective (X : Y : 0) +// - affine (0 : 0) */ /* @@ -333,7 +333,7 @@ static __NOINLINE void clear_secret_context(U64* wval, U64* dval, __mb_mask* dsi *sign = s & 1; *digit = (Ipp8u)d; */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -496,7 +496,7 @@ void MB_FUNC_NAME(ifma_ec_nistp521_mul_point_)(P521_POINT* r, const P521_POINT* #define BP_WIN_SIZE MUL_BASEPOINT_WIN_SIZE /* defined in the header above */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -512,7 +512,7 @@ __MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U } /* extract affine affine point */ -__MBX_INLINE void MB_FUNC_NAME(extract_point_affine_)(P521_POINT_AFFINE* r, const SINGLE_P521_POINT_AFFINE* tbl, U64 idx) +__INLINE void MB_FUNC_NAME(extract_point_affine_)(P521_POINT_AFFINE* r, const SINGLE_P521_POINT_AFFINE* tbl, U64 idx) { /* decrement index (the table does not contain [0]*P */ U64 targIdx = sub64(idx, set1(1)); diff --git a/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_ed25519.c b/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_ed25519.c index c630d4cb..f111edfe 100644 --- a/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_ed25519.c +++ b/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_ed25519.c @@ -55,7 +55,7 @@ __ALIGN64 static const int64u ed25519_2_pm1_4[FE_LEN52][sizeof(U64) / sizeof(int }; /* ext => cached */ -__MBX_INLINE void ge_ext_to_cached_mb(ge52_cached_mb *r, const ge52_ext_mb* p) +__INLINE void ge_ext_to_cached_mb(ge52_cached_mb *r, const ge52_ext_mb* p) { fe52_add(r->YaddX, p->Y, p->X); fe52_sub(r->YsubX, p->Y, p->X); @@ -272,15 +272,15 @@ static void extract_precomputed_basepoint_dual(ge52_precomp_mb* p0, */ /* if msb set */ -__MBX_INLINE int32u isMsb_ct(int32u a) +__INLINE int32u isMsb_ct(int32u a) { return (int32u)0 - (a >> (sizeof(a) * 8 - 1)); } /* tests if a==0 */ -__MBX_INLINE int32u isZero(int32u a) +__INLINE int32u isZero(int32u a) { return isMsb_ct(~a & (a - 1)); } /* tests if a==b */ -__MBX_INLINE int32u isEqu(int32u a, int32u b) +__INLINE int32u isEqu(int32u a, int32u b) { return isZero(a ^ b); } void ifma_ed25519_mul_basepoint(ge52_ext_mb* r, const U64 scalar[]) @@ -377,7 +377,7 @@ void ifma_ed25519_mul_basepoint(ge52_ext_mb* r, const U64 scalar[]) *sign = s & 1; *digit = (Ipp8u)d; */ -__MBX_INLINE void booth_recode(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void booth_recode(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); diff --git a/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_p25519.c b/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_p25519.c index b77a00b9..4c4a80dd 100644 --- a/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_p25519.c +++ b/sources/ippcp/crypto_mb/src/ed25519/ifma_arith_p25519.c @@ -36,7 +36,7 @@ __ALIGN64 static const int64u VPRIME25519_HI[sizeof(U64) / sizeof(int64u)] = { R##I = and64_const(R##I, DIGIT_MASK); -//__MBX_INLINE +//__INLINE void fe52_mb_add_mod25519(fe52_mb vr, const fe52_mb va, const fe52_mb vb) { /* r = a+b */ @@ -75,7 +75,7 @@ void fe52_mb_add_mod25519(fe52_mb vr, const fe52_mb va, const fe52_mb vb) vr[4] = mask_mov64(t4, cmask, r4); } -//__MBX_INLINE +//__INLINE void fe52_mb_sub_mod25519(fe52_mb vr, const fe52_mb va, const fe52_mb vb) { /* r = a-b */ @@ -114,7 +114,7 @@ void fe52_mb_sub_mod25519(fe52_mb vr, const fe52_mb va, const fe52_mb vb) vr[4] = mask_mov64(r4, cmask, t4); } -//__MBX_INLINE +//__INLINE void fe52_mb_neg_mod25519(fe52_mb vr, const fe52_mb va) { __mb_mask non_zero = ~fe52_mb_is_zero(va); @@ -168,7 +168,7 @@ __ALIGN64 static const int64u MOD_2_260_[sizeof(U64) / sizeof(int64u)] = { REP8_ srli64(r##R5, 52), MOD_2_260); -//__MBX_INLINE +//__INLINE void fe52_mb_mul_mod25519(fe52_mb vr, const fe52_mb va, const fe52_mb vb) { U64 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; @@ -238,7 +238,7 @@ c=6 (2,4) (3,3) c=7 (3,4) c=8 (4,4) */ -//__MBX_INLINE +//__INLINE void fe52_mb_sqr_mod25519(fe52_mb vr, const fe52_mb va) { U64 *vb = (U64*)va; @@ -386,7 +386,7 @@ void fe52_mb_sqr_mod25519_times(fe52_mb vr, const fe52_mb va, int count) considering the exponent as 2^255 - 21 = (2^5) * (2^250 - 1) + 11. */ -//__MBX_INLINE +//__INLINE void fe52_mb_inv_mod25519(fe52_mb r, const fe52_mb z) { __ALIGN64 fe52_mb t0; diff --git a/sources/ippcp/crypto_mb/src/sm2/ifma_ecpoint_sm2.c b/sources/ippcp/crypto_mb/src/sm2/ifma_ecpoint_sm2.c index dbe449cd..6e7f654c 100644 --- a/sources/ippcp/crypto_mb/src/sm2/ifma_ecpoint_sm2.c +++ b/sources/ippcp/crypto_mb/src/sm2/ifma_ecpoint_sm2.c @@ -29,8 +29,8 @@ /* // Presentation of point at infinity: -// - projective (X : Y : 0) -// - affine (0 : 0) +// - projective (X : Y : 0) +// - affine (0 : 0) */ /* @@ -330,7 +330,7 @@ static __NOINLINE void clear_secret_context(U64* wval, U64* dval, __mb_mask* dsi *sign = s & 1; *digit = (Ipp8u)d; */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -493,7 +493,7 @@ void MB_FUNC_NAME(ifma_ec_sm2_mul_point_)(SM2_POINT* r, const SM2_POINT* p, cons #define BP_WIN_SIZE MUL_BASEPOINT_WIN_SIZE /* defined in the header above */ -__MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) +__INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U64 wvalue) { U64 one = set1(1); U64 zero = get_zero64(); @@ -509,7 +509,7 @@ __MBX_INLINE void MB_FUNC_NAME(booth_recode_bp_)(__mb_mask* sign, U64* dvalue, U } /* extract affine affine point */ -__MBX_INLINE void MB_FUNC_NAME(extract_point_affine_)(SM2_POINT_AFFINE* r, const SINGLE_SM2_POINT_AFFINE* tbl, U64 idx) +__INLINE void MB_FUNC_NAME(extract_point_affine_)(SM2_POINT_AFFINE* r, const SINGLE_SM2_POINT_AFFINE* tbl, U64 idx) { /* decrement index (the table does not contain [0]*P */ U64 targIdx = sub64(idx, set1(1)); diff --git a/sources/ippcp/crypto_mb/src/sm3/sm3_avx512_mb16.c b/sources/ippcp/crypto_mb/src/sm3/sm3_avx512_mb16.c index 4a82c453..cc8df63b 100644 --- a/sources/ippcp/crypto_mb/src/sm3/sm3_avx512_mb16.c +++ b/sources/ippcp/crypto_mb/src/sm3/sm3_avx512_mb16.c @@ -16,7 +16,7 @@ #include -__MBX_INLINE void TRANSPOSE_16X16_I32(int32u out[][16], const int32u* const inp[16]) +__INLINE void TRANSPOSE_16X16_I32(int32u out[][16], const int32u* const inp[16]) { __m512i r0 = _mm512_loadu_si512(inp[0]); __m512i r1 = _mm512_loadu_si512(inp[1]); @@ -36,11 +36,11 @@ __MBX_INLINE void TRANSPOSE_16X16_I32(int32u out[][16], const int32u* const inp[ __m512i r15 = _mm512_loadu_si512(inp[15]); // tansposition - __m512i t0 = _mm512_unpacklo_epi32(r0, r1); // 0 16 1 17 4 20 5 21 8 24 9 25 12 28 13 29 + __m512i t0 = _mm512_unpacklo_epi32(r0, r1); // 0 16 1 17 4 20 5 21 8 24 9 25 12 28 13 29 __m512i t1 = _mm512_unpackhi_epi32(r0, r1); // 2 18 3 19 6 22 7 23 10 26 11 27 14 30 15 31 __m512i t2 = _mm512_unpacklo_epi32(r2, r3); // 32 48 33 49 ... __m512i t3 = _mm512_unpackhi_epi32(r2, r3); // 34 50 35 51 ... - __m512i t4 = _mm512_unpacklo_epi32(r4, r5); // 64 80 65 81 ... + __m512i t4 = _mm512_unpacklo_epi32(r4, r5); // 64 80 65 81 ... __m512i t5 = _mm512_unpackhi_epi32(r4, r5); // 66 82 67 83 ... __m512i t6 = _mm512_unpacklo_epi32(r6, r7); // 96 112 97 113 ... __m512i t7 = _mm512_unpackhi_epi32(r6, r7); // 98 114 99 115 ... @@ -57,15 +57,15 @@ __MBX_INLINE void TRANSPOSE_16X16_I32(int32u out[][16], const int32u* const inp[ r1 = _mm512_unpackhi_epi64(t0, t2); // 1 17 33 49 ... r2 = _mm512_unpacklo_epi64(t1, t3); // 2 18 34 49 ... r3 = _mm512_unpackhi_epi64(t1, t3); // 3 19 35 51 ... - r4 = _mm512_unpacklo_epi64(t4, t6); // 64 80 96 112 ... + r4 = _mm512_unpacklo_epi64(t4, t6); // 64 80 96 112 ... r5 = _mm512_unpackhi_epi64(t4, t6); // 65 81 97 114 ... r6 = _mm512_unpacklo_epi64(t5, t7); // 66 82 98 113 ... r7 = _mm512_unpackhi_epi64(t5, t7); // 67 83 99 115 ... - r8 = _mm512_unpacklo_epi64(t8, t10); // 128 144 160 176 ... + r8 = _mm512_unpacklo_epi64(t8, t10); // 128 144 160 176 ... r9 = _mm512_unpackhi_epi64(t8, t10); // 129 145 161 178 ... - r10 = _mm512_unpacklo_epi64(t9, t11); // 130 146 162 177 ... + r10 = _mm512_unpacklo_epi64(t9, t11); // 130 146 162 177 ... r11 = _mm512_unpackhi_epi64(t9, t11); // 131 147 163 179 ... - r12 = _mm512_unpacklo_epi64(t12, t14); // 192 208 228 240 ... + r12 = _mm512_unpacklo_epi64(t12, t14); // 192 208 228 240 ... r13 = _mm512_unpackhi_epi64(t12, t14); // 193 209 229 241 ... r14 = _mm512_unpacklo_epi64(t13, t15); // 194 210 230 242 ... r15 = _mm512_unpackhi_epi64(t13, t15); // 195 211 231 243 ... @@ -318,7 +318,7 @@ void sm3_avx512_mb16(int32u hash_pa[][16], const int8u* const msg_pa[16], int le _mm512_storeu_si512(hash_pa + 5, F); _mm512_storeu_si512(hash_pa + 6, G); _mm512_storeu_si512(hash_pa + 7, H); - + /* Update pointers to data, local lengths and mask */ _mm512_storeu_si512(loc_data, _mm512_mask_add_epi64(_mm512_set1_epi64((long long)&zero_buffer), (__mmask8)mb_mask, _mm512_loadu_si512(loc_data), _mm512_set1_epi64(SM3_MSG_BLOCK_SIZE))); _mm512_storeu_si512(loc_data + 8, _mm512_mask_add_epi64(_mm512_set1_epi64((long long)&zero_buffer), *((__mmask8*)&mb_mask + 1), _mm512_loadu_si512(loc_data+8), _mm512_set1_epi64(SM3_MSG_BLOCK_SIZE))); diff --git a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_gctr_kernel_mb16.c b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_gctr_kernel_mb16.c index 84761678..f786b9a4 100644 --- a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_gctr_kernel_mb16.c +++ b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_gctr_kernel_mb16.c @@ -23,7 +23,7 @@ // Implementation is the same with SM4-CTR */ -__MBX_INLINE __m128i IncBlock128(__m128i x, int32u increment) { return _mm_add_epi32(x, _mm_maskz_loadu_epi32(1, &increment)); } +__INLINE __m128i IncBlock128(__m128i x, int32u increment) { return _mm_add_epi32(x, _mm_maskz_loadu_epi32(1, &increment)); } static void sm4_gctr_mask_kernel_mb16(__m512i *CTR, const __m512i *p_rk, diff --git a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_full_blocks_mb16.c b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_full_blocks_mb16.c index e35f6cc3..a5f3cfc2 100644 --- a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_full_blocks_mb16.c +++ b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_full_blocks_mb16.c @@ -17,7 +17,7 @@ #include #include -__MBX_INLINE void read_first(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], __mmask16 load_mask) +__INLINE void read_first(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], __mmask16 load_mask) { __mmask16 load_mask_0 = load_mask >> 0 * 4; __mmask16 load_mask_1 = load_mask >> 1 * 4; @@ -114,7 +114,7 @@ __MBX_INLINE void read_first(__m512i *data_blocks[4], const int8u *const pa_inpu /* End of explicitly unrolled loop */ } -__MBX_INLINE void read_next(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], int block_number, __mmask16 load_mask) +__INLINE void read_next(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], int block_number, __mmask16 load_mask) { __mmask16 load_mask_0 = load_mask >> 0 * 4; __mmask16 load_mask_1 = load_mask >> 1 * 4; diff --git a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_partial_blocks_mb16.c b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_partial_blocks_mb16.c index c225be1c..268acd32 100644 --- a/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_partial_blocks_mb16.c +++ b/sources/ippcp/crypto_mb/src/sm4/gcm/internal/sm4_gcm_update_ghash_partial_blocks_mb16.c @@ -17,7 +17,7 @@ #include #include -__MBX_INLINE void read_first(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], __m512i *input_len, __mmask16 load_mask) +__INLINE void read_first(__m512i *data_blocks[4], const int8u *const pa_input[SM4_LINES], __m512i *input_len, __mmask16 load_mask) { __mmask16 load_mask_0 = load_mask >> 0 * 4; __mmask16 load_mask_1 = load_mask >> 1 * 4; diff --git a/sources/ippcp/crypto_mb/src/sm4/sm4_ctr_mb16.c b/sources/ippcp/crypto_mb/src/sm4/sm4_ctr_mb16.c index 974fcd7f..80ceeaa7 100644 --- a/sources/ippcp/crypto_mb/src/sm4/sm4_ctr_mb16.c +++ b/sources/ippcp/crypto_mb/src/sm4/sm4_ctr_mb16.c @@ -142,7 +142,7 @@ static void sm4_ctr128_mask_kernel_mb16(__m512i* CTR, const __m512i* p_rk, __m51 } -__MBX_INLINE __m128i IncBlock128(__m128i x, int32u increment) +__INLINE __m128i IncBlock128(__m128i x, int32u increment) { __m128i t = _mm_add_epi64(x, _mm_maskz_loadu_epi32(1, &increment)); __mmask8 carryMask = _mm_cmplt_epu64_mask(t, x); diff --git a/sources/ippcp/crypto_mb/src/x25519/ifma_x25519.c b/sources/ippcp/crypto_mb/src/x25519/ifma_x25519.c index 7364e7c4..d11d9dc5 100644 --- a/sources/ippcp/crypto_mb/src/x25519/ifma_x25519.c +++ b/sources/ippcp/crypto_mb/src/x25519/ifma_x25519.c @@ -54,7 +54,7 @@ __ALIGN64 static const int64u MOD_2_260_[8] = {19*32, 19*32, 19*32, 19*32, //////////////////////////////////////////////////////////// -__MBX_INLINE void ed25519_mul(U64 out[], const U64 a[], const U64 b[]) { +__INLINE void ed25519_mul(U64 out[], const U64 a[], const U64 b[]) { U64 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; U64 *va = (U64*) a; @@ -83,7 +83,7 @@ __MBX_INLINE void ed25519_mul(U64 out[], const U64 a[], const U64 b[]) { ROUND_MUL(2, 4, r6, r7) ROUND_MUL(3, 3, r6, r7) ROUND_MUL(4, 2, r6, r7) - + ROUND_MUL(0, 0, r0, r1) ROUND_MUL(0, 1, r1, r2) ROUND_MUL(0, 2, r2, r3) @@ -116,18 +116,18 @@ __MBX_INLINE void ed25519_mul(U64 out[], const U64 a[], const U64 b[]) { } /* SQR -c=0 (0,0) -c=1 (0,1) -c=2 (0,2) (1,1) -c=3 (0,3) (1,2) -c=4 (0,4) (1,3) (2,2) -c=5 (1,4) (2,3) -c=6 (2,4) (3,3) -c=7 (3,4) +c=0 (0,0) +c=1 (0,1) +c=2 (0,2) (1,1) +c=3 (0,3) (1,2) +c=4 (0,4) (1,3) (2,2) +c=5 (1,4) (2,3) +c=6 (2,4) (3,3) +c=7 (3,4) c=8 (4,4) */ -__MBX_INLINE void ed25519_sqr(U64 out[], const U64 a[]) { +__INLINE void ed25519_sqr(U64 out[], const U64 a[]) { U64 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; U64 *va = (U64*) a; @@ -299,7 +299,7 @@ static const int64u VMASK52[8] = {MASK52, MASK52, MASK52, MASK52, R##0 = fma52lo(R##0, srli64(R##4, 47), MOD_2_255); \ R##4 = and64(R##4, loadu64(VMASK_R4)); -__MBX_INLINE void ed25519_mul_dual(U64 out0[], U64 out1[], +__INLINE void ed25519_mul_dual(U64 out0[], U64 out1[], const U64 a0[], const U64 b0[], const U64 a1[], const U64 b1[]) { @@ -406,7 +406,7 @@ __MBX_INLINE void ed25519_mul_dual(U64 out0[], U64 out1[], storeu64(&vr1[4], r14); } -__MBX_INLINE void ed25519_sqr_dual(U64 out0[], U64 out1[], +__INLINE void ed25519_sqr_dual(U64 out0[], U64 out1[], const U64 a0[], const U64 a1[]) { U64 r00, r01, r02, r03, r04, r05, r06, r07, r08, r09; @@ -514,7 +514,7 @@ __MBX_INLINE void ed25519_sqr_dual(U64 out0[], U64 out1[], ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -__MBX_INLINE void fe52mb8_set(U64 out[], int64u value) +__INLINE void fe52mb8_set(U64 out[], int64u value) { storeu64(&out[0], set64((long long)value)); storeu64(&out[1], get_zero64()); @@ -522,7 +522,7 @@ __MBX_INLINE void fe52mb8_set(U64 out[], int64u value) storeu64(&out[3], get_zero64()); storeu64(&out[4], get_zero64()); } -__MBX_INLINE void fe52mb8_copy(U64 out[], const U64 in[]) +__INLINE void fe52mb8_copy(U64 out[], const U64 in[]) { storeu64(&out[0], loadu64(&in[0])); storeu64(&out[1], loadu64(&in[1])); @@ -533,7 +533,7 @@ __MBX_INLINE void fe52mb8_copy(U64 out[], const U64 in[]) // Clang warning -Wunused-function #if(0) -__MBX_INLINE void fe52mb8_mul_mod25519(U64 vr[], const U64 va[], const U64 vb[]) +__INLINE void fe52mb8_mul_mod25519(U64 vr[], const U64 va[], const U64 vb[]) { U64 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = get_zero64(); @@ -558,7 +558,7 @@ __MBX_INLINE void fe52mb8_mul_mod25519(U64 vr[], const U64 va[], const U64 vb[]) ROUND_MUL(2, 4, r6, r7) ROUND_MUL(3, 3, r6, r7) ROUND_MUL(4, 2, r6, r7) - + ROUND_MUL(0, 0, r0, r1) ROUND_MUL(0, 1, r1, r2) ROUND_MUL(0, 2, r2, r3) @@ -594,13 +594,13 @@ __MBX_INLINE void fe52mb8_mul_mod25519(U64 vr[], const U64 va[], const U64 vb[]) storeu64(&vr[4], r4); } -__MBX_INLINE void fe52mb8_sqr_mod25519(U64 out[], const U64 a[]) +__INLINE void fe52mb8_sqr_mod25519(U64 out[], const U64 a[]) { fe52mb8_mul_mod25519(out, a, a); } #endif -__MBX_INLINE void fe52mb8_mul121666_mod25519(U64 vr[], const U64 va[]) +__INLINE void fe52mb8_mul121666_mod25519(U64 vr[], const U64 va[]) { U64 multiplier = set64(121666); @@ -647,20 +647,20 @@ __MBX_INLINE void fe52mb8_mul121666_mod25519(U64 vr[], const U64 va[]) // __ALIGN64 static const int64u prime25519[5] = { // PRIME25519_LO, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_HI}; -__ALIGN64 static const int64u VPRIME25519_LO[8] = - { PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, +__ALIGN64 static const int64u VPRIME25519_LO[8] = + { PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO, PRIME25519_LO }; -__ALIGN64 static const int64u VPRIME25519_MID[8] = - { PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, +__ALIGN64 static const int64u VPRIME25519_MID[8] = + { PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID, PRIME25519_MID }; -__ALIGN64 static const int64u VPRIME25519_HI[8] = - { PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, +__ALIGN64 static const int64u VPRIME25519_HI[8] = + { PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI, PRIME25519_HI }; -__MBX_INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) +__INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) { return mask_mov64 (a, kmask, b); } #define NORM_ASHIFTR(R, I, J) \ @@ -671,7 +671,7 @@ __MBX_INLINE U64 cmov_U64(U64 a, U64 b, __mb_mask kmask) R##J = add64(R##J, srli64(R##I, DIGIT_SIZE)); \ R##I = and64(R##I, loadu64(VMASK52)); -__MBX_INLINE void fe52mb8_add_mod25519(U64 vr[], const U64 va[], const U64 vb[]) +__INLINE void fe52mb8_add_mod25519(U64 vr[], const U64 va[], const U64 vb[]) { /* r = a+b */ U64 r0 = add64(va[0], vb[0]); @@ -709,7 +709,7 @@ __MBX_INLINE void fe52mb8_add_mod25519(U64 vr[], const U64 va[], const U64 vb[]) storeu64(&vr[4], cmov_U64(t4, r4, cmask)); } -__MBX_INLINE void fe52mb8_sub_mod25519(U64 vr[], const U64 va[], const U64 vb[]) +__INLINE void fe52mb8_sub_mod25519(U64 vr[], const U64 va[], const U64 vb[]) { /* r = a-b */ U64 r0 = sub64(va[0], vb[0]); @@ -747,7 +747,7 @@ __MBX_INLINE void fe52mb8_sub_mod25519(U64 vr[], const U64 va[], const U64 vb[]) storeu64(&vr[4], cmov_U64(r4, t4, cmask)); } -__MBX_INLINE void fe52mb8_red_p25519(U64 vr[], const U64 va[]) +__INLINE void fe52mb8_red_p25519(U64 vr[], const U64 va[]) { /* r = a-p */ U64 r0 = sub64(va[0], loadu64(VPRIME25519_LO)); @@ -788,7 +788,7 @@ __MBX_INLINE void fe52mb8_red_p25519(U64 vr[], const U64 va[]) considering the exponent as 2^255 - 21 = (2^5) * (2^250 - 1) + 11. */ -__MBX_INLINE void fe52mb8_inv_mod25519(U64 out[], const U64 z[]) +__INLINE void fe52mb8_inv_mod25519(U64 out[], const U64 z[]) { __ALIGN64 U64 t0[5]; __ALIGN64 U64 t1[5]; @@ -906,7 +906,7 @@ static void x25519_scalar_mul(U64 out[], U64 scalar[], U64 point[]) swap = b; fe52_sub(tmp0, x3, z3); fe52_sub(tmp1, x2, z2); - fe52_add(x2, x2, z2); + fe52_add(x2, x2, z2); fe52_add(z2, x3, z3); #ifdef USE_DUAL_MUL_SQR @@ -951,7 +951,7 @@ static void x25519_scalar_mul(U64 out[], U64 scalar[], U64 point[]) ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// -__MBX_INLINE void ed25519_mul_dual_wonorm(U64 out0[], U64 out1[], +__INLINE void ed25519_mul_dual_wonorm(U64 out0[], U64 out1[], const U64 a0[], const U64 b0[], const U64 a1[], const U64 b1[]) { @@ -1047,7 +1047,7 @@ __MBX_INLINE void ed25519_mul_dual_wonorm(U64 out0[], U64 out1[], storeu64(&vr1[4], r14); } -__MBX_INLINE void fe52mb8_mul_mod25519_wonorm(U64 vr[], const U64 va[], const U64 vb[]) +__INLINE void fe52mb8_mul_mod25519_wonorm(U64 vr[], const U64 va[], const U64 vb[]) { U64 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; r0 = r1 = r2 = r3 = r4 = r5 = r6 = r7 = r8 = r9 = get_zero64(); @@ -1072,7 +1072,7 @@ __MBX_INLINE void fe52mb8_mul_mod25519_wonorm(U64 vr[], const U64 va[], const U6 ROUND_MUL(2, 4, r6, r7) ROUND_MUL(3, 3, r6, r7) ROUND_MUL(4, 2, r6, r7) - + ROUND_MUL(0, 0, r0, r1) ROUND_MUL(0, 1, r1, r2) ROUND_MUL(0, 2, r2, r3) @@ -1102,7 +1102,7 @@ __MBX_INLINE void fe52mb8_mul_mod25519_wonorm(U64 vr[], const U64 va[], const U6 storeu64(&vr[4], r4); } -__MBX_INLINE void fe52mb8_mul121666_mod25519_wonorm(U64 vr[], const U64 va[]) +__INLINE void fe52mb8_mul121666_mod25519_wonorm(U64 vr[], const U64 va[]) { U64 multiplier = set64(121666); @@ -1136,7 +1136,7 @@ __MBX_INLINE void fe52mb8_mul121666_mod25519_wonorm(U64 vr[], const U64 va[]) storeu64(&vr[4], r4); } -__MBX_INLINE void x25519_scalar_mul_dual(U64 out[], U64 scalar[], U64 point[]) +__INLINE void x25519_scalar_mul_dual(U64 out[], U64 scalar[], U64 point[]) { __ALIGN64 U64 x1[5], x2[5], x3[5]; __ALIGN64 U64 z2[5], z3[5]; @@ -1180,7 +1180,7 @@ __MBX_INLINE void x25519_scalar_mul_dual(U64 out[], U64 scalar[], U64 point[]) fe52_sub(tmp0, x3, z3); fe52_sub(tmp1, x2, z2); - fe52_add(x2, x2, z2); + fe52_add(x2, x2, z2); fe52_add(z2, x3, z3); ed25519_mul_dual_wonorm(z3, z2, x2,tmp0, z2,tmp1); @@ -1575,19 +1575,19 @@ __ALIGN64 static int64u muTBL52[255][NUMBER_OF_DIGITS(256,DIGIT_SIZE)] = { {0x000deda7f334d2df, 0x00051af2a57b4a6a, 0x0006dceaa87bde9c, 0x000d07ba98fc64f8, 0x00006bbe0335c20e}, }; -__ALIGN64 static const int64u U2_0[8] = +__ALIGN64 static const int64u U2_0[8] = {0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290, 0x000b1e0137d48290}; -__ALIGN64 static const int64u U2_1[8] = +__ALIGN64 static const int64u U2_1[8] = {0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816, 0x00051eb4d1207816}; -__ALIGN64 static const int64u U2_2[8] = +__ALIGN64 static const int64u U2_2[8] = {0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a, 0x000ca2b71d440f6a}; -__ALIGN64 static const int64u U2_3[8] = +__ALIGN64 static const int64u U2_3[8] = {0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d, 0x00054cb52385f46d}; -__ALIGN64 static const int64u U2_4[8] = +__ALIGN64 static const int64u U2_4[8] = {0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83, 0x0000215132111d83}; diff --git a/sources/ippcp/ecnist/ifma_arith_n256.c b/sources/ippcp/ecnist/ifma_arith_n256.c index b17fa5a4..b08628b0 100644 --- a/sources/ippcp/ecnist/ifma_arith_n256.c +++ b/sources/ippcp/ecnist/ifma_arith_n256.c @@ -182,7 +182,7 @@ IPP_OWN_DEFN(m512, ifma_frommont52_n256, (const m512 a)) * note: z in in Montgomery domain * r in Montgomery domain */ -__IPPCP_INLINE m512 ifma_ams52_n256_ntimes(const m512 a, int n) +__INLINE m512 ifma_ams52_n256_ntimes(const m512 a, int n) { m512 r = a; for (; n > 0; --n) { diff --git a/sources/ippcp/ecnist/ifma_arith_n384.c b/sources/ippcp/ecnist/ifma_arith_n384.c index 3e987e73..9ecb3aaf 100644 --- a/sources/ippcp/ecnist/ifma_arith_n384.c +++ b/sources/ippcp/ecnist/ifma_arith_n384.c @@ -196,7 +196,7 @@ IPP_OWN_DEFN(m512, ifma_frommont52_n384, (const m512 a)) * note: z in in Montgomery domain * r in Montgomery domain */ -__IPPCP_INLINE m512 ifma_ams52_n384_ntimes(const m512 a, int n) +__INLINE m512 ifma_ams52_n384_ntimes(const m512 a, int n) { m512 r = a; for (; n > 0; --n) { diff --git a/sources/ippcp/ecnist/ifma_arith_n521.c b/sources/ippcp/ecnist/ifma_arith_n521.c index b16a322b..37a5fa81 100644 --- a/sources/ippcp/ecnist/ifma_arith_n521.c +++ b/sources/ippcp/ecnist/ifma_arith_n521.c @@ -238,7 +238,7 @@ static void ifma_ams52_n521(fe521 pr[], const fe521 a) #define sqr(R, A) ifma_ams52_n521(&(R), (A)) /* r = base^(2^n) */ -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_ntimes, (fe521 pr[], const fe521 a, int n)) +__INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_ntimes, (fe521 pr[], const fe521 a, int n)) { fe521 r; FE521_COPY(r, a); diff --git a/sources/ippcp/ecnist/ifma_arith_p256.c b/sources/ippcp/ecnist/ifma_arith_p256.c index b0b74fcd..f3e4909c 100644 --- a/sources/ippcp/ecnist/ifma_arith_p256.c +++ b/sources/ippcp/ecnist/ifma_arith_p256.c @@ -171,14 +171,14 @@ IPP_OWN_DEFN(void, ifma_amm52_dual_p256, (m512 * r1, const m512 a1, const m512 b } /* R = (A*B) with norm */ -__IPPCP_INLINE m512 ifma_amm52_p256_norm(const m512 a, const m512 b) +__INLINE m512 ifma_amm52_p256_norm(const m512 a, const m512 b) { m512 r = ifma_amm52_p256(a, b); return ifma_lnorm52(r); } /* R = (A*A) with norm */ -__IPPCP_INLINE m512 ifma_ams52_p256_norm(const m512 a) +__INLINE m512 ifma_ams52_p256_norm(const m512 a) { return ifma_amm52_p256_norm(a, a); } @@ -263,7 +263,7 @@ IPP_OWN_DEFN(m512, ifma_frommont52_p256, (const m512 a)) #define sqr(R, A) (R) = ifma_ams52_p256_norm((A)) #define mul(R, A, B) (R) = ifma_amm52_p256_norm((A), (B)); -__IPPCP_INLINE m512 ifma_ams52_p256_ntimes(m512 a, Ipp32s n) +__INLINE m512 ifma_ams52_p256_ntimes(m512 a, Ipp32s n) { for (; n > 0; --n) sqr(a, a); diff --git a/sources/ippcp/ecnist/ifma_arith_p256.h b/sources/ippcp/ecnist/ifma_arith_p256.h index 3a9f47c7..dedcdf16 100644 --- a/sources/ippcp/ecnist/ifma_arith_p256.h +++ b/sources/ippcp/ecnist/ifma_arith_p256.h @@ -63,7 +63,7 @@ IPP_OWN_DECL(void, ifma_amm52_dual_p256, (m512 *r1, const m512 a1, const m512 b1 * * \param[in] a value (in radix 2^52) */ -__IPPCP_INLINE IPP_OWN_DEFN(m512, ifma_ams52_p256, (const m512 a)) +__INLINE IPP_OWN_DEFN(m512, ifma_ams52_p256, (const m512 a)) { return ifma_amm52_p256(a, a); } @@ -78,7 +78,7 @@ __IPPCP_INLINE IPP_OWN_DEFN(m512, ifma_ams52_p256, (const m512 a)) * \param[out] r2 * \param[in] a2 value (in radix 2^52) */ -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_dual_p256, (m512 * r1, const m512 a1, m512 *r2, const m512 a2)) +__INLINE IPP_OWN_DEFN(void, ifma_ams52_dual_p256, (m512 * r1, const m512 a1, m512 *r2, const m512 a2)) { ifma_amm52_dual_p256(r1, a1, a1, r2, a2, a2); return; diff --git a/sources/ippcp/ecnist/ifma_arith_p384.c b/sources/ippcp/ecnist/ifma_arith_p384.c index 764259af..c9fbec94 100644 --- a/sources/ippcp/ecnist/ifma_arith_p384.c +++ b/sources/ippcp/ecnist/ifma_arith_p384.c @@ -242,7 +242,7 @@ IPP_OWN_DEFN(void, ifma_amm52_dual_p384, (m512 * pr1, const m512 a1, const m512 } /* R = (A*B) with norm */ -__IPPCP_INLINE m512 ifma_amm52_p384_norm(const m512 a, const m512 b) +__INLINE m512 ifma_amm52_p384_norm(const m512 a, const m512 b) { m512 r = ifma_amm52_p384(a, b); /* normalization */ @@ -250,7 +250,7 @@ __IPPCP_INLINE m512 ifma_amm52_p384_norm(const m512 a, const m512 b) } /* R = (A*A) with norm */ -__IPPCP_INLINE m512 m512_sqr_norm(const m512 a) +__INLINE m512 m512_sqr_norm(const m512 a) { return ifma_amm52_p384_norm(a, a); } @@ -297,7 +297,7 @@ IPP_OWN_DEFN(m512, ifma_frommont52_p384, (const m512 a)) ifma_amm52_dual_p384(&(R1), (A1), (B1), &(R2), (A2), (B2)); \ ifma_lnorm52_dual(&(R1), (R1), &(R2), (R2)) -__IPPCP_INLINE m512 ifma_ams52_p384_ntimes(const m512 a, Ipp32s n) +__INLINE m512 ifma_ams52_p384_ntimes(const m512 a, Ipp32s n) { m512 r = a; for (; n > 0; --n) diff --git a/sources/ippcp/ecnist/ifma_arith_p384.h b/sources/ippcp/ecnist/ifma_arith_p384.h index 6363dd7d..487665e5 100644 --- a/sources/ippcp/ecnist/ifma_arith_p384.h +++ b/sources/ippcp/ecnist/ifma_arith_p384.h @@ -63,7 +63,7 @@ IPP_OWN_DECL(void, ifma_amm52_dual_p384, (m512 * r1, const m512 a1, const m512 b * * \param[in] a value (in radix 2^52) */ -__IPPCP_INLINE IPP_OWN_DEFN(m512, ifma_ams52_p384, (const m512 a)) +__INLINE IPP_OWN_DEFN(m512, ifma_ams52_p384, (const m512 a)) { return ifma_amm52_p384(a, a); } @@ -78,7 +78,7 @@ __IPPCP_INLINE IPP_OWN_DEFN(m512, ifma_ams52_p384, (const m512 a)) * \param[out] r2 * \param[in] a2 value (in radix 2^52) */ -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_dual_p384, (m512 * r1, const m512 a1, m512 *r2, const m512 a2)) +__INLINE IPP_OWN_DEFN(void, ifma_ams52_dual_p384, (m512 * r1, const m512 a1, m512 *r2, const m512 a2)) { ifma_amm52_dual_p384(r1, a1, a1, r2, a2, a2); return; diff --git a/sources/ippcp/ecnist/ifma_arith_p521.c b/sources/ippcp/ecnist/ifma_arith_p521.c index a2de5ecb..e284ff25 100644 --- a/sources/ippcp/ecnist/ifma_arith_p521.c +++ b/sources/ippcp/ecnist/ifma_arith_p521.c @@ -940,14 +940,14 @@ IPP_OWN_DEFN(void, ifma_frommont52_p521, (fe521 pr[], const fe521 a)) return; } -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_amm52_p521_norm, (fe521 pr[], const fe521 a, const fe521 b)) +__INLINE IPP_OWN_DEFN(void, ifma_amm52_p521_norm, (fe521 pr[], const fe521 a, const fe521 b)) { ifma_amm52_p521(pr, a, b); ifma_lnorm52_p521(pr, *pr); return; } -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_norm, (fe521 pr[], const fe521 a)) +__INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_norm, (fe521 pr[], const fe521 a)) { ifma_ams52_p521(pr, a); ifma_lnorm52_p521(pr, *pr); @@ -961,7 +961,7 @@ __IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_norm, (fe521 pr[], const fe521 ifma_lnorm52_dual_p521(&(R1), (R1), &(R2), (R2)) /* r = base^(2^n) */ -__IPPCP_INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_ntimes, (fe521 pr[], const fe521 a, int n)) +__INLINE IPP_OWN_DEFN(void, ifma_ams52_p521_ntimes, (fe521 pr[], const fe521 a, int n)) { fe521 r; FE521_COPY(r, a); diff --git a/sources/ippcp/ecnist/ifma_defs.h b/sources/ippcp/ecnist/ifma_defs.h index 73ec9c99..ad36a599 100644 --- a/sources/ippcp/ecnist/ifma_defs.h +++ b/sources/ippcp/ecnist/ifma_defs.h @@ -45,7 +45,7 @@ * \return 0xFF - if MSB = 1 * \return 0x00 - if MSB = 0 */ -__IPPCP_INLINE mask8 check_bit(const mask8 a, int bit) +__INLINE mask8 check_bit(const mask8 a, int bit) { return (mask8)((mask8)0 - ((a >> bit) & 1u)); } @@ -59,7 +59,7 @@ __IPPCP_INLINE mask8 check_bit(const mask8 a, int bit) * \return 0xFF - if input value is all zeroes * \return 0x00 - if input value is not all zeroes */ -__IPPCP_INLINE mask8 is_zero_i64(const m512 a) +__INLINE mask8 is_zero_i64(const m512 a) { const mask8 mask = cmp_i64_mask(a, setzero_i64(), _MM_CMPINT_NE); return check_bit((~mask & (mask - 1u)), 7); diff --git a/sources/ippcp/ecnist/ifma_defs_p521.h b/sources/ippcp/ecnist/ifma_defs_p521.h index ad060e2d..fb5a843e 100644 --- a/sources/ippcp/ecnist/ifma_defs_p521.h +++ b/sources/ippcp/ecnist/ifma_defs_p521.h @@ -61,12 +61,12 @@ static const __ALIGN64 Ipp64u P521R1_ONE52[P521R1_NUM_CHUNK][P521R1_LENFE521_52] FE521_MID(R) = m256_loadu_i64(FE521_MID(A)); \ FE521_HI(R) = m256_loadu_i64(FE521_HI(A)) -__IPPCP_INLINE mask8 is_msb_m256(const mask8 a) +__INLINE mask8 is_msb_m256(const mask8 a) { return ((mask8)0 - (a >> 7)); } -__IPPCP_INLINE mask8 is_zero_m256(const m256i a) +__INLINE mask8 is_zero_m256(const m256i a) { const mask8 mask = _mm256_cmp_epi64_mask(a, m256_setzero_i64(), _MM_CMPINT_NE); return is_msb_m256((~mask & (mask - 1))); diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p256.c b/sources/ippcp/ecnist/ifma_ecpoint_p256.c index 5bd98811..6d836413 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p256.c +++ b/sources/ippcp/ecnist/ifma_ecpoint_p256.c @@ -510,7 +510,7 @@ static __NOINLINE void clear_secret_context(Ipp16u *wval, #define WIN_SIZE (5) -__IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) +__INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) { const Ipp32s eq = a ^ b; const Ipp32s v = ~eq & (eq - 1); @@ -518,7 +518,7 @@ __IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) return (mask8)(0 - msb); } -__IPPCP_INLINE void extract_table_point(P256_POINT_IFMA *r, const Ipp32s digit, const P256_POINT_IFMA *tbl) +__INLINE void extract_table_point(P256_POINT_IFMA *r, const Ipp32s digit, const P256_POINT_IFMA *tbl) { Ipp32s idx = digit - 1; @@ -659,7 +659,7 @@ IPP_OWN_DEFN(void, ifma_ec_nistp256_mul_point, (P256_POINT_IFMA * r, const P256_ #define BP_WIN_SIZE BASE_POINT_WIN_SIZE #define BP_N_ENTRY BASE_POINT_N_ENTRY -__IPPCP_INLINE void extract_point_affine(P256_POINT_AFFINE_IFMA *r, +__INLINE void extract_point_affine(P256_POINT_AFFINE_IFMA *r, const P256_POINT_AFFINE_IFMA_MEM *tbl, const Ipp32s digit) { diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p256.h b/sources/ippcp/ecnist/ifma_ecpoint_p256.h index 269bda6a..c6acb52b 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p256.h +++ b/sources/ippcp/ecnist/ifma_ecpoint_p256.h @@ -138,7 +138,7 @@ IPP_OWN_DECL(void, p256r1_select_ap_w7_ifma, (BNU_CHUNK_T * pAffinePoint, const #include "pcpgfpstuff.h" #include "pcpgfpecstuff.h" -__IPPCP_INLINE void recode_point_to_mont52(P256_POINT_IFMA *pR, +__INLINE void recode_point_to_mont52(P256_POINT_IFMA *pR, const BNU_CHUNK_T *pP, BNU_CHUNK_T *pPool, ifmaArithMethod *method, @@ -166,7 +166,7 @@ __IPPCP_INLINE void recode_point_to_mont52(P256_POINT_IFMA *pR, pR->z = p_to_mont(pR->z); } -__IPPCP_INLINE void recode_point_to_mont64(IppsGFpECPoint *pR, +__INLINE void recode_point_to_mont64(IppsGFpECPoint *pR, P256_POINT_IFMA *pP, BNU_CHUNK_T *pPool, ifmaArithMethod *method, diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p384.c b/sources/ippcp/ecnist/ifma_ecpoint_p384.c index ed368f62..449adcd3 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p384.c +++ b/sources/ippcp/ecnist/ifma_ecpoint_p384.c @@ -546,7 +546,7 @@ static __NOINLINE void clear_secret_context(Ipp16u *wval, #define WIN_SIZE (5) -__IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) +__INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) { const Ipp32s eq = a ^ b; const Ipp32s v = ~eq & (eq - 1); @@ -554,7 +554,7 @@ __IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) return (mask8)(0 - msb); } -__IPPCP_INLINE void extract_table_point(P384_POINT_IFMA *r, const Ipp32s digit, const P384_POINT_IFMA *tbl) +__INLINE void extract_table_point(P384_POINT_IFMA *r, const Ipp32s digit, const P384_POINT_IFMA *tbl) { Ipp32s idx = digit - 1; @@ -691,7 +691,7 @@ IPP_OWN_DEFN(void, ifma_ec_nistp384_mul_point, (P384_POINT_IFMA * r, const P384_ #define BP_WIN_SIZE BASE_POINT_WIN_SIZE #define BP_N_ENTRY BASE_POINT_N_ENTRY -__IPPCP_INLINE void extract_point_affine(P384_POINT_AFFINE_IFMA *r, +__INLINE void extract_point_affine(P384_POINT_AFFINE_IFMA *r, const P384_POINT_AFFINE_IFMA_MEM *tbl, const Ipp32s digit) { diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p384.h b/sources/ippcp/ecnist/ifma_ecpoint_p384.h index a33a8bd6..e682808b 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p384.h +++ b/sources/ippcp/ecnist/ifma_ecpoint_p384.h @@ -138,7 +138,7 @@ IPP_OWN_DECL(void, p384r1_select_ap_w4_ifma, (BNU_CHUNK_T * pAffinePoint, const #include "pcpgfpstuff.h" #include "pcpgfpecstuff.h" -__IPPCP_INLINE void recode_point_to_mont52(P384_POINT_IFMA *pR, +__INLINE void recode_point_to_mont52(P384_POINT_IFMA *pR, const BNU_CHUNK_T *pP, BNU_CHUNK_T *pPool, ifmaArithMethod *method, @@ -166,7 +166,7 @@ __IPPCP_INLINE void recode_point_to_mont52(P384_POINT_IFMA *pR, pR->z = p_to_mont(pR->z); } -__IPPCP_INLINE void recode_point_to_mont64(const IppsGFpECPoint *pR, +__INLINE void recode_point_to_mont64(const IppsGFpECPoint *pR, P384_POINT_IFMA *pP, BNU_CHUNK_T *pPool, ifmaArithMethod *method, diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p521.c b/sources/ippcp/ecnist/ifma_ecpoint_p521.c index 51a7542e..9aac2e10 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p521.c +++ b/sources/ippcp/ecnist/ifma_ecpoint_p521.c @@ -519,7 +519,7 @@ static __NOINLINE void clear_secret_context(Ipp16u *wval, #define WIN_SIZE (5) -__IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) +__INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) { const Ipp32s eq = a ^ b; const Ipp32s v = ~eq & (eq - 1); @@ -527,7 +527,7 @@ __IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) return (mask8)(0 - msb); } -__IPPCP_INLINE void extract_table_point(P521_POINT_IFMA *r, const Ipp32s digit, const P521_POINT_IFMA tbl[]) +__INLINE void extract_table_point(P521_POINT_IFMA *r, const Ipp32s digit, const P521_POINT_IFMA tbl[]) { Ipp32s idx = digit - 1; @@ -664,7 +664,7 @@ IPP_OWN_DEFN(void, ifma_ec_nistp521_mul_point, (P521_POINT_IFMA * r, const P521_ #define BP_WIN_SIZE BASE_POINT_WIN_SIZE #define BP_N_ENTRY BASE_POINT_N_ENTRY -__IPPCP_INLINE void extract_point_affine(P521_POINT_AFFINE_IFMA *r, +__INLINE void extract_point_affine(P521_POINT_AFFINE_IFMA *r, const P521_POINT_AFFINE_IFMA_MEM *tbl, const Ipp32s digit) { diff --git a/sources/ippcp/ecnist/ifma_ecpoint_p521.h b/sources/ippcp/ecnist/ifma_ecpoint_p521.h index f4575028..4930e868 100644 --- a/sources/ippcp/ecnist/ifma_ecpoint_p521.h +++ b/sources/ippcp/ecnist/ifma_ecpoint_p521.h @@ -100,7 +100,7 @@ IPP_OWN_DECL(void, ifma_ec_nistp521_add_point_affine, (P521_POINT_IFMA * r, cons #include "pcpgfpstuff.h" #include "pcpgfpecstuff.h" -__IPPCP_INLINE void recode_point_to_mont52(P521_POINT_IFMA *pR, +__INLINE void recode_point_to_mont52(P521_POINT_IFMA *pR, const BNU_CHUNK_T *pP, BNU_CHUNK_T *pPool, ifmaArithMethod_p521 *method, @@ -128,7 +128,7 @@ __IPPCP_INLINE void recode_point_to_mont52(P521_POINT_IFMA *pR, p_to_mont(&(pR->z), pR->z); } -__IPPCP_INLINE void recode_point_to_mont64(IppsGFpECPoint *pR, +__INLINE void recode_point_to_mont64(IppsGFpECPoint *pR, P521_POINT_IFMA *pP, BNU_CHUNK_T *pPool, ifmaArithMethod_p521 *method, diff --git a/sources/ippcp/gsmod_montinv.c b/sources/ippcp/gsmod_montinv.c index 19fe91bf..3c989807 100644 --- a/sources/ippcp/gsmod_montinv.c +++ b/sources/ippcp/gsmod_montinv.c @@ -14,11 +14,11 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. Modular Arithmetic Engine. General Functionality -// +// // Contents: // gs_mont_inv() // @@ -31,7 +31,7 @@ #include "gsmodstuff.h" #include "pcpmask_ct.h" -__IPPCP_INLINE BNU_CHUNK_T* cpPow2_ct(int bit, BNU_CHUNK_T* dst, int len) +__INLINE BNU_CHUNK_T* cpPow2_ct(int bit, BNU_CHUNK_T* dst, int len) { int slot = bit/BNU_CHUNK_BITS; BNU_CHUNK_T value = (BNU_CHUNK_T)1 << (bit%BNU_CHUNK_BITS); diff --git a/sources/ippcp/gsmodmethod.h b/sources/ippcp/gsmodmethod.h index e84b0526..d9462215 100644 --- a/sources/ippcp/gsmodmethod.h +++ b/sources/ippcp/gsmodmethod.h @@ -54,17 +54,17 @@ typedef struct _gsModMethod { /* These functions should not be used, because they have non-constant execution time, see their safe analogues in pcpmask_ct.h */ #if 0 -__IPPCP_INLINE BNU_CHUNK_T cpIsZero(BNU_CHUNK_T x) +__INLINE BNU_CHUNK_T cpIsZero(BNU_CHUNK_T x) { return x==0; } -__IPPCP_INLINE BNU_CHUNK_T cpIsNonZero(BNU_CHUNK_T x) +__INLINE BNU_CHUNK_T cpIsNonZero(BNU_CHUNK_T x) { return x!=0; } -__IPPCP_INLINE BNU_CHUNK_T cpIsOdd(BNU_CHUNK_T x) +__INLINE BNU_CHUNK_T cpIsOdd(BNU_CHUNK_T x) { return x&1; } -__IPPCP_INLINE BNU_CHUNK_T cpIsEven(BNU_CHUNK_T x) +__INLINE BNU_CHUNK_T cpIsEven(BNU_CHUNK_T x) { return 1-cpIsOdd(x); } /* dst[] = (flag)? src[] : dst[] */ -__IPPCP_INLINE void cpMaskMove_gs(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, int len, BNU_CHUNK_T moveFlag) +__INLINE void cpMaskMove_gs(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, int len, BNU_CHUNK_T moveFlag) { BNU_CHUNK_T srcMask = 0-cpIsNonZero(moveFlag); BNU_CHUNK_T dstMask = ~srcMask; diff --git a/sources/ippcp/gsmodstuff.h b/sources/ippcp/gsmodstuff.h index bd17d129..25de7105 100644 --- a/sources/ippcp/gsmodstuff.h +++ b/sources/ippcp/gsmodstuff.h @@ -101,7 +101,7 @@ typedef struct _gsModEngine // poolReq Required pool *F*/ -__IPPCP_INLINE BNU_CHUNK_T* gsModPoolAlloc(gsModEngine* pME, int poolReq) +__INLINE BNU_CHUNK_T* gsModPoolAlloc(gsModEngine* pME, int poolReq) { BNU_CHUNK_T* pPool = MOD_BUFFER(pME, pME->poolLenUsed); @@ -126,7 +126,7 @@ __IPPCP_INLINE BNU_CHUNK_T* gsModPoolAlloc(gsModEngine* pME, int poolReq) // poolReq Required pool *F*/ -__IPPCP_INLINE void gsModPoolFree(gsModEngine* pME, int poolReq) +__INLINE void gsModPoolFree(gsModEngine* pME, int poolReq) { if(pME->poolLenUsed < poolReq) poolReq = pME->poolLenUsed; diff --git a/sources/ippcp/ifma_exp52x20.c b/sources/ippcp/ifma_exp52x20.c index 2f186235..9ad9f37c 100644 --- a/sources/ippcp/ifma_exp52x20.c +++ b/sources/ippcp/ifma_exp52x20.c @@ -34,7 +34,7 @@ #define AMM ifma256_amm52x20 #define AMS ifma256_ams52x20 -__IPPCP_INLINE void extract_multiplier(Ipp64u *red_Y, +__INLINE void extract_multiplier(Ipp64u *red_Y, const Ipp64u red_table[1U << EXP_WIN_SIZE][LEN52], int red_table_idx) { diff --git a/sources/ippcp/ifma_exp52x20_dual.c b/sources/ippcp/ifma_exp52x20_dual.c index fc69cd54..f6e5604a 100644 --- a/sources/ippcp/ifma_exp52x20_dual.c +++ b/sources/ippcp/ifma_exp52x20_dual.c @@ -34,7 +34,7 @@ #define DAMM ifma256_amm52x20_dual #define DAMS ifma256_ams52x20_dual -__IPPCP_INLINE void extract_multiplier_n(Ipp64u *red_Y, +__INLINE void extract_multiplier_n(Ipp64u *red_Y, const Ipp64u red_table[1U << EXP_WIN_SIZE][2][LEN52], int red_table_idx, int tbl_idx) { diff --git a/sources/ippcp/ifma_exp52x30_dual.c b/sources/ippcp/ifma_exp52x30_dual.c index ed432581..73b42356 100644 --- a/sources/ippcp/ifma_exp52x30_dual.c +++ b/sources/ippcp/ifma_exp52x30_dual.c @@ -34,7 +34,7 @@ #define DAMM ifma256_amm52x30_dual #define DAMS ifma256_ams52x30_dual -__IPPCP_INLINE void extract_multiplier_n(Ipp64u *red_Y, +__INLINE void extract_multiplier_n(Ipp64u *red_Y, const Ipp64u red_table[1U << EXP_WIN_SIZE][2][LEN52], int red_table_idx, int tbl_idx) { diff --git a/sources/ippcp/ifma_exp52x40_dual.c b/sources/ippcp/ifma_exp52x40_dual.c index 2bf17ed9..a9da4bc0 100644 --- a/sources/ippcp/ifma_exp52x40_dual.c +++ b/sources/ippcp/ifma_exp52x40_dual.c @@ -34,7 +34,7 @@ #define DAMM ifma256_amm52x40_dual #define DAMS ifma256_ams52x40_dual -__IPPCP_INLINE void extract_multiplier_n(Ipp64u *red_Y, +__INLINE void extract_multiplier_n(Ipp64u *red_Y, const Ipp64u red_table[1U << EXP_WIN_SIZE][2][LEN52], int red_table_idx, int tbl_idx) { diff --git a/sources/ippcp/ifma_math_avx512vl.h b/sources/ippcp/ifma_math_avx512vl.h index 1873671a..9adacc0c 100644 --- a/sources/ippcp/ifma_math_avx512vl.h +++ b/sources/ippcp/ifma_math_avx512vl.h @@ -45,11 +45,11 @@ #define SIMD_BYTES (SIMD_LEN/8) #define SIMD_QWORDS (SIMD_LEN/64) - __IPPCP_INLINE U64 loadu64(const void *p) { + __INLINE U64 loadu64(const void *p) { return _mm256_loadu_si256((U64*)p); } - __IPPCP_INLINE void storeu64(const void *p, U64 v) { + __INLINE void storeu64(const void *p, U64 v) { _mm256_storeu_si256((U64*)p, v); } @@ -102,7 +102,7 @@ } #endif - __IPPCP_INLINE U64 mul52lo(U64 b, U64 c) + __INLINE U64 mul52lo(U64 b, U64 c) { return fma52lo(_mm256_setzero_si256(), b, c); } @@ -110,44 +110,44 @@ #define fma52lo_mem(r, a, b, c, o) _mm_madd52lo_epu64_(r, a, b, c, o) #define fma52hi_mem(r, a, b, c, o) _mm_madd52hi_epu64_(r, a, b, c, o) - __IPPCP_INLINE U64 add64(U64 a, U64 b) + __INLINE U64 add64(U64 a, U64 b) { return _mm256_add_epi64(a, b); } - __IPPCP_INLINE U64 sub64(U64 a, U64 b) + __INLINE U64 sub64(U64 a, U64 b) { return _mm256_sub_epi64(a, b); } - __IPPCP_INLINE U64 get_zero64() + __INLINE U64 get_zero64() { return _mm256_setzero_si256(); } - __IPPCP_INLINE void set_zero64(U64 *a) + __INLINE void set_zero64(U64 *a) { *a = _mm256_xor_si256(*a, *a); } - __IPPCP_INLINE U64 set1(unsigned long long a) + __INLINE U64 set1(unsigned long long a) { return _mm256_set1_epi64x((long long)a); } - __IPPCP_INLINE U64 srli64(U64 a, int s) + __INLINE U64 srli64(U64 a, int s) { return _mm256_srli_epi64(a, s); } #define slli64 _mm256_slli_epi64 - __IPPCP_INLINE U64 and64_const(U64 a, unsigned long long mask) + __INLINE U64 and64_const(U64 a, unsigned long long mask) { return _mm256_and_si256(a, _mm256_set1_epi64x((long long)mask)); } - __IPPCP_INLINE U64 and64(U64 a, U64 mask) + __INLINE U64 and64(U64 a, U64 mask) { return _mm256_and_si256(a, mask); } diff --git a/sources/ippcp/owncp.h b/sources/ippcp/owncp.h index ca5fb8fb..bc314448 100644 --- a/sources/ippcp/owncp.h +++ b/sources/ippcp/owncp.h @@ -167,7 +167,7 @@ typedef int cpSize; /* test if library's feature is ON */ int cpGetFeature( Ipp64u Feature ); /* test CPU crypto features */ -__IPPCP_INLINE Ipp32u IsFeatureEnabled(Ipp64u niMmask) +__INLINE Ipp32u IsFeatureEnabled(Ipp64u niMmask) { return (Ipp32u)cpGetFeature(niMmask); } diff --git a/sources/ippcp/pcpaes_avx2_vaes.h b/sources/ippcp/pcpaes_avx2_vaes.h index 42701c6c..56bb681d 100644 --- a/sources/ippcp/pcpaes_avx2_vaes.h +++ b/sources/ippcp/pcpaes_avx2_vaes.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // AES GCM AVX2 // Internal Functions Implementations -// +// */ #ifndef __AES_GCM_AVX2_H_ @@ -40,7 +40,7 @@ #endif /* -// Zeroes the memory by 32 bit parts, +// Zeroes the memory by 32 bit parts, // because "epi32" is the minimal available granularity for avx2 store instructions. // input: // Ipp32u* out - pointer to the memory that needs to be zeroize @@ -110,7 +110,7 @@ __ALIGN32 static const Ipp8u _shuff_mask_256[] = {15, 14, 13, 12, 11, 10, 9, 8, // output: // __m256i part of the multiplication result */ -__IPPCP_INLINE __m256i avx2_internal_mul(__m256i GH, const __m256i HK, __m256i *tmpX0, __m256i *tmpX5) { +__INLINE __m256i avx2_internal_mul(__m256i GH, const __m256i HK, __m256i *tmpX0, __m256i *tmpX5) { __m256i tmpX2, tmpX3, tmpX4; tmpX2 = _mm256_shuffle_epi32 (GH, SHUFD_MASK); @@ -129,7 +129,7 @@ __IPPCP_INLINE __m256i avx2_internal_mul(__m256i GH, const __m256i HK, __m256i * // input/output: // __m128i *hash0, __m128i *hash1 - contains the two parts of the GHASH */ -__IPPCP_INLINE void reduction(__m128i *hash0, __m128i *hash1) { +__INLINE void reduction(__m128i *hash0, __m128i *hash1) { __m128i T1, T2, T3; //first phase of the reduction @@ -168,8 +168,8 @@ __IPPCP_INLINE void reduction(__m128i *hash0, __m128i *hash1) { // output: // __m128i GH[0] */ -__IPPCP_INLINE __m128i avx2_clmul_gcm16(__m256i *GH, const __m256i *HK) { - __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; +__INLINE __m128i avx2_clmul_gcm16(__m256i *GH, const __m256i *HK) { + __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; tmpX2 = _mm256_shuffle_epi32 (GH[0], SHUFD_MASK); tmpX3 = _mm256_shuffle_epi32 (HK[7], SHUFD_MASK); tmpX2 = _mm256_xor_si256(tmpX2, GH[0]); @@ -215,7 +215,7 @@ __IPPCP_INLINE __m128i avx2_clmul_gcm16(__m256i *GH, const __m256i *HK) { // output: // __m128i GH[0] */ -__IPPCP_INLINE __m128i avx2_clmul_gcm8(__m256i *GH, const __m256i *HK) { +__INLINE __m128i avx2_clmul_gcm8(__m256i *GH, const __m256i *HK) { __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; tmpX2 = _mm256_shuffle_epi32 (GH[0], SHUFD_MASK); tmpX3 = _mm256_shuffle_epi32 (HK[3], SHUFD_MASK); @@ -258,7 +258,7 @@ __IPPCP_INLINE __m128i avx2_clmul_gcm8(__m256i *GH, const __m256i *HK) { // output: // __m128i GH[0] */ -__IPPCP_INLINE __m128i avx2_clmul_gcm4(__m256i *GH, const __m256i *HK) { +__INLINE __m128i avx2_clmul_gcm4(__m256i *GH, const __m256i *HK) { __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; tmpX2 = _mm256_shuffle_epi32 (GH[0], SHUFD_MASK); tmpX3 = _mm256_shuffle_epi32 (HK[1], SHUFD_MASK); @@ -300,7 +300,7 @@ __IPPCP_INLINE __m128i avx2_clmul_gcm4(__m256i *GH, const __m256i *HK) { // output: // __m128i GH[0] */ -__IPPCP_INLINE __m128i avx2_clmul_gcm2(__m256i *GH, const __m256i *HK) { +__INLINE __m128i avx2_clmul_gcm2(__m256i *GH, const __m256i *HK) { __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; tmpX2 = _mm256_shuffle_epi32 (GH[0], SHUFD_MASK); tmpX3 = _mm256_shuffle_epi32 (HK[0], SHUFD_MASK); @@ -339,7 +339,7 @@ __IPPCP_INLINE __m128i avx2_clmul_gcm2(__m256i *GH, const __m256i *HK) { // output: // __m128i GH[0] */ -__IPPCP_INLINE __m128i avx2_clmul_gcm(__m256i *GH, const __m256i *HK) { +__INLINE __m128i avx2_clmul_gcm(__m256i *GH, const __m256i *HK) { __m256i tmpX0, tmpX2, tmpX3, tmpX4, tmpX5; tmpX2 = _mm256_shuffle_epi32 (GH[0], SHUFD_MASK); tmpX3 = _mm256_shuffle_epi32 (HK[0], SHUFD_MASK); diff --git a/sources/ippcp/pcpaes_cfbdecrypt_vaes512.c b/sources/ippcp/pcpaes_cfbdecrypt_vaes512.c index a29a2528..c3e94a50 100644 --- a/sources/ippcp/pcpaes_cfbdecrypt_vaes512.c +++ b/sources/ippcp/pcpaes_cfbdecrypt_vaes512.c @@ -37,14 +37,14 @@ #pragma warning(disable: 4310) // zmmintrin.h bug: truncation of constant value #endif -__IPPCP_INLINE Ipp64u broadcast_16to64(Ipp16u mask16) +__INLINE Ipp64u broadcast_16to64(Ipp16u mask16) { Ipp64u mask64 = (Ipp64u)mask16; mask64 = (mask64 << 48) | (mask64 << 32) | (mask64 << 16) | mask64; return mask64; } -__IPPCP_INLINE __m512i getInputBlocks(__m128i * const currentState, const __m512i * const pCipherBlocks, __mmask16 blocksCompressMask) +__INLINE __m512i getInputBlocks(__m128i * const currentState, const __m512i * const pCipherBlocks, __mmask16 blocksCompressMask) { // extract 128-bit cipher blocks __m128i c0 = _mm512_extracti64x2_epi64(*pCipherBlocks, 0); diff --git a/sources/ippcp/pcpaes_cmac_stuff.h b/sources/ippcp/pcpaes_cmac_stuff.h index a2eaba70..13f26813 100644 --- a/sources/ippcp/pcpaes_cmac_stuff.h +++ b/sources/ippcp/pcpaes_cmac_stuff.h @@ -15,11 +15,11 @@ *************************************************************************/ /* -// +// // Purpose: // Cryptography Primitive. // AES-CMAC Functions -// +// // Contents: // init() // @@ -34,7 +34,7 @@ #if !defined(_PCP_AES_CMAC_STUFF_H_) #define _PCP_AES_CMAC_STUFF_H_ -__IPPCP_INLINE int cpSizeofCtx_AESCMAC(void) +__INLINE int cpSizeofCtx_AESCMAC(void) { return sizeof(IppsAES_CMACState); } diff --git a/sources/ippcp/pcpaes_ctr_process.h b/sources/ippcp/pcpaes_ctr_process.h index 28f44ee1..445fda11 100644 --- a/sources/ippcp/pcpaes_ctr_process.h +++ b/sources/ippcp/pcpaes_ctr_process.h @@ -61,7 +61,7 @@ // counter will updated on return // */ -__IPPCP_INLINE void MaskCounter128(Ipp8u* pMaskIV, int ctrBtSize) +__INLINE void MaskCounter128(Ipp8u* pMaskIV, int ctrBtSize) { /* construct ctr mask */ int maskPosition = (MBS_RIJ128*8-ctrBtSize)/8; @@ -99,15 +99,15 @@ IppStatus cpProcessAES_ctr(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, if(ctrNumBitSize < (8 * (int)sizeof(int) - 5)) { /* - // dataLen is int, and it is always positive - // data blocks number compute from dataLen - // by dividing it to MBS_RIJ128 = 16 - // and additing 1 if dataLen % 16 != 0 - // so if ctrNumBitSize >= 8 * sizeof(int) - 5 - // function can process data with any possible - // passed dataLen without counter overflow + // dataLen is int, and it is always positive + // data blocks number compute from dataLen + // by dividing it to MBS_RIJ128 = 16 + // and additing 1 if dataLen % 16 != 0 + // so if ctrNumBitSize >= 8 * sizeof(int) - 5 + // function can process data with any possible + // passed dataLen without counter overflow */ - + int dataBlocksNum = dataLen >> 4; if(dataLen & 15){ dataBlocksNum++; diff --git a/sources/ippcp/pcpaes_ctrencrypt_rij128pipe_vaes512.c b/sources/ippcp/pcpaes_ctrencrypt_rij128pipe_vaes512.c index eb60083f..7dd00820 100644 --- a/sources/ippcp/pcpaes_ctrencrypt_rij128pipe_vaes512.c +++ b/sources/ippcp/pcpaes_ctrencrypt_rij128pipe_vaes512.c @@ -54,7 +54,7 @@ static __ALIGN64 Ipp64u nextIncLoMask[] = { 0x0, 0x4, 0x0, 0x4, 0x0, 0x4, 0x0, static __ALIGN64 Ipp64u incLoByOneMask[] = { 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1 }; static __ALIGN64 Ipp64u incHiByOneMask[] = { 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0 }; -__IPPCP_INLINE __m512i adcLo_epi64(__m512i a, __m512i b) +__INLINE __m512i adcLo_epi64(__m512i a, __m512i b) { a = _mm512_add_epi64(a, b); // check overflow in each low 64-bit of 128-bit numbers @@ -65,7 +65,7 @@ __IPPCP_INLINE __m512i adcLo_epi64(__m512i a, __m512i b) return a; } -__IPPCP_INLINE __m512i applyNonce(__m512i a, __m512i ctrBitMask, __m512i templateCtr) +__INLINE __m512i applyNonce(__m512i a, __m512i ctrBitMask, __m512i templateCtr) { a = _mm512_shuffle_epi8(a, M512(swapBytes)); a = _mm512_and_epi64(a, ctrBitMask); diff --git a/sources/ippcp/pcpaes_gcm_vaes512.h b/sources/ippcp/pcpaes_gcm_vaes512.h index de551d98..dc98428c 100644 --- a/sources/ippcp/pcpaes_gcm_vaes512.h +++ b/sources/ippcp/pcpaes_gcm_vaes512.h @@ -59,7 +59,7 @@ static __ALIGN64 Ipp8u swapBytes[] = { * * NB: make sure unused parts of input registers are zeroed to avoid issues with further horizontal XOR. */ -__IPPCP_INLINE void AesGcmKaratsubaMul4(const __m512i * const pA, /* A3 A2 A1 A0 */ +__INLINE void AesGcmKaratsubaMul4(const __m512i * const pA, /* A3 A2 A1 A0 */ const __m512i * const pHKeys, /* B3 B2 B1 B0 */ const __m512i * const pHKeysKaratsuba, /* precomputed (b1i^b0i) */ __m512i * const pH, @@ -77,7 +77,7 @@ __IPPCP_INLINE void AesGcmKaratsubaMul4(const __m512i * const pA, / /* The function performs horizontal XOR for 4 128-bit values in 512-bit register 128-bit result value saved in the low part of the 512-bit register */ -__IPPCP_INLINE void HXor4x128(const __m512i * const zmm, +__INLINE void HXor4x128(const __m512i * const zmm, __m128i * const xmm) { __m256i ymm; @@ -92,7 +92,7 @@ __IPPCP_INLINE void HXor4x128(const __m512i * const zmm, /* The function performs Montgomery reduction of 256-bit polynomial to 128-bit one with irreducible polynomial */ -__IPPCP_INLINE void ReducePoly2x128(const __m128i * const pHI, +__INLINE void ReducePoly2x128(const __m128i * const pHI, const __m128i * const pLO, __m128i * const result) { @@ -114,7 +114,7 @@ __IPPCP_INLINE void ReducePoly2x128(const __m128i * const pHI, } /* The function aggregates partial products of Karatsuba multiplication into final ghash value */ -__IPPCP_INLINE void AggregateKaratsubaPartialProducts(const __m512i * const pH, +__INLINE void AggregateKaratsubaPartialProducts(const __m512i * const pH, const __m512i * const pM, const __m512i * const pL, __m128i * const result) diff --git a/sources/ippcp/pcpaes_gcmmul_vaes512.c b/sources/ippcp/pcpaes_gcmmul_vaes512.c index 76b30a74..4953eccc 100644 --- a/sources/ippcp/pcpaes_gcmmul_vaes512.c +++ b/sources/ippcp/pcpaes_gcmmul_vaes512.c @@ -45,7 +45,7 @@ polynomial reduction. 2 polynomials can be processed at one call. The inputs are bit-reflected. The result is bit-reflected. */ -__IPPCP_INLINE void AesGcmGhash2(const __m256i* const src1, +__INLINE void AesGcmGhash2(const __m256i* const src1, const __m256i* const src2, __m256i * const result) { @@ -101,7 +101,7 @@ __IPPCP_INLINE void AesGcmGhash2(const __m256i* const src1, polynomial reduction. The inputs are bit-reflected. The result is bit-reflected. */ -__IPPCP_INLINE void AesGcmGhash(const __m128i* const a, +__INLINE void AesGcmGhash(const __m128i* const a, const __m128i* const b, __m128i * const result) { @@ -119,7 +119,7 @@ __IPPCP_INLINE void AesGcmGhash(const __m128i* const a, polynomial reduction. 4 polynomials can be processed at one call. The inputs are bit-reflected. The result is bit-reflected. */ -__IPPCP_INLINE void AesGcmGhash4(const __m512i* const src1, +__INLINE void AesGcmGhash4(const __m512i* const src1, const __m512i* const src2, __m512i * const result) { diff --git a/sources/ippcp/pcpaes_sivstuff.h b/sources/ippcp/pcpaes_sivstuff.h index 83b56927..76108c4a 100644 --- a/sources/ippcp/pcpaes_sivstuff.h +++ b/sources/ippcp/pcpaes_sivstuff.h @@ -14,12 +14,12 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // AES-SIV Functions (RFC 5297) -// +// // Contents: // Stuff() // @@ -35,12 +35,12 @@ #define _PCP_AES_SIV_STUFF_H_ //////////////////////////////////////////////////////////// -__IPPCP_INLINE void cpAES_CMAC(Ipp8u mac[MBS_RIJ128], const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx) +__INLINE void cpAES_CMAC(Ipp8u mac[MBS_RIJ128], const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx) { ippsAES_CMACUpdate(pSrc, len, pCtx); ippsAES_CMACFinal(mac, MBS_RIJ128, pCtx); } -__IPPCP_INLINE IppStatus cpAES_S2V_init(Ipp8u v[MBS_RIJ128], const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pCtx, int ctxSize) +__INLINE IppStatus cpAES_S2V_init(Ipp8u v[MBS_RIJ128], const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pCtx, int ctxSize) { IppStatus sts = ippsAES_CMACInit(pKey, keyLen, pCtx, ctxSize); if(ippStsNoErr==sts) { @@ -49,7 +49,7 @@ __IPPCP_INLINE IppStatus cpAES_S2V_init(Ipp8u v[MBS_RIJ128], const Ipp8u* pKey, } return sts; } -__IPPCP_INLINE Ipp8u* double16(Ipp8u out[MBS_RIJ128], const Ipp8u inp[MBS_RIJ128]) +__INLINE Ipp8u* double16(Ipp8u out[MBS_RIJ128], const Ipp8u inp[MBS_RIJ128]) { /* double inp */ Ipp32u carry = 0; @@ -63,7 +63,7 @@ __IPPCP_INLINE Ipp8u* double16(Ipp8u out[MBS_RIJ128], const Ipp8u inp[MBS_RIJ128 out[MBS_RIJ128-1] ^= ((Ipp8u)(0-carry) & 0x87); return out; } -__IPPCP_INLINE void cpAES_S2V_update(Ipp8u v[MBS_RIJ128], const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx) +__INLINE void cpAES_S2V_update(Ipp8u v[MBS_RIJ128], const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx) { Ipp8u t[MBS_RIJ128]; cpAES_CMAC(t, pSrc, len, pCtx); diff --git a/sources/ippcp/pcpaes_xts_vaes512.c b/sources/ippcp/pcpaes_xts_vaes512.c index 5f9009d9..201f1527 100644 --- a/sources/ippcp/pcpaes_xts_vaes512.c +++ b/sources/ippcp/pcpaes_xts_vaes512.c @@ -42,7 +42,7 @@ #define M512(mem) (*((__m512i*)(mem))) /* Generate next 4 tweaks with 2^8 multiplier */ -__IPPCP_INLINE __m512i nextTweaks_x8(__m512i tweak128x4) +__INLINE __m512i nextTweaks_x8(__m512i tweak128x4) { const __m512i poly = _mm512_set_epi64(0, 0x87, 0, 0x87, 0, 0x87, 0, 0x87); @@ -55,7 +55,7 @@ __IPPCP_INLINE __m512i nextTweaks_x8(__m512i tweak128x4) } /* Generate next 4 tweaks with 2^32 multiplier */ -__IPPCP_INLINE __m512i nextTweaks_x32(__m512i tweak128x4) +__INLINE __m512i nextTweaks_x32(__m512i tweak128x4) { const __m512i poly = _mm512_set_epi64(0, 0x87, 0, 0x87, 0, 0x87, 0, 0x87); diff --git a/sources/ippcp/pcpaesauthgcm.h b/sources/ippcp/pcpaesauthgcm.h index a7aeca56..3f6f9f1a 100644 --- a/sources/ippcp/pcpaesauthgcm.h +++ b/sources/ippcp/pcpaesauthgcm.h @@ -14,14 +14,14 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Message Authentication Algorithm // Internal Definitions and Internal Functions Prototypes -// -// +// +// */ #if !defined(_CP_AESAUTH_GCM_H) @@ -54,7 +54,7 @@ typedef enum { } GcmState; struct _cpAES_GCM { - + Ipp32u idCtx; /* AES-GCM id */ GcmState state; /* GCM state: Init, IV|AAD|TXT processing */ Ipp64u ivLen; /* IV length (bytes) */ @@ -77,7 +77,7 @@ struct _cpAES_GCM { IppsAESSpec cipher; #if (_AES_PROB_NOISE == _FEATURE_ON_) - __ALIGN16 + __ALIGN16 cpAESNoiseParams noiseParams; #endif @@ -146,13 +146,13 @@ struct _cpAES_GCM { #define AESGCM_VALID_ID(context) ((((context)->idCtx) ^ (Ipp32u)IPP_UINT_PTR((context))) == (Ipp32u)idCtxAESGCM) #if 0 -__IPPCP_INLINE void IncrementCounter32(Ipp8u* pCtr) +__INLINE void IncrementCounter32(Ipp8u* pCtr) { int i; for(i=BLOCK_SIZE-1; i>=CTR_POS && 0==(Ipp8u)(++pCtr[i]); i--) ; } #endif -__IPPCP_INLINE void IncrementCounter32(Ipp8u* pCtr) +__INLINE void IncrementCounter32(Ipp8u* pCtr) { Ipp32u* pCtr32 = (Ipp32u*)pCtr; Ipp32u ctrVal = pCtr32[3]; diff --git a/sources/ippcp/pcpaesgcmtbl2k_mulpx.c b/sources/ippcp/pcpaesgcmtbl2k_mulpx.c index 4e79658c..fad70fd4 100644 --- a/sources/ippcp/pcpaesgcmtbl2k_mulpx.c +++ b/sources/ippcp/pcpaesgcmtbl2k_mulpx.c @@ -14,17 +14,17 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Encrypt/Decrypt byte data stream according to Rijndael128 (GCM mode) -// +// // "fast" stuff -// +// // Contents: // AesGcmMulGcm_table2K() -// +// */ @@ -55,7 +55,7 @@ typedef struct{ // // Ghash = Ghash * HKey mod G() */ -__IPPCP_INLINE Ipp16u getAesGcmConst_table_ct(int idx) +__INLINE Ipp16u getAesGcmConst_table_ct(int idx) { #define TBL_SLOTS_REP_READ (Ipp32s)(sizeof(BNU_CHUNK_T)/sizeof(AesGcmConst_table[0])) const BNU_CHUNK_T* TblEntry = (BNU_CHUNK_T*)AesGcmConst_table; @@ -137,13 +137,13 @@ void AesGcmMulGcm_table2K(Ipp8u* pGhash, const Ipp8u* pPrecomputeData, const voi // CTE version of AesGcmMulGcm_table2K() */ #if (_IPP_ARCH ==_IPP_ARCH_EM64T) -__IPPCP_INLINE void MaskedXorBlock16(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, Ipp64u src2mask) +__INLINE void MaskedXorBlock16(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, Ipp64u src2mask) { ((Ipp64u*)pDst)[0] = ((Ipp64u*)pSrc1)[0] ^ (((Ipp64u*)pSrc2)[0] & src2mask); ((Ipp64u*)pDst)[1] = ((Ipp64u*)pSrc1)[1] ^ (((Ipp64u*)pSrc2)[1] & src2mask); } #else /* IPP_ARCH == IPP_ARCH_IA32 */ -__IPPCP_INLINE void MaskedXorBlock16(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, Ipp32u src2mask) +__INLINE void MaskedXorBlock16(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, Ipp32u src2mask) { ((Ipp32u*)pDst)[0] = ((Ipp32u*)pSrc1)[0] ^ (((Ipp32u*)pSrc2)[0] & src2mask); ((Ipp32u*)pDst)[1] = ((Ipp32u*)pSrc1)[1] ^ (((Ipp32u*)pSrc2)[1] & src2mask); @@ -238,7 +238,7 @@ IPP_OWN_DEFN (void, AesGcmMulGcm_table2K_ct, (Ipp8u* pGhash, const Ipp8u* pPreco #if ((_IPP>=_IPP_V8) || (_IPP32E>=_IPP32E_N8)) -__IPPCP_INLINE Ipp16u getAesGcmConst_table_ct(int idx) +__INLINE Ipp16u getAesGcmConst_table_ct(int idx) { /* init current indexes */ __ALIGN16 Ipp16u idx_start[] = { 0,1,2,3,4,5,6,7 }; diff --git a/sources/ippcp/pcpaesm.h b/sources/ippcp/pcpaesm.h index 9b220b3c..ebf04ef6 100644 --- a/sources/ippcp/pcpaesm.h +++ b/sources/ippcp/pcpaesm.h @@ -14,14 +14,14 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal Definitions and // Internal AES Function Prototypes -// -// +// +// */ #if !defined(_PCP_AES_H) @@ -65,13 +65,13 @@ static int rij128nKeys[3] = {44, 52, 60 }; // helper for nRounds[] and estnKeys[] access // note: x is length in 32-bits words */ -__IPPCP_INLINE int rij_index(int x) +__INLINE int rij_index(int x) { return (x-NB(128))>>1; } /* size of AES context */ -__IPPCP_INLINE int cpSizeofCtx_AES(void) +__INLINE int cpSizeofCtx_AES(void) { return sizeof(IppsAESSpec); } diff --git a/sources/ippcp/pcpaesmxts.h b/sources/ippcp/pcpaesmxts.h index a8eb0737..ea9d7682 100644 --- a/sources/ippcp/pcpaesmxts.h +++ b/sources/ippcp/pcpaesmxts.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // AES-XTS Internal Definitions -// -// +// +// */ #if !defined(_PCP_AES_XTS_H) @@ -53,7 +53,7 @@ struct _cpAES_XTS #define VALID_AES_XTS_ID(ctx) ((((ctx)->idCtx) ^ (Ipp32u)IPP_UINT_PTR((ctx))) == (Ipp32u)idCtxAESXTS) /* size of AES-XTS context */ -__IPPCP_INLINE int cpSizeof_AES_XTS_Ctx(void) +__INLINE int cpSizeof_AES_XTS_Ctx(void) { return sizeof(IppsAES_XTSSpec); } diff --git a/sources/ippcp/pcpaesmxtsstuff.h b/sources/ippcp/pcpaesmxtsstuff.h index 185d54c4..41ab30de 100644 --- a/sources/ippcp/pcpaesmxtsstuff.h +++ b/sources/ippcp/pcpaesmxtsstuff.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // AES-XTS Internal Functions -// -// +// +// */ #if !defined(_PCP_AES_XTS_STUFF_H) @@ -39,7 +39,7 @@ #define GF_MASK (0x8000000000000000) #define GF_POLY (0x0000000000000087) -__IPPCP_INLINE void gf_mul_by_primitive(void* x) +__INLINE void gf_mul_by_primitive(void* x) { Ipp64u* x64 = (Ipp64u*)x; Ipp64u xorL = ((Ipp64s)x64[1] >> 63) & GF_POLY; diff --git a/sources/ippcp/pcpaesnoise.h b/sources/ippcp/pcpaesnoise.h index 986c5dc0..6fc0c9bc 100644 --- a/sources/ippcp/pcpaesnoise.h +++ b/sources/ippcp/pcpaesnoise.h @@ -17,9 +17,9 @@ #if !defined(_PCP_AES_NOISE_H) #define _PCP_AES_NOISE_H -/* +/* * The parameters below are empirical and chosen in advance to guarantee - * the high level of security protection against Mistletoe3 attack. + * the high level of security protection against Mistletoe3 attack. */ #define MISTLETOE3_MAX_CHUNK_SIZE (16000) /* maximum chunks size allowed to be processed without noise injection (in bytes) \ 16000 bytes = 16*1000 bytes = 1000 AES blocks */ @@ -47,7 +47,7 @@ typedef struct _cpAESNoiseParams { #define AES_NOISE_LEVEL(ctx) ((ctx)->noiseLevel) /* size of _cpAESNoiseParams structure */ -__IPPCP_INLINE int cpSizeofNoise_Params(void) +__INLINE int cpSizeofNoise_Params(void) { return sizeof(cpAESNoiseParams); } diff --git a/sources/ippcp/pcpbn.h b/sources/ippcp/pcpbn.h index c2e5d6f4..67a31509 100644 --- a/sources/ippcp/pcpbn.h +++ b/sources/ippcp/pcpbn.h @@ -70,7 +70,7 @@ struct _cpBigNum IPP_OWN_DECL (void, cpUnpackBigNumCtx, (const Ipp8u* pBuffer, IppsBigNumState* pBN)) /* copy BN */ -__IPPCP_INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNumState* pSrc) +__INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNumState* pSrc) { BN_SIGN(pDst) = BN_SIGN(pSrc); BN_SIZE(pDst) = BN_SIZE(pSrc); @@ -78,7 +78,7 @@ __IPPCP_INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNu return pDst; } /* set BN to zero */ -__IPPCP_INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) +__INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) { BN_SIGN(pBN) = ippBigNumPOS; BN_SIZE(pBN) = 1; @@ -86,7 +86,7 @@ __IPPCP_INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) return pBN; } /* fixup BN */ -__IPPCP_INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) +__INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) { cpSize len = BN_SIZE(pBN); FIX_BNU(BN_NUMBER(pBN), len); @@ -94,7 +94,7 @@ __IPPCP_INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) return pBN; } /* set BN to chunk */ -__IPPCP_INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) +__INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) { BN_SIGN(pBN) = ippBigNumPOS; BN_SIZE(pBN) = 1; @@ -103,7 +103,7 @@ __IPPCP_INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) return pBN; } /* set BN to 2^m */ -__IPPCP_INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) +__INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) { cpSize size = BITS_BNU_CHUNK(power+1); if(BN_ROOM(pBN) >= size) { @@ -117,14 +117,14 @@ __IPPCP_INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) } /* bitsize of BN */ -__IPPCP_INLINE int cpBN_bitsize(const IppsBigNumState* pA) +__INLINE int cpBN_bitsize(const IppsBigNumState* pA) { int bitsize = BITSIZE_BNU(BN_NUMBER(pA), BN_SIZE(pA)); return bitsize; } /* returns -1/0/+1 depemding on A~B comparison */ -__IPPCP_INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB) +__INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB) { IppsBigNumSGN signA = BN_SIGN(pA); IppsBigNumSGN signB = BN_SIGN(pB); @@ -137,7 +137,7 @@ __IPPCP_INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB } /* returns -1/0/+1 depemding on A comparison 00 */ -__IPPCP_INLINE int cpBN_tst(const IppsBigNumState* pA) +__INLINE int cpBN_tst(const IppsBigNumState* pA) { if(1==BN_SIZE(pA) && 0==BN_NUMBER(pA)[0]) return 0; @@ -147,16 +147,16 @@ __IPPCP_INLINE int cpBN_tst(const IppsBigNumState* pA) // some addition functions -__IPPCP_INLINE int IsZero_BN(const IppsBigNumState* pA) +__INLINE int IsZero_BN(const IppsBigNumState* pA) { return ( BN_SIZE(pA)==1 ) && ( BN_NUMBER(pA)[0]==0 ); } -__IPPCP_INLINE int IsOdd_BN(const IppsBigNumState* pA) +__INLINE int IsOdd_BN(const IppsBigNumState* pA) { return BN_NUMBER(pA)[0] & 1; } -__IPPCP_INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) +__INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) { BN_SIGN(pBN) = ippBigNumPOS; BN_SIZE(pBN) = 1; @@ -164,14 +164,14 @@ __IPPCP_INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) BN_NUMBER(pBN)[0] = w; return pBN; } -__IPPCP_INLINE IppsBigNumState* BN_Set(const BNU_CHUNK_T* pData, cpSize len, IppsBigNumState* pBN) +__INLINE IppsBigNumState* BN_Set(const BNU_CHUNK_T* pData, cpSize len, IppsBigNumState* pBN) { BN_SIGN(pBN) = ippBigNumPOS; BN_SIZE(pBN) = len; ZEXPAND_COPY_BNU(BN_NUMBER(pBN), BN_ROOM(pBN), pData, len); return pBN; } -__IPPCP_INLINE IppsBigNumState* BN_Make(BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer, cpSize len, IppsBigNumState* pBN) +__INLINE IppsBigNumState* BN_Make(BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer, cpSize len, IppsBigNumState* pBN) { BN_SET_ID(pBN); BN_SIGN(pBN) = ippBigNumPOS; diff --git a/sources/ippcp/pcpbnu32misc.h b/sources/ippcp/pcpbnu32misc.h index c07d26d2..308c41c7 100644 --- a/sources/ippcp/pcpbnu32misc.h +++ b/sources/ippcp/pcpbnu32misc.h @@ -34,7 +34,7 @@ #define cpNLZ_BNU32 OWNAPI(cpNLZ_BNU32) IPP_OWN_DECL (cpSize, cpNLZ_BNU32, (Ipp32u x)) #else - __IPPCP_INLINE cpSize cpNLZ_BNU32(Ipp32u x) + __INLINE cpSize cpNLZ_BNU32(Ipp32u x) { return (cpSize)_lzcnt_u32(x); } @@ -52,7 +52,7 @@ // nsA size of BNU // */ -__IPPCP_INLINE int cpFix_BNU32(const Ipp32u* pA, int nsA) +__INLINE int cpFix_BNU32(const Ipp32u* pA, int nsA) { Ipp32u zscan = (Ipp32u)(-1); int outLen = nsA; @@ -67,7 +67,7 @@ __IPPCP_INLINE int cpFix_BNU32(const Ipp32u* pA, int nsA) /* most significant BNU bit */ #if 0 -__IPPCP_INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) +__INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) { FIX_BNU(pA, nsA); return nsA*BITSIZE(Ipp32u) - cpNLZ_BNU32(pA[nsA-1]) -1; @@ -75,7 +75,7 @@ __IPPCP_INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) #endif #if 0 -__IPPCP_INLINE int cpCmp_BNU32(const Ipp32u* pA, cpSize nsA, const Ipp32u* pB, cpSize nsB) +__INLINE int cpCmp_BNU32(const Ipp32u* pA, cpSize nsA, const Ipp32u* pB, cpSize nsB) { if(nsA!=nsB) return nsA>nsB? 1 : -1; diff --git a/sources/ippcp/pcpbnuarith.h b/sources/ippcp/pcpbnuarith.h index 1cf5a820..dd36a0f5 100644 --- a/sources/ippcp/pcpbnuarith.h +++ b/sources/ippcp/pcpbnuarith.h @@ -14,12 +14,12 @@ * limitations under the License. *************************************************************************/ -/* +/* // Purpose: // Intel(R) Integrated Performance Primitives. // Internal Unsigned internal arithmetic -// -// +// +// */ #if !defined(_CP_BNU_ARITH_H) @@ -60,7 +60,7 @@ // *F*/ -__IPPCP_INLINE BNU_CHUNK_T cpMul_BNU_school(BNU_CHUNK_T* pR, +__INLINE BNU_CHUNK_T cpMul_BNU_school(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) { @@ -94,7 +94,7 @@ __IPPCP_INLINE BNU_CHUNK_T cpMul_BNU_school(BNU_CHUNK_T* pR, // *F*/ -__IPPCP_INLINE BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA) +__INLINE BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA) { #if(_ADCOX_NI_ENABLING_==_FEATURE_ON_) return cpSqrAdx_BNU_school(pR, pA,nsA); @@ -114,7 +114,7 @@ __IPPCP_INLINE BNU_CHUNK_T cpSqr_BNU_school(BNU_CHUNK_T * pR, const BNU_CHUNK_T /* // multiplication/squaring wrappers */ -__IPPCP_INLINE BNU_CHUNK_T cpMul_BNU(BNU_CHUNK_T* pR, +__INLINE BNU_CHUNK_T cpMul_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB, BNU_CHUNK_T* pBuffer) @@ -122,7 +122,7 @@ __IPPCP_INLINE BNU_CHUNK_T cpMul_BNU(BNU_CHUNK_T* pR, IPP_UNREFERENCED_PARAMETER(pBuffer); return cpMul_BNU_school(pR, pA,nsA, pB,nsB); } -__IPPCP_INLINE BNU_CHUNK_T cpSqr_BNU(BNU_CHUNK_T * pR, +__INLINE BNU_CHUNK_T cpSqr_BNU(BNU_CHUNK_T * pR, const BNU_CHUNK_T * pA, cpSize nsA, BNU_CHUNK_T* pBuffer) { @@ -148,7 +148,7 @@ __IPPCP_INLINE BNU_CHUNK_T cpSqr_BNU(BNU_CHUNK_T * pR, // *F*/ -__IPPCP_INLINE cpSize cpDiv_BNU(BNU_CHUNK_T* pQ, cpSize* pnsQ, BNU_CHUNK_T* pA, cpSize nsA, BNU_CHUNK_T* pB, cpSize nsB) +__INLINE cpSize cpDiv_BNU(BNU_CHUNK_T* pQ, cpSize* pnsQ, BNU_CHUNK_T* pA, cpSize nsA, BNU_CHUNK_T* pB, cpSize nsB) { int nsR = cpDiv_BNU32((Ipp32u*)pQ, pnsQ, (Ipp32u*)pA, nsA*(Ipp32s)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), @@ -180,7 +180,7 @@ __IPPCP_INLINE cpSize cpDiv_BNU(BNU_CHUNK_T* pQ, cpSize* pnsQ, BNU_CHUNK_T* pA, // *F*/ -__IPPCP_INLINE cpSize cpMod_BNU(BNU_CHUNK_T* pX, cpSize nsX, BNU_CHUNK_T* pModulus, cpSize nsM) +__INLINE cpSize cpMod_BNU(BNU_CHUNK_T* pX, cpSize nsX, BNU_CHUNK_T* pModulus, cpSize nsM) { return cpDiv_BNU(NULL,NULL, pX,nsX, pModulus, nsM); } diff --git a/sources/ippcp/pcpbnumisc.h b/sources/ippcp/pcpbnumisc.h index 33b04a82..7656ddaf 100644 --- a/sources/ippcp/pcpbnumisc.h +++ b/sources/ippcp/pcpbnumisc.h @@ -67,10 +67,10 @@ /* copy and set */ -__IPPCP_INLINE void cpCpy_BNU(BNU_CHUNK_T* pDst, const BNU_CHUNK_T* pSrc, cpSize ns) +__INLINE void cpCpy_BNU(BNU_CHUNK_T* pDst, const BNU_CHUNK_T* pSrc, cpSize ns) { COPY_BNU(pDst, pSrc, ns); } -__IPPCP_INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) +__INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) { ZEXPAND_BNU(pDst, 0, ns); pDst[0] = val; @@ -90,7 +90,7 @@ __IPPCP_INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) // nsA Size of pA // */ -__IPPCP_INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) +__INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) { BNU_CHUNK_T zscan = (BNU_CHUNK_T)(-1); int outLen = nsA; @@ -120,7 +120,7 @@ __IPPCP_INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) // */ #if 0 -__IPPCP_INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) +__INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) { if(nsA!=nsB) return nsA>nsB? 1 : -1; @@ -133,7 +133,7 @@ __IPPCP_INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_ } #endif -__IPPCP_INLINE int cpCmp_BNU0(const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, int len) +__INLINE int cpCmp_BNU0(const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, int len) { const Ipp32u* a32 = (const Ipp32u*)a; const Ipp32u* b32 = (const Ipp32u*)b; @@ -153,7 +153,7 @@ __IPPCP_INLINE int cpCmp_BNU0(const BNU_CHUNK_T* a, const BNU_CHUNK_T* b, int le return (int)(resb|resd); } -__IPPCP_INLINE int cpCmp_BNU(const BNU_CHUNK_T* a, int aLen, const BNU_CHUNK_T* b, int bLen) +__INLINE int cpCmp_BNU(const BNU_CHUNK_T* a, int aLen, const BNU_CHUNK_T* b, int bLen) { BNU_CHUNK_T aLen_eq_bLen = cpIsZero_ct((BNU_CHUNK_T)(aLen-bLen)); // FFFF/0000 if (aLen=bLen) / (aLen!=bLen) BNU_CHUNK_T aLen_gt_bLen = cpIsMsb_ct((BNU_CHUNK_T)(bLen-aLen)) & 1; // 1/0 if (aLen>bLen) / (aLen0, if A > 0 // <0, looks like impossible (or error) case */ -__IPPCP_INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) +__INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) { for(; (nsA>0) && (0==pA[nsA-1]); nsA--) ; return nsA; @@ -208,7 +208,7 @@ __IPPCP_INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) #define cpNLZ_BNU OWNAPI(cpNLZ_BNU) IPP_OWN_DECL (cpSize, cpNLZ_BNU, (BNU_CHUNK_T x)) #else - __IPPCP_INLINE cpSize cpNLZ_BNU(BNU_CHUNK_T x) + __INLINE cpSize cpNLZ_BNU(BNU_CHUNK_T x) { #if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT) return (cpSize)_lzcnt_u64(x); diff --git a/sources/ippcp/pcpeccp.h b/sources/ippcp/pcpeccp.h index 311c9fd3..aa108544 100644 --- a/sources/ippcp/pcpeccp.h +++ b/sources/ippcp/pcpeccp.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal ECC (prime) basic Definitions & Function Prototypes -// -// +// +// */ #if !defined(_NEW_PCP_ECCP_H) @@ -29,7 +29,7 @@ #include "pcpgfpecstuff.h" -__IPPCP_INLINE IppsBigNumState* cpConstructBN(IppsBigNumState* pBN, cpSize len, BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer) +__INLINE IppsBigNumState* cpConstructBN(IppsBigNumState* pBN, cpSize len, BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer) { BN_SET_ID(pBN); BN_SIGN(pBN) = ippBigNumPOS; @@ -164,7 +164,7 @@ extern const BNU_CHUNK_T h_secp384r1_p[]; extern const BNU_CHUNK_T h_secp521r1_p[]; extern const BNU_CHUNK_T h_tpmSM2_p256_p[]; -__IPPCP_INLINE BNU_CHUNK_T* cpModAdd_BNU(BNU_CHUNK_T* pR, +__INLINE BNU_CHUNK_T* cpModAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pM, int ns, BNU_CHUNK_T* pBuffer) @@ -175,7 +175,7 @@ __IPPCP_INLINE BNU_CHUNK_T* cpModAdd_BNU(BNU_CHUNK_T* pR, return pR; } -__IPPCP_INLINE BNU_CHUNK_T* cpModSub_BNU(BNU_CHUNK_T* pR, +__INLINE BNU_CHUNK_T* cpModSub_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, const BNU_CHUNK_T* pM, int ns, BNU_CHUNK_T* pBuffer) diff --git a/sources/ippcp/pcpgfpecessm2.h b/sources/ippcp/pcpgfpecessm2.h index 5fd1a28a..fd56c876 100644 --- a/sources/ippcp/pcpgfpecessm2.h +++ b/sources/ippcp/pcpgfpecessm2.h @@ -54,7 +54,7 @@ struct _cpStateECES_SM2 { #define VALID_ECES_SM2_ID(stt) ((((stt)->idCtx) ^ (Ipp32u)IPP_UINT_PTR((stt))) == (Ipp32u)idxCtxECES_SM2) /* get a byte, update 0-kdf status */ -__IPPCP_INLINE Ipp8u cpECES_SM2KdfNextByte(IppsECESState_SM2* pState) { +__INLINE Ipp8u cpECES_SM2KdfNextByte(IppsECESState_SM2* pState) { if (pState->kdfIndex == IPP_SM3_DIGEST_BITSIZE / BYTESIZE) { ++pState->kdfCounter; pState->kdfIndex = 0; diff --git a/sources/ippcp/pcpgfpecstuff.h b/sources/ippcp/pcpgfpecstuff.h index 4d432ae9..79a593c9 100644 --- a/sources/ippcp/pcpgfpecstuff.h +++ b/sources/ippcp/pcpgfpecstuff.h @@ -188,22 +188,22 @@ IPP_OWN_DECL (const cpPrecompAP*, gfpec_precom_sm2_radix52_fun, (void)) /* // get/release n points from/to the pool */ -__IPPCP_INLINE BNU_CHUNK_T* cpEcGFpGetPool(int n, IppsGFpECState* pEC) +__INLINE BNU_CHUNK_T* cpEcGFpGetPool(int n, IppsGFpECState* pEC) { BNU_CHUNK_T* pPool = ECP_POOL(pEC); ECP_POOL(pEC) += n*GFP_FELEN(GFP_PMA(ECP_GFP(pEC)))*3; return pPool; } -__IPPCP_INLINE void cpEcGFpReleasePool(int n, IppsGFpECState* pEC) +__INLINE void cpEcGFpReleasePool(int n, IppsGFpECState* pEC) { int chunk_size = n*GFP_FELEN(GFP_PMA(ECP_GFP(pEC)))*3; ECP_POOL(pEC) -= chunk_size; - // Clean the pool for the security reasons + // Clean the pool for the security reasons // (intermediate sensitive data may be stored here) - ZEXPAND_BNU(ECP_POOL(pEC), 0, chunk_size); + ZEXPAND_BNU(ECP_POOL(pEC), 0, chunk_size); } -__IPPCP_INLINE IppsGFpECPoint* cpEcGFpInitPoint(IppsGFpECPoint* pPoint, BNU_CHUNK_T* pData, int flags, const IppsGFpECState* pEC) +__INLINE IppsGFpECPoint* cpEcGFpInitPoint(IppsGFpECPoint* pPoint, BNU_CHUNK_T* pData, int flags, const IppsGFpECState* pEC) { ECP_POINT_SET_ID(pPoint); ECP_POINT_FLAGS(pPoint) = flags; @@ -213,7 +213,7 @@ __IPPCP_INLINE IppsGFpECPoint* cpEcGFpInitPoint(IppsGFpECPoint* pPoint, BNU_CHUN } /* copy one point into another */ -__IPPCP_INLINE IppsGFpECPoint* gfec_CopyPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointA, int elemLen) +__INLINE IppsGFpECPoint* gfec_CopyPoint(IppsGFpECPoint* pPointR, const IppsGFpECPoint* pPointA, int elemLen) { cpGFpElementCopy(ECP_POINT_DATA(pPointR), ECP_POINT_DATA(pPointA), 3*elemLen); ECP_POINT_FLAGS(pPointR) = ECP_POINT_FLAGS(pPointA); @@ -221,7 +221,7 @@ __IPPCP_INLINE IppsGFpECPoint* gfec_CopyPoint(IppsGFpECPoint* pPointR, const Ipp } -__IPPCP_INLINE IppsGFpECPoint* gfec_SetPointAtInfinity(IppsGFpECPoint* pPoint) +__INLINE IppsGFpECPoint* gfec_SetPointAtInfinity(IppsGFpECPoint* pPoint) { int elemLen = ECP_POINT_FELEN(pPoint); cpGFpElementPad(ECP_POINT_X(pPoint), elemLen, 0); @@ -235,7 +235,7 @@ __IPPCP_INLINE IppsGFpECPoint* gfec_SetPointAtInfinity(IppsGFpECPoint* pPoint) // test infinity: // IsProjectivePointAtInfinity */ -__IPPCP_INLINE int gfec_IsPointAtInfinity(const IppsGFpECPoint* pPoint) +__INLINE int gfec_IsPointAtInfinity(const IppsGFpECPoint* pPoint) { return GFP_IS_ZERO( ECP_POINT_Z(pPoint), ECP_POINT_FELEN(pPoint)); } @@ -243,7 +243,7 @@ __IPPCP_INLINE int gfec_IsPointAtInfinity(const IppsGFpECPoint* pPoint) /* signed encode */ -__IPPCP_INLINE void booth_recode(Ipp8u* sign, Ipp8u* digit, Ipp8u in, int w) +__INLINE void booth_recode(Ipp8u* sign, Ipp8u* digit, Ipp8u in, int w) { Ipp8u s = (Ipp8u)(~((in >> w) - 1)); int d = (1 << (w+1)) - in - 1; @@ -288,7 +288,7 @@ IPP_OWN_DECL (int, gfec_MakePoint, (IppsGFpECPoint* pPoint, const BNU_CHUNK_T* p IPP_OWN_DECL (int, gfec_ComparePoint, (const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC)) IPP_OWN_DECL (int, gfec_IsPointOnCurve, (const IppsGFpECPoint* pP, IppsGFpECState* pEC)) -__IPPCP_INLINE IppsGFpECPoint* gfec_DblPoint(IppsGFpECPoint* pR, +__INLINE IppsGFpECPoint* gfec_DblPoint(IppsGFpECPoint* pR, const IppsGFpECPoint* pP, IppsGFpECState* pEC) { gfec_point_double(ECP_POINT_X(pR), ECP_POINT_X(pP), pEC); @@ -296,7 +296,7 @@ __IPPCP_INLINE IppsGFpECPoint* gfec_DblPoint(IppsGFpECPoint* pR, return pR; } -__IPPCP_INLINE IppsGFpECPoint* gfec_AddPoint(IppsGFpECPoint* pR, +__INLINE IppsGFpECPoint* gfec_AddPoint(IppsGFpECPoint* pR, const IppsGFpECPoint* pP, const IppsGFpECPoint* pQ, IppsGFpECState* pEC) { diff --git a/sources/ippcp/pcpgfpstuff.h b/sources/ippcp/pcpgfpstuff.h index 17aca720..d7adeb84 100644 --- a/sources/ippcp/pcpgfpstuff.h +++ b/sources/ippcp/pcpgfpstuff.h @@ -89,24 +89,24 @@ typedef struct _cpGFp { #define cpGFpReleasePool(n, gfe) gsModPoolFree((gfe), (n)) -__IPPCP_INLINE int cpGFpElementLen(const BNU_CHUNK_T* pE, int nsE) +__INLINE int cpGFpElementLen(const BNU_CHUNK_T* pE, int nsE) { for(; nsE>1 && 0==pE[nsE-1]; nsE--) ; return nsE; } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpElementCopy(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pE, int nsE) +__INLINE BNU_CHUNK_T* cpGFpElementCopy(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pE, int nsE) { int n; for(n=0; nadd(pR, pA, pB, pGFE); } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, gsModEngine* pGFE) +__INLINE BNU_CHUNK_T* cpGFpSub(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, gsModEngine* pGFE) { return GFP_METHOD(pGFE)->sub(pR, pA, pB, pGFE); } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) +__INLINE BNU_CHUNK_T* cpGFpNeg(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) { return GFP_METHOD(pGFE)->neg(pR, pA, pGFE); } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, gsModEngine* pGFE) +__INLINE BNU_CHUNK_T* cpGFpMul(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, gsModEngine* pGFE) { return GFP_METHOD(pGFE)->mul(pR, pA, pB, pGFE); } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) +__INLINE BNU_CHUNK_T* cpGFpSqr(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) { return GFP_METHOD(pGFE)->sqr(pR, pA, pGFE); } -__IPPCP_INLINE BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) +__INLINE BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pGFE) { return GFP_METHOD(pGFE)->div2(pR, pA, pGFE); } @@ -169,7 +169,7 @@ __IPPCP_INLINE BNU_CHUNK_T* cpGFpHalve(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, g /* construct GF element */ -__IPPCP_INLINE IppsGFpElement* cpGFpElementConstruct(IppsGFpElement* pR, BNU_CHUNK_T* pDataBufer, int ns) +__INLINE IppsGFpElement* cpGFpElementConstruct(IppsGFpElement* pR, BNU_CHUNK_T* pDataBufer, int ns) { GFPE_SET_ID(pR); GFPE_ROOM(pR) = ns; diff --git a/sources/ippcp/pcpgfpxmethod_binom_epid2.c b/sources/ippcp/pcpgfpxmethod_binom_epid2.c index 0daaeda5..2798decf 100644 --- a/sources/ippcp/pcpgfpxmethod_binom_epid2.c +++ b/sources/ippcp/pcpgfpxmethod_binom_epid2.c @@ -57,7 +57,7 @@ // The case is important in GF(((p^2)^3)^2) arithmetic for Intel(R) EPID 2.0. // */ -__IPPCP_INLINE BNU_CHUNK_T* cpFq6Mul_vi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsEngine* pGFEx) +__INLINE BNU_CHUNK_T* cpFq6Mul_vi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsEngine* pGFEx) { gsEngine* pGroundGFE = GFP_PARENT(pGFEx); int termLen = GFP_FELEN(pGroundGFE); @@ -250,7 +250,7 @@ static gsModMethod* gsPolyArith_binom2_epid2 (void) // // Purpose: Returns a reference to the implementation of arithmetic operations over GF(pd). // -// Returns: pointer to a structure containing +// Returns: pointer to a structure containing // an implementation of arithmetic operations over GF(pd) // g(x) = x^2 - a0, a0 from GF(q), a0 = 1 // g(w) = w^2 - V0, v0 from GF((q^2)^3), V0 = 0*s^2 + v + 0 diff --git a/sources/ippcp/pcpgfpxmethod_binom_epid2.h b/sources/ippcp/pcpgfpxmethod_binom_epid2.h index 1f492b71..2b097c98 100644 --- a/sources/ippcp/pcpgfpxmethod_binom_epid2.h +++ b/sources/ippcp/pcpgfpxmethod_binom_epid2.h @@ -57,7 +57,7 @@ // The case is important in GF((p^2)^3) arithmetic for Intel(R) EPID 2.0. // */ -__IPPCP_INLINE BNU_CHUNK_T* cpFq2Mul_xi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsEngine* pGFEx) +__INLINE BNU_CHUNK_T* cpFq2Mul_xi(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsEngine* pGFEx) { gsEngine* pGroundGFE = GFP_PARENT(pGFEx); mod_mul addF = GFP_METHOD(pGroundGFE)->add; diff --git a/sources/ippcp/pcpgfpxstuff.h b/sources/ippcp/pcpgfpxstuff.h index d892e3c5..b5d63881 100644 --- a/sources/ippcp/pcpgfpxstuff.h +++ b/sources/ippcp/pcpgfpxstuff.h @@ -14,11 +14,11 @@ * limitations under the License. *************************************************************************/ -/* +/* // Intel(R) Integrated Performance Primitives // Cryptographic Primitives (ippCP) // GF(p) extension internal -// +// */ #if !defined(_PCP_GFPEXT_H_) @@ -35,7 +35,7 @@ #define GFPX_IDX_ELEMENT(pxe, idx, eleSize) ((pxe)+(eleSize)*(idx)) -__IPPCP_INLINE int degree(const BNU_CHUNK_T* pE, const gsModEngine* pGFEx) +__INLINE int degree(const BNU_CHUNK_T* pE, const gsModEngine* pGFEx) { int groundElemLen = GFP_FELEN(GFP_PARENT(pGFEx)); int deg; @@ -45,14 +45,14 @@ __IPPCP_INLINE int degree(const BNU_CHUNK_T* pE, const gsModEngine* pGFEx) return deg; } -__IPPCP_INLINE gsModEngine* cpGFpBasic(const gsModEngine* pGFEx) +__INLINE gsModEngine* cpGFpBasic(const gsModEngine* pGFEx) { while( !GFP_IS_BASIC(pGFEx) ) { pGFEx = GFP_PARENT(pGFEx); } return (gsModEngine*)pGFEx; } -__IPPCP_INLINE int cpGFpBasicDegreeExtension(const gsModEngine* pGFEx) +__INLINE int cpGFpBasicDegreeExtension(const gsModEngine* pGFEx) { int degree = GFP_EXTDEGREE(pGFEx); while( !GFP_IS_BASIC(pGFEx) ) { @@ -65,7 +65,7 @@ __IPPCP_INLINE int cpGFpBasicDegreeExtension(const gsModEngine* pGFEx) /* convert external data (Ipp32u) => internal element (BNU_CHUNK_T) representation returns length of element (in BNU_CHUNK_T) */ -__IPPCP_INLINE int cpGFpxCopyToChunk(BNU_CHUNK_T* pElm, const Ipp32u* pA, int nsA, const gsModEngine* pGFEx) +__INLINE int cpGFpxCopyToChunk(BNU_CHUNK_T* pElm, const Ipp32u* pA, int nsA, const gsModEngine* pGFEx) { gsModEngine* pBasicGFE = cpGFpBasic(pGFEx); int basicExtension = cpGFpBasicDegreeExtension(pGFEx); @@ -84,7 +84,7 @@ __IPPCP_INLINE int cpGFpxCopyToChunk(BNU_CHUNK_T* pElm, const Ipp32u* pA, int ns /* convert internal element (BNU_CHUNK_T) => external data (Ipp32u) representation returns length of data (in Ipp32u) */ -__IPPCP_INLINE int cpGFpxCopyFromChunk(Ipp32u* pA, const BNU_CHUNK_T* pElm, const gsModEngine* pGFEx) +__INLINE int cpGFpxCopyFromChunk(Ipp32u* pA, const BNU_CHUNK_T* pElm, const gsModEngine* pGFEx) { gsModEngine* pBasicGFE = cpGFpBasic(pGFEx); int basicExtension = cpGFpBasicDegreeExtension(pGFEx); diff --git a/sources/ippcp/pcphash.h b/sources/ippcp/pcphash.h index dcc1ba75..bf24edf7 100644 --- a/sources/ippcp/pcphash.h +++ b/sources/ippcp/pcphash.h @@ -14,14 +14,14 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Security Hash Standard // Internal Definitions and Internal Functions Prototypes -// -// +// +// */ #if !defined(_PCP_HASH_H) @@ -183,19 +183,19 @@ extern const Ipp8u* cpHashIV[]; extern const cpHashAttr cpHashAlgAttr[]; /* IV size helper */ -__IPPCP_INLINE int cpHashIvSize(IppHashAlgId algID) +__INLINE int cpHashIvSize(IppHashAlgId algID) { return cpHashAlgAttr[algID].ivSize; } /* hash size helper */ -__IPPCP_INLINE int cpHashSize(IppHashAlgId algID) +__INLINE int cpHashSize(IppHashAlgId algID) { return cpHashAlgAttr[algID].hashSize; } /* message block size helper */ -__IPPCP_INLINE int cpHashMBS(IppHashAlgId algID) +__INLINE int cpHashMBS(IppHashAlgId algID) { return cpHashAlgAttr[algID].msgBlkSize; } /* maps algID into enabled IppHashAlgId value */ -__IPPCP_INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID) +__INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID) { /* maps algID into the valid range */ algID = (((int)ippHashAlg_Unknown < (int)algID) && ((int)algID < (int)ippHashAlg_MaxNo))? algID : ippHashAlg_Unknown; diff --git a/sources/ippcp/pcphashsha1px.c b/sources/ippcp/pcphashsha1px.c index 31b7476c..34b9fedd 100644 --- a/sources/ippcp/pcphashsha1px.c +++ b/sources/ippcp/pcphashsha1px.c @@ -14,16 +14,16 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Message block processing according to SHA1 -// +// // Contents: // UpdateSHA1() -// -// +// +// */ #include "owndefs.h" @@ -62,7 +62,7 @@ } #if defined(_ALG_SHA1_COMPACT_) -__IPPCP_INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d) +__INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d) { switch(s) { case 0: return MAGIC_F0(b,c,d); diff --git a/sources/ippcp/pcphashsm3px.c b/sources/ippcp/pcphashsm3px.c index e8267039..c5392180 100644 --- a/sources/ippcp/pcphashsm3px.c +++ b/sources/ippcp/pcphashsm3px.c @@ -14,16 +14,16 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Message block processing according to SM5 -// +// // Contents: // UpdateSM3() -// -// +// +// */ #include "owndefs.h" @@ -141,14 +141,14 @@ *F*/ #if defined(_ALG_SM3_COMPACT_) -__IPPCP_INLINE Ipp32u MagicFF(int s, Ipp32u a, Ipp32u b, Ipp32u c) +__INLINE Ipp32u MagicFF(int s, Ipp32u a, Ipp32u b, Ipp32u c) { switch(s) { case 0: return FF1(a,b,c); default:return FF2(a,b,c); } } -__IPPCP_INLINE Ipp32u MagicGG(int s, Ipp32u e, Ipp32u f, Ipp32u g) +__INLINE Ipp32u MagicGG(int s, Ipp32u e, Ipp32u f, Ipp32u g) { switch(s) { case 0: return GG1(e,f,g); diff --git a/sources/ippcp/pcphashupdate.c b/sources/ippcp/pcphashupdate.c index 940a3079..eb2b5642 100644 --- a/sources/ippcp/pcphashupdate.c +++ b/sources/ippcp/pcphashupdate.c @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Security Hash Standard // General Functionality -// +// // Contents: // ippsHashUpdate() // @@ -50,7 +50,7 @@ // pState pointer to the Hash context // *F*/ -__IPPCP_INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi) +__INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi) { int isExceed = lenLo > maxLo; isExceed = (lenHi+(Ipp64u)isExceed) > maxHi; diff --git a/sources/ippcp/pcpmask_ct.h b/sources/ippcp/pcpmask_ct.h index 0fa80c58..85245e23 100644 --- a/sources/ippcp/pcpmask_ct.h +++ b/sources/ippcp/pcpmask_ct.h @@ -81,7 +81,7 @@ static __NOINLINE BNU_CHUNK_T cpIsMsb_ct(BNU_CHUNK_T a) #else /* replace under mask: dst[] = replaceFlag? src[] : dst[] */ -__IPPCP_INLINE void cpMaskedReplace_ct(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, int len, BNU_CHUNK_T replaceMask) +__INLINE void cpMaskedReplace_ct(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, int len, BNU_CHUNK_T replaceMask) { BNU_CHUNK_T dstMask = ~replaceMask; int n; @@ -90,7 +90,7 @@ __IPPCP_INLINE void cpMaskedReplace_ct(BNU_CHUNK_T* dst, const BNU_CHUNK_T* src, } /* copy under mask: dst[] = src1[] & mask) ^ src2[] & ~mask */ -__IPPCP_INLINE void cpMaskedCopyBNU_ct(BNU_CHUNK_T* dst, BNU_CHUNK_T mask, const BNU_CHUNK_T* src1, const BNU_CHUNK_T* src2, int len) +__INLINE void cpMaskedCopyBNU_ct(BNU_CHUNK_T* dst, BNU_CHUNK_T mask, const BNU_CHUNK_T* src1, const BNU_CHUNK_T* src2, int len) { int i; for(i=0; i> (sizeof(a) * 8 - 1)); } @@ -110,43 +110,43 @@ __IPPCP_INLINE BNU_CHUNK_T cpIsMsb_ct(BNU_CHUNK_T a) #endif /* tests if LSB(a)==1 */ -__IPPCP_INLINE BNU_CHUNK_T cpIsLsb_ct(BNU_CHUNK_T a) +__INLINE BNU_CHUNK_T cpIsLsb_ct(BNU_CHUNK_T a) { return (BNU_CHUNK_T)0 - (a & 1); } /* tests if a is odd */ -__IPPCP_INLINE BNU_CHUNK_T cpIsOdd_ct(BNU_CHUNK_T a) +__INLINE BNU_CHUNK_T cpIsOdd_ct(BNU_CHUNK_T a) { return cpIsLsb_ct(a); } /* tests if a is even */ -__IPPCP_INLINE BNU_CHUNK_T cpIsEven_ct(BNU_CHUNK_T a) +__INLINE BNU_CHUNK_T cpIsEven_ct(BNU_CHUNK_T a) { return ~cpIsLsb_ct(a); } /* tests if a==0 */ -__IPPCP_INLINE BNU_CHUNK_T cpIsZero_ct(BNU_CHUNK_T a) +__INLINE BNU_CHUNK_T cpIsZero_ct(BNU_CHUNK_T a) { return cpIsMsb_ct(~a & (a - 1)); } /* tests if a==b */ -__IPPCP_INLINE BNU_CHUNK_T cpIsEqu_ct(BNU_CHUNK_T a, BNU_CHUNK_T b) +__INLINE BNU_CHUNK_T cpIsEqu_ct(BNU_CHUNK_T a, BNU_CHUNK_T b) { return cpIsZero_ct(a ^ b); } /* test if ared(pR, pProduct, pModEngine); } -__IPPCP_INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, +__INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, gsModEngine* pModEngine) @@ -79,7 +79,7 @@ __IPPCP_INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, MOD_METHOD( pModEngine )->mul(pR, pA, pB, pModEngine); } -__IPPCP_INLINE cpSize cpMontMul_BNU_EX(BNU_CHUNK_T* pR, +__INLINE cpSize cpMontMul_BNU_EX(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB, gsModEngine* pModEngine) @@ -100,14 +100,14 @@ __IPPCP_INLINE cpSize cpMontMul_BNU_EX(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE void cpMontSqr_BNU(BNU_CHUNK_T* pR, +__INLINE void cpMontSqr_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, gsModEngine* pModEngine) { MOD_METHOD( pModEngine )->sqr(pR, pA, pModEngine); } -__IPPCP_INLINE void cpMontSqr_BNU_EX(BNU_CHUNK_T* pR, +__INLINE void cpMontSqr_BNU_EX(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, gsModEngine* pModEngine) { @@ -120,7 +120,7 @@ __IPPCP_INLINE void cpMontSqr_BNU_EX(BNU_CHUNK_T* pR, /* // Montgomery encoding/decoding */ -__IPPCP_INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, +__INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pXreg, gsModEngine* pModEngine) { @@ -132,7 +132,7 @@ __IPPCP_INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE cpSize cpMontEnc_BNU_EX(BNU_CHUNK_T* pR, +__INLINE cpSize cpMontEnc_BNU_EX(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pXreg, cpSize nsX, gsModEngine* pModEngine) { @@ -147,7 +147,7 @@ __IPPCP_INLINE cpSize cpMontEnc_BNU_EX(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, +__INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pXmont, cpSize nsX, gsModEngine* pModEngine) { @@ -161,7 +161,7 @@ __IPPCP_INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE void cpMontMul_BN(IppsBigNumState* pRbn, +__INLINE void cpMontMul_BN(IppsBigNumState* pRbn, const IppsBigNumState* pXbn, const IppsBigNumState* pYbn, gsModEngine* pModEngine) @@ -176,7 +176,7 @@ __IPPCP_INLINE void cpMontMul_BN(IppsBigNumState* pRbn, BN_SIGN(pRbn) = ippBigNumPOS; } -__IPPCP_INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, +__INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, const IppsBigNumState* pXbn, gsModEngine* pModEngine) { @@ -188,7 +188,7 @@ __IPPCP_INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, BN_SIGN(pRbn) = ippBigNumPOS; } -__IPPCP_INLINE void cpMontDec_BN(IppsBigNumState* pRbn, +__INLINE void cpMontDec_BN(IppsBigNumState* pRbn, const IppsBigNumState* pXbn, gsModEngine* pModEngine) { @@ -207,7 +207,7 @@ __IPPCP_INLINE void cpMontDec_BN(IppsBigNumState* pRbn, #define cpMontExpBin_BNU_sscm OWNAPI(cpMontExpBin_BNU_sscm) IPP_OWN_DECL (cpSize, cpMontExpBin_BNU_sscm, (BNU_CHUNK_T* pY, const BNU_CHUNK_T* pX, cpSize nsX, const BNU_CHUNK_T* pE, cpSize nsE, gsModEngine* pModEngine)) -__IPPCP_INLINE void cpMontExpBin_BN_sscm(IppsBigNumState* pYbn, +__INLINE void cpMontExpBin_BN_sscm(IppsBigNumState* pYbn, const IppsBigNumState* pXbn, const IppsBigNumState* pEbn, gsModEngine* pMont) @@ -223,7 +223,7 @@ __IPPCP_INLINE void cpMontExpBin_BN_sscm(IppsBigNumState* pYbn, BN_SIGN(pYbn) = ippBigNumPOS; } -__IPPCP_INLINE void cpMontExpBin_BN(IppsBigNumState* pYbn, +__INLINE void cpMontExpBin_BN(IppsBigNumState* pYbn, const IppsBigNumState* pXbn, const IppsBigNumState* pEbn, gsModEngine* pModEngine) diff --git a/sources/ippcp/pcpmontred.h b/sources/ippcp/pcpmontred.h index 2ef13268..74ebef75 100644 --- a/sources/ippcp/pcpmontred.h +++ b/sources/ippcp/pcpmontred.h @@ -14,10 +14,10 @@ * limitations under the License. *************************************************************************/ -/* +/* // Intel(R) Integrated Performance Primitives // Cryptographic Primitives (ippcp) -// +// */ #if !defined(_CP_MONTRED_H) #define _CP_MONTRED_H @@ -34,7 +34,7 @@ #define cpMontRedAdx_BNU OWNAPI(cpMontRedAdx_BNU) IPP_OWN_DECL (void, cpMontRedAdx_BNU, (BNU_CHUNK_T* pR, BNU_CHUNK_T* pProduct, const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0)) -__IPPCP_INLINE void cpMontRed_BNU_opt(BNU_CHUNK_T* pR, +__INLINE void cpMontRed_BNU_opt(BNU_CHUNK_T* pR, BNU_CHUNK_T* pProduct, const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) { diff --git a/sources/ippcp/pcpngmontexpstuff.h b/sources/ippcp/pcpngmontexpstuff.h index 1c924d86..c2943ab9 100644 --- a/sources/ippcp/pcpngmontexpstuff.h +++ b/sources/ippcp/pcpngmontexpstuff.h @@ -14,14 +14,14 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal Definitions and // Internal ng RSA Function Prototypes -// -// +// +// */ #if !defined(_CP_NG_MONT_EXP_STUFF_H) @@ -35,7 +35,7 @@ /* // optimal size of fixed window exponentiation */ -__IPPCP_INLINE cpSize gsMontExp_WinSize(cpSize bitsize) +__INLINE cpSize gsMontExp_WinSize(cpSize bitsize) { #if defined(_USE_WINDOW_EXP_) // new computations @@ -56,7 +56,7 @@ __IPPCP_INLINE cpSize gsMontExp_WinSize(cpSize bitsize) /* // Montgomery encoding/decoding */ -__IPPCP_INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, +__INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pXreg, cpSize nsX, const gsModEngine* pMont) { @@ -66,7 +66,7 @@ __IPPCP_INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, +__INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pXmont, gsModEngine* pMont) { @@ -75,7 +75,7 @@ __IPPCP_INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, return nsM; } -__IPPCP_INLINE void gsMontEnc_BN(IppsBigNumState* pRbn, +__INLINE void gsMontEnc_BN(IppsBigNumState* pRbn, const IppsBigNumState* pXbn, gsModEngine* pMont) { diff --git a/sources/ippcp/pcpngmontexpstuff_avx2.c b/sources/ippcp/pcpngmontexpstuff_avx2.c index 6fb10cdd..9bce7307 100644 --- a/sources/ippcp/pcpngmontexpstuff_avx2.c +++ b/sources/ippcp/pcpngmontexpstuff_avx2.c @@ -99,7 +99,7 @@ static int dig27_regular(Ipp32u* pRegular, int regLen, const Ipp64u* pRep27, int } /* mont_mul wrapper */ -__IPPCP_INLINE void cpMontMul_avx2(Ipp64u* pR, const Ipp64u* pA, const Ipp64u* pB, const Ipp64u* pModulus, int mLen, Ipp64u k0, Ipp64u* pBuffer) +__INLINE void cpMontMul_avx2(Ipp64u* pR, const Ipp64u* pA, const Ipp64u* pB, const Ipp64u* pModulus, int mLen, Ipp64u k0, Ipp64u* pBuffer) { if(mLen==38) /* corresponds to 1024-bit regular representation */ cpMontMul1024_avx2(pR, pA, pB, pModulus, mLen, k0); @@ -115,7 +115,7 @@ __IPPCP_INLINE void cpMontMul_avx2(Ipp64u* pR, const Ipp64u* pA, const Ipp64u* p } /* mont_sqr wrapper */ -__IPPCP_INLINE void cpMontSqr_avx2(Ipp64u* pR, const Ipp64u* pA, const Ipp64u* pModulus, int mLen, Ipp64u k0, Ipp64u* pBuffer) +__INLINE void cpMontSqr_avx2(Ipp64u* pR, const Ipp64u* pA, const Ipp64u* pModulus, int mLen, Ipp64u k0, Ipp64u* pBuffer) { if(mLen==38) /* corresponds to 1024-bit regular representation */ cpMontSqr1024_avx2(pR, pA, pModulus, mLen, k0, pBuffer); diff --git a/sources/ippcp/pcpngmontexpstuff_avx2.h b/sources/ippcp/pcpngmontexpstuff_avx2.h index 55497cd2..53eef799 100644 --- a/sources/ippcp/pcpngmontexpstuff_avx2.h +++ b/sources/ippcp/pcpngmontexpstuff_avx2.h @@ -41,11 +41,11 @@ /* number of "diSize" chunks in "bitSize" bit string */ -__IPPCP_INLINE int cpDigitNum_avx2(int bitSize, int digSize) +__INLINE int cpDigitNum_avx2(int bitSize, int digSize) { return (bitSize + digSize-1)/digSize; } /* number of "EXP_DIGIT_SIZE_AVX2" chunks in "bitSize" bit string matched for AMM */ -__IPPCP_INLINE cpSize numofVariable_avx2(int modulusBits) +__INLINE cpSize numofVariable_avx2(int modulusBits) { cpSize ammBitSize = 2 + cpDigitNum_avx2(modulusBits, BITSIZE(BNU_CHUNK_T)) * BITSIZE(BNU_CHUNK_T); cpSize redNum = cpDigitNum_avx2(ammBitSize, EXP_DIGIT_SIZE_AVX2); @@ -53,7 +53,7 @@ __IPPCP_INLINE cpSize numofVariable_avx2(int modulusBits) } /* buffer corresponding to numofVariable_avx2() */ -__IPPCP_INLINE cpSize numofVariableBuff_avx2(int numV) +__INLINE cpSize numofVariableBuff_avx2(int numV) { return numV +4; } diff --git a/sources/ippcp/pcpngmontexpstuff_avx512.h b/sources/ippcp/pcpngmontexpstuff_avx512.h index 7ea1ed83..5eb62d3f 100644 --- a/sources/ippcp/pcpngmontexpstuff_avx512.h +++ b/sources/ippcp/pcpngmontexpstuff_avx512.h @@ -39,7 +39,7 @@ #define NUMBER_OF_DIGITS(bitsize, digsize) (((bitsize) + (digsize)-1)/(digsize)) /* number of "EXP_DIGIT_SIZE_AVX512" chunks in "bitSize" bit string matched for AMM */ -__IPPCP_INLINE cpSize numofVariable_avx512(int modulusBits) +__INLINE cpSize numofVariable_avx512(int modulusBits) { cpSize ammBitSize = 2 + NUMBER_OF_DIGITS(modulusBits, BITSIZE(BNU_CHUNK_T)) * BITSIZE(BNU_CHUNK_T); cpSize redNum = NUMBER_OF_DIGITS(ammBitSize, EXP_DIGIT_SIZE_AVX512); @@ -52,7 +52,7 @@ __IPPCP_INLINE cpSize numofVariable_avx512(int modulusBits) * * |regCapacity| is a capacity of a single register in qwords */ -__IPPCP_INLINE int numofVariableBuff_avx512(int len, int regCapacity) +__INLINE int numofVariableBuff_avx512(int len, int regCapacity) { int tail = len % regCapacity; if(0==tail) tail = regCapacity; @@ -65,7 +65,7 @@ __IPPCP_INLINE int numofVariableBuff_avx512(int len, int regCapacity) */ /* pair of 52-bit digits occupys 13 bytes (the fact is using in implementation beloow) */ -__IPPCP_INLINE Ipp64u getDig52(const Ipp8u* pStr, int strLen) +__INLINE Ipp64u getDig52(const Ipp8u* pStr, int strLen) { Ipp64u digit = 0; for(; strLen>0; strLen--) { @@ -109,7 +109,7 @@ static void regular_dig52(Ipp64u* out, int outLen /* in qwords */, const Ipp64u* converts "redundant" (base = 2^DIGIT_SIZE) representation into regular (base = 2^64) */ -__IPPCP_INLINE void putDig52(Ipp8u* pStr, int strLen, Ipp64u digit) +__INLINE void putDig52(Ipp8u* pStr, int strLen, Ipp64u digit) { for(; strLen>0; strLen--) { *pStr++ = (Ipp8u)(digit&0xFF); diff --git a/sources/ippcp/pcpngmontexpstuff_sse2.h b/sources/ippcp/pcpngmontexpstuff_sse2.h index 832b3a4b..46d0b307 100644 --- a/sources/ippcp/pcpngmontexpstuff_sse2.h +++ b/sources/ippcp/pcpngmontexpstuff_sse2.h @@ -41,11 +41,11 @@ /* number of "diSize" chunks in "bitSize" bit string */ -__IPPCP_INLINE int cpDigitNum_sse2(int bitSize, int digSize) +__INLINE int cpDigitNum_sse2(int bitSize, int digSize) { return (bitSize + digSize-1)/digSize; } /* number of "RSA_SSE2_DIGIT_SIZE" chunks in "bitSize" bit string matched for AMM */ -__IPPCP_INLINE cpSize numofVariable_sse2(int modulusBits) +__INLINE cpSize numofVariable_sse2(int modulusBits) { cpSize ammBitSize = 2 + cpDigitNum_sse2(modulusBits, BITSIZE(BNU_CHUNK_T)) * BITSIZE(BNU_CHUNK_T); cpSize redNum = cpDigitNum_sse2(ammBitSize, EXP_DIGIT_SIZE_SSE2); @@ -53,7 +53,7 @@ __IPPCP_INLINE cpSize numofVariable_sse2(int modulusBits) } /* buffer corresponding to numofVariable_sse2() */ -__IPPCP_INLINE cpSize numofVariableBuff_sse2(int numV) +__INLINE cpSize numofVariableBuff_sse2(int numV) { return numV +4 +(numV&1); } diff --git a/sources/ippcp/pcpprng_genhw.h b/sources/ippcp/pcpprng_genhw.h index 5b42b0b2..2f51a9be 100644 --- a/sources/ippcp/pcpprng_genhw.h +++ b/sources/ippcp/pcpprng_genhw.h @@ -14,16 +14,16 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // PRNG Functions -// +// // Contents: // HW random generator -// -// +// +// */ #include "owndefs.h" @@ -36,7 +36,7 @@ #define _PCP_PRN_GEN_HW_H #if ((_IPP>=_IPP_G9) || (_IPP32E>=_IPP32E_E9)) -__IPPCP_INLINE int cpRand_hw_sample(BNU_CHUNK_T* pSample) +__INLINE int cpRand_hw_sample(BNU_CHUNK_T* pSample) { #define LOCAL_COUNTER (8) int n; @@ -54,7 +54,7 @@ __IPPCP_INLINE int cpRand_hw_sample(BNU_CHUNK_T* pSample) } #if (_IPP32E>=_IPP32E_E9) -__IPPCP_INLINE int cpRand_hw_sample32(Ipp32u* pSample) +__INLINE int cpRand_hw_sample32(Ipp32u* pSample) { #define LOCAL_COUNTER (8) int n; @@ -81,7 +81,7 @@ __IPPCP_INLINE int cpRand_hw_sample32(Ipp32u* pSample) // bufLen buffer length *F*/ -__IPPCP_INLINE int cpRandHW_buffer(Ipp32u* pBuffer, int bufLen) +__INLINE int cpRandHW_buffer(Ipp32u* pBuffer, int bufLen) { int nSamples = bufLen/((Ipp32s)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))); diff --git a/sources/ippcp/pcprij128safe.h b/sources/ippcp/pcprij128safe.h index 91a7aba6..5af882a4 100644 --- a/sources/ippcp/pcprij128safe.h +++ b/sources/ippcp/pcprij128safe.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal Safe Rijndael Encrypt, Decrypt -// -// +// +// */ #if !defined(_PCP_RIJ_SAFE_H) @@ -54,7 +54,7 @@ IPP_OWN_DECL (void, TransformComposite2Native, (Ipp8u out[16], const Ipp8u inp[16])) /* add round key operation */ -__IPPCP_INLINE void AddRoundKey(Ipp8u out[16], const Ipp8u inp[16], const Ipp8u rkey[16]) +__INLINE void AddRoundKey(Ipp8u out[16], const Ipp8u inp[16], const Ipp8u rkey[16]) { ((Ipp64u*)out)[0] = ((Ipp64u*)inp)[0] ^ ((Ipp64u*)rkey)[0]; ((Ipp64u*)out)[1] = ((Ipp64u*)inp)[1] ^ ((Ipp64u*)rkey)[1]; @@ -63,7 +63,7 @@ __IPPCP_INLINE void AddRoundKey(Ipp8u out[16], const Ipp8u inp[16], const Ipp8u /* add logs of GF(2^4) elements // the exp table has been build matched for that implementation */ -__IPPCP_INLINE Ipp8u AddLogGF16(Ipp8u loga, Ipp8u logb) +__INLINE Ipp8u AddLogGF16(Ipp8u loga, Ipp8u logb) { //Ipp8u s = loga+logb; //return (s>2*14)? 15 : (s>14)? s-15 : s; @@ -77,7 +77,7 @@ __IPPCP_INLINE Ipp8u AddLogGF16(Ipp8u loga, Ipp8u logb) #define SELECTION_BITS ((sizeof(BNU_CHUNK_T)/sizeof(Ipp8u)) -1) -__IPPCP_INLINE Ipp8u getSboxValue(Ipp8u x) +__INLINE Ipp8u getSboxValue(Ipp8u x) { BNU_CHUNK_T selection = 0; const Ipp8u* SboxEntry = RijEncSbox; diff --git a/sources/ippcp/pcprij128safe2.h b/sources/ippcp/pcprij128safe2.h index 2b90b02a..9f893730 100644 --- a/sources/ippcp/pcprij128safe2.h +++ b/sources/ippcp/pcprij128safe2.h @@ -14,13 +14,13 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal Safe Rijndael Encrypt, Decrypt -// -// +// +// */ #if !defined(_PCP_RIJ_SAFE2_H) @@ -48,7 +48,7 @@ (out)[11] = (inp)[14]; \ (out)[15] = (inp)[15] -__IPPCP_INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) +__INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) { state[0] ^= RoundKey[0]; state[1] ^= RoundKey[1]; @@ -57,13 +57,13 @@ __IPPCP_INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) } // xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b} -__IPPCP_INLINE Ipp32u mask4(Ipp32u x) +__INLINE Ipp32u mask4(Ipp32u x) { x &= 0x80808080; return (Ipp32u)((x<<1) - (x>>7)); } -__IPPCP_INLINE Ipp32u xtime4(Ipp32u x) +__INLINE Ipp32u xtime4(Ipp32u x) { Ipp32u t = (x+x) &0xFEFEFEFE; t ^= mask4(x) & 0x1B1B1B1B; diff --git a/sources/ippcp/pcprij128safedec2pxca.c b/sources/ippcp/pcprij128safedec2pxca.c index bf49d814..8fc6148c 100644 --- a/sources/ippcp/pcprij128safedec2pxca.c +++ b/sources/ippcp/pcprij128safedec2pxca.c @@ -14,17 +14,17 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Decrypt 128-bit data block according to Rijndael // (compact S-box based implementation) -// +// // Contents: // Safe2Decrypt_RIJ128() -// -// +// +// */ #include "owncp.h" @@ -41,7 +41,7 @@ #define SELECTION_BITS ((sizeof(BNU_CHUNK_T)/sizeof(Ipp8u)) -1) #if defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) -__IPPCP_INLINE Ipp8u getInvSboxValue(Ipp8u x) +__INLINE Ipp8u getInvSboxValue(Ipp8u x) { BNU_CHUNK_T selection = 0; const BNU_CHUNK_T* SboxEntry = (BNU_CHUNK_T*)RijDecSbox; @@ -58,7 +58,7 @@ __IPPCP_INLINE Ipp8u getInvSboxValue(Ipp8u x) #else #include "pcpmask_ct.h" -__IPPCP_INLINE Ipp8u getInvSboxValue(Ipp8u x) +__INLINE Ipp8u getInvSboxValue(Ipp8u x) { BNU_CHUNK_T selection = 0; const BNU_CHUNK_T* SboxEntry = (BNU_CHUNK_T*)RijDecSbox; @@ -74,21 +74,21 @@ __IPPCP_INLINE Ipp8u getInvSboxValue(Ipp8u x) } #endif -__IPPCP_INLINE void invSubBytes(Ipp8u state[]) +__INLINE void invSubBytes(Ipp8u state[]) { int i; for(i=0;i<16;i++) state[i] = getInvSboxValue(state[i]); } -__IPPCP_INLINE void invShiftRows(Ipp32u* state) +__INLINE void invShiftRows(Ipp32u* state) { state[1] = ROR32(state[1], 24); state[2] = ROR32(state[2], 16); state[3] = ROR32(state[3], 8); } -__IPPCP_INLINE void invMixColumns(Ipp32u* state) +__INLINE void invMixColumns(Ipp32u* state) { Ipp32u y0 = state[1] ^ state[2] ^ state[3]; Ipp32u y1 = state[0] ^ state[2] ^ state[3]; diff --git a/sources/ippcp/pcprij128safeenc2pxca.c b/sources/ippcp/pcprij128safeenc2pxca.c index ef083f7d..73b57c4b 100644 --- a/sources/ippcp/pcprij128safeenc2pxca.c +++ b/sources/ippcp/pcprij128safeenc2pxca.c @@ -14,17 +14,17 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Encrypt 128-bit data block according to Rijndael // (compact S-box based implementation) -// +// // Contents: // Safe2Encrypt_RIJ128() -// -// +// +// */ #include "owncp.h" @@ -37,7 +37,7 @@ #include "pcprij128safe2.h" #include "pcprijtables.h" -__IPPCP_INLINE void SubBytes(Ipp8u state[]) +__INLINE void SubBytes(Ipp8u state[]) { int i; for(i=0;i<16;i++) { @@ -46,7 +46,7 @@ __IPPCP_INLINE void SubBytes(Ipp8u state[]) } -__IPPCP_INLINE void ShiftRows(Ipp32u* state) +__INLINE void ShiftRows(Ipp32u* state) { state[1] = ROR32(state[1], 8); state[2] = ROR32(state[2], 16); @@ -54,7 +54,7 @@ __IPPCP_INLINE void ShiftRows(Ipp32u* state) } // MixColumns4 function mixes the columns of the state matrix -__IPPCP_INLINE void MixColumns(Ipp32u* state) +__INLINE void MixColumns(Ipp32u* state) { Ipp32u y0 = state[1] ^ state[2] ^ state[3]; Ipp32u y1 = state[0] ^ state[2] ^ state[3]; diff --git a/sources/ippcp/pcprij128safeencpxca.c b/sources/ippcp/pcprij128safeencpxca.c index abaae489..0b1191b2 100644 --- a/sources/ippcp/pcprij128safeencpxca.c +++ b/sources/ippcp/pcprij128safeencpxca.c @@ -14,17 +14,17 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Encrypt 128-bit data block according to Rijndael // (It's the special free from Sbox/tables implementation) -// +// // Contents: // SafeEncrypt_RIJ128() -// -// +// +// */ #include "owncp.h" @@ -261,7 +261,7 @@ static void FwdSubByte(Ipp8u blk[16]) /* inplace ShifttRows operation */ /* int ShiftRowsInx[] = {0,5,10,15, 4,9,14,3, 8,13,2,7, 12,1,6,11}; */ -__IPPCP_INLINE void FwdShiftRows(Ipp8u blk[16]) +__INLINE void FwdShiftRows(Ipp8u blk[16]) { Ipp8u x = blk[1]; blk[1] = blk[5]; diff --git a/sources/ippcp/pcprijkeysca.c b/sources/ippcp/pcprijkeysca.c index 10daf549..02e84b70 100644 --- a/sources/ippcp/pcprijkeysca.c +++ b/sources/ippcp/pcprijkeysca.c @@ -157,7 +157,7 @@ static const Ipp32u RconTbl[] = { // ^(tbl)[2][ EBYTE((x),2) ] \ // ^(tbl)[3][ EBYTE((x),3) ] ) -__IPPCP_INLINE Ipp32u InvMixColumn(Ipp32u x) +__INLINE Ipp32u InvMixColumn(Ipp32u x) { Ipp32u x_mul_2 = xtime4(x); Ipp32u x_mul_4 = xtime4(x_mul_2); diff --git a/sources/ippcp/pcprsa_pkcs1v15_preproc.h b/sources/ippcp/pcprsa_pkcs1v15_preproc.h index b121b15c..10cc9dd3 100644 --- a/sources/ippcp/pcprsa_pkcs1v15_preproc.h +++ b/sources/ippcp/pcprsa_pkcs1v15_preproc.h @@ -18,7 +18,7 @@ #include "pcphash_rmf.h" // Check all the ippsRSASign_PKCS1v15_rmf parameters and align pPrvKey, pPubKey pointers -__IPPCP_INLINE IppStatus SingleSignPkcs1v15RmfPreproc(const Ipp8u* pMsg, int msgLen, +__INLINE IppStatus SingleSignPkcs1v15RmfPreproc(const Ipp8u* pMsg, int msgLen, Ipp8u* pSign, const IppsRSAPrivateKeyState** pPrvKey, const IppsRSAPublicKeyState** pPubKey, @@ -49,7 +49,7 @@ __IPPCP_INLINE IppStatus SingleSignPkcs1v15RmfPreproc(const Ipp8u* pMsg, int msg } // Check all the ippsRSAVerify_PKCS1v15_rmf parameters, set valid=0, align pKey pointer -__IPPCP_INLINE IppStatus SingleVerifyPkcs1v15RmfPreproc(const Ipp8u* pMsg, int msgLen, +__INLINE IppStatus SingleVerifyPkcs1v15RmfPreproc(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState** pKey, const IppsHashMethod* pMethod, diff --git a/sources/ippcp/pcprsa_pss_preproc.h b/sources/ippcp/pcprsa_pss_preproc.h index bce8c55f..ebb1239f 100644 --- a/sources/ippcp/pcprsa_pss_preproc.h +++ b/sources/ippcp/pcprsa_pss_preproc.h @@ -18,7 +18,7 @@ #include "pcphash_rmf.h" // Check all the ippsRSASign_PSS_rmf parameters and align pPrvKey, pPubKey pointers -__IPPCP_INLINE IppStatus SingleSignPssRmfPreproc(const Ipp8u* pMsg, int msgLen, +__INLINE IppStatus SingleSignPssRmfPreproc(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSalt, int saltLen, Ipp8u* pSign, const IppsRSAPrivateKeyState** pPrvKey, @@ -53,7 +53,7 @@ __IPPCP_INLINE IppStatus SingleSignPssRmfPreproc(const Ipp8u* pMsg, int msgLen, } // Check all the ippsRSAVerify_PSS_rmf parameters, set valid=0, align pKey pointer -__IPPCP_INLINE IppStatus SingleVerifyPssRmfPreproc(const Ipp8u* pMsg, int msgLen, +__INLINE IppStatus SingleVerifyPssRmfPreproc(const Ipp8u* pMsg, int msgLen, const Ipp8u* pSign, int* pIsValid, const IppsRSAPublicKeyState** pKey, diff --git a/sources/ippcp/pcpscramble.h b/sources/ippcp/pcpscramble.h index fa5bef66..7bbe2014 100644 --- a/sources/ippcp/pcpscramble.h +++ b/sources/ippcp/pcpscramble.h @@ -14,17 +14,17 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Fixed window exponentiation scramble/unscramble -// +// // Contents: // cpScramblePut() // cpScrambleGet() -// -// +// +// */ #if !defined(_PC_SCRAMBLE_H) @@ -35,7 +35,7 @@ // stores to/retrieves from pScrambleEntry position // pre-computed data if fixed window method is used */ -__IPPCP_INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, +__INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, const Ipp32u* pData, cpSize dataSize) { int i; @@ -107,7 +107,7 @@ __IPPCP_INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, ((x) = (Ipp64u)(dw0), \ (x)|= (((Ipp64u)(dw1))<<32)) -__IPPCP_INLINE void cpScrambleGet(Ipp32u* pData, cpSize dataSize, +__INLINE void cpScrambleGet(Ipp32u* pData, cpSize dataSize, const Ipp8u* pArray, cpSize colummSize) { int i; diff --git a/sources/ippcp/pcpsha256stuff.h b/sources/ippcp/pcpsha256stuff.h index a3c94f46..622b8083 100644 --- a/sources/ippcp/pcpsha256stuff.h +++ b/sources/ippcp/pcpsha256stuff.h @@ -14,12 +14,12 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Digesting message according to SHA256 -// +// // Contents: // ippsSHA256GetSize() // ippsSHA256Init() @@ -30,8 +30,8 @@ // ippsSHA256GetTag() // ippsSHA256Final() // ippsSHA256MessageDigest() -// -// +// +// */ #include "owndefs.h" @@ -71,7 +71,7 @@ static __ALIGN16 const Ipp32u sha256_cnt[] = { /* setup init hash value */ -__IPPCP_INLINE void hashInit(Ipp32u* pHash, const Ipp32u* iv) +__INLINE void hashInit(Ipp32u* pHash, const Ipp32u* iv) { pHash[0] = iv[0]; pHash[1] = iv[1]; diff --git a/sources/ippcp/pcpsha512stuff.h b/sources/ippcp/pcpsha512stuff.h index 8d4865f1..8d2182dd 100644 --- a/sources/ippcp/pcpsha512stuff.h +++ b/sources/ippcp/pcpsha512stuff.h @@ -14,16 +14,16 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // SHA512 message digest -// +// // Contents: // SHA512 stuff -// -// +// +// */ #include "owndefs.h" @@ -81,7 +81,7 @@ static __ALIGN16 const Ipp64u sha512_cnt[] = { }; /* setup init hash value */ -__IPPCP_INLINE void hashInit(Ipp64u* pHash, const Ipp64u* iv) +__INLINE void hashInit(Ipp64u* pHash, const Ipp64u* iv) { pHash[0] = iv[0]; pHash[1] = iv[1]; @@ -177,7 +177,7 @@ IPP_OWN_DEFN (static void, cpFinalizeSHA512, (DigestSHA512 pHash, const Ipp8u* i { /* local buffer and it length */ Ipp8u buffer[MBS_SHA512*2]; - int bufferLen = inpLen < (MBS_SHA512-(int)MLR_SHA512)? MBS_SHA512 : MBS_SHA512*2; + int bufferLen = inpLen < (MBS_SHA512-(int)MLR_SHA512)? MBS_SHA512 : MBS_SHA512*2; /* copy rest of message into internal buffer */ CopyBlock(inpBuffer, buffer, inpLen); diff --git a/sources/ippcp/pcpsms4.h b/sources/ippcp/pcpsms4.h index c18b5bfb..d6cef0f5 100644 --- a/sources/ippcp/pcpsms4.h +++ b/sources/ippcp/pcpsms4.h @@ -14,14 +14,14 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // Internal Definitions and // Internal SMS4 Function Prototypes -// -// +// +// */ #if !defined(_PCP_SMS4_H) @@ -65,7 +65,7 @@ struct _cpSMS4 { #define SMS4_ALIGNMENT (4) /* size of SMS4 context */ -__IPPCP_INLINE int cpSizeofCtx_SMS4(void) +__INLINE int cpSizeofCtx_SMS4(void) { return sizeof(IppsSMS4Spec); } @@ -81,7 +81,7 @@ extern const Ipp32u SMS4_CK[32]; #include "pcpbnuimpl.h" #define SELECTION_BITS ((sizeof(BNU_CHUNK_T)/sizeof(Ipp8u)) -1) -__IPPCP_INLINE Ipp8u getSboxValue(Ipp8u x) +__INLINE Ipp8u getSboxValue(Ipp8u x) { BNU_CHUNK_T selection = 0; const Ipp8u* SboxEntry = SMS4_Sbox; @@ -94,7 +94,7 @@ __IPPCP_INLINE Ipp8u getSboxValue(Ipp8u x) return (Ipp8u)(selection & 0xFF); } -__IPPCP_INLINE Ipp32u cpSboxT_SMS4(Ipp32u x) +__INLINE Ipp32u cpSboxT_SMS4(Ipp32u x) { Ipp32u y = getSboxValue(x & 0xFF); y |= (Ipp32u)(getSboxValue((x>> 8) & 0xFF) <<8); @@ -107,12 +107,12 @@ __IPPCP_INLINE Ipp32u cpSboxT_SMS4(Ipp32u x) - linear Linear - mixer Mix (permutation T in the SMS4 standard phraseology) */ -__IPPCP_INLINE Ipp32u cpExpKeyLinear_SMS4(Ipp32u x) +__INLINE Ipp32u cpExpKeyLinear_SMS4(Ipp32u x) { return x^ROL32(x,13)^ROL32(x,23); } -__IPPCP_INLINE Ipp32u cpExpKeyMix_SMS4(Ipp32u x) +__INLINE Ipp32u cpExpKeyMix_SMS4(Ipp32u x) { return cpExpKeyLinear_SMS4( cpSboxT_SMS4(x) ); } @@ -121,12 +121,12 @@ __IPPCP_INLINE Ipp32u cpExpKeyMix_SMS4(Ipp32u x) - linear Linear - mixer Mix (permutation T in the SMS4 standard phraseology) */ -__IPPCP_INLINE Ipp32u cpCipherLinear_SMS4(Ipp32u x) +__INLINE Ipp32u cpCipherLinear_SMS4(Ipp32u x) { return x^ROL32(x,2)^ROL32(x,10)^ROL32(x,18)^ROL32(x,24); } -__IPPCP_INLINE Ipp32u cpCipherMix_SMS4(Ipp32u x) +__INLINE Ipp32u cpCipherMix_SMS4(Ipp32u x) { return cpCipherLinear_SMS4( cpSboxT_SMS4(x) ); } diff --git a/sources/ippcp/pcpsms4_ctr_gfni.c b/sources/ippcp/pcpsms4_ctr_gfni.c index e1520f17..623db2ea 100644 --- a/sources/ippcp/pcpsms4_ctr_gfni.c +++ b/sources/ippcp/pcpsms4_ctr_gfni.c @@ -64,7 +64,7 @@ static __ALIGN16 Ipp8u next_inc[] = {4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, static __ALIGN16 Ipp8u one128[] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -__IPPCP_INLINE __m512i inc512(__m512i x, Ipp8u* increment) +__INLINE __m512i inc512(__m512i x, Ipp8u* increment) { __m512i t = _mm512_add_epi64(x, M512(increment)); __mmask8 carryMask = _mm512_cmplt_epu64_mask(t, x); @@ -74,7 +74,7 @@ __IPPCP_INLINE __m512i inc512(__m512i x, Ipp8u* increment) return t; } -__IPPCP_INLINE __m128i inc128(__m128i x) +__INLINE __m128i inc128(__m128i x) { __m128i t = _mm_add_epi64(x, M128(one128)); x = _mm_cmpeq_epi64(t, _mm_setzero_si128()); diff --git a/sources/ippcp/pcpsms4ctrl9cn.c b/sources/ippcp/pcpsms4ctrl9cn.c index a81d1060..4cf951a4 100644 --- a/sources/ippcp/pcpsms4ctrl9cn.c +++ b/sources/ippcp/pcpsms4ctrl9cn.c @@ -46,7 +46,7 @@ static __ALIGN32 Ipp8u two256[] = {2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, static __ALIGN16 Ipp8u one256[] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -__IPPCP_INLINE __m128i inc128(__m128i x) +__INLINE __m128i inc128(__m128i x) { __m128i t = _mm_add_epi64(x, M128(one256)); x = _mm_cmpeq_epi64(t, _mm_setzero_si128()); @@ -54,14 +54,14 @@ __IPPCP_INLINE __m128i inc128(__m128i x) return t; } -__IPPCP_INLINE __m256i inc256(__m256i x) +__INLINE __m256i inc256(__m256i x) { __m256i t = _mm256_add_epi64(x, M256(two256)); x = _mm256_cmpeq_epi64(t, _mm256_setzero_si256()); t = _mm256_sub_epi64(t, _mm256_slli_si256(x, sizeof(Ipp64u))); return t; } -__IPPCP_INLINE __m256i inc256_2(__m256i x) +__INLINE __m256i inc256_2(__m256i x) { __m256i t = _mm256_add_epi64(x, M256(one256)); x = _mm256_cmpeq_epi64(t, _mm256_setzero_si256()); diff --git a/sources/ippcp/pcpsms4ctry8cn.c b/sources/ippcp/pcpsms4ctry8cn.c index d94a0263..bc3041db 100644 --- a/sources/ippcp/pcpsms4ctry8cn.c +++ b/sources/ippcp/pcpsms4ctry8cn.c @@ -39,7 +39,7 @@ static __ALIGN16 Ipp8u one128[] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static __ALIGN16 Ipp8u endianness[] = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0}; static __ALIGN16 Ipp8u endianness_swap[] = {12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3}; -__IPPCP_INLINE __m128i inc128(__m128i x) +__INLINE __m128i inc128(__m128i x) { __m128i t = _mm_add_epi64(x, M128(one128)); x = _mm_cmpeq_epi64(t, _mm_setzero_si128()); diff --git a/sources/ippcp/pcpsms4ecb_setkeysy8cn.c b/sources/ippcp/pcpsms4ecb_setkeysy8cn.c index 0eae0065..53f5b207 100644 --- a/sources/ippcp/pcpsms4ecb_setkeysy8cn.c +++ b/sources/ippcp/pcpsms4ecb_setkeysy8cn.c @@ -14,16 +14,16 @@ * limitations under the License. *************************************************************************/ -/* -// +/* +// // Purpose: // Cryptography Primitive. // SMS4 ECB encryption/decryption -// +// // Contents: // cpSMS4_SetRoundKeys_aesni() -// -// +// +// */ #include "owndefs.h" @@ -35,7 +35,7 @@ #include "pcpsms4_y8cn.h" -__IPPCP_INLINE __m128i Ltag(__m128i x) +__INLINE __m128i Ltag(__m128i x) { __m128i T = _mm_slli_epi32(x, 13); T = _mm_xor_si128(T, _mm_srli_epi32 (x,19)); diff --git a/sources/ippcp/pcptool.h b/sources/ippcp/pcptool.h index e1ba659b..3680cc85 100644 --- a/sources/ippcp/pcptool.h +++ b/sources/ippcp/pcptool.h @@ -32,7 +32,7 @@ #define _NEW_XOR16_ /* copy data block */ -__IPPCP_INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) +__INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) { const Ipp8u* s = (Ipp8u*)pSrc; Ipp8u* d = (Ipp8u*)pDst; @@ -41,7 +41,7 @@ __IPPCP_INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) d[k] = s[k]; } -__IPPCP_INLINE void CopyBlock8(const void* pSrc, void* pDst) +__INLINE void CopyBlock8(const void* pSrc, void* pDst) { int k; for(k=0; k<8; k++ ) @@ -52,13 +52,13 @@ __IPPCP_INLINE void CopyBlock8(const void* pSrc, void* pDst) #define CopyBlock16 OWNAPI(CopyBlock16) IPP_OWN_DECL (void, CopyBlock16, (const void* pSrc, void* pDst)) -__IPPCP_INLINE void CopyBlock24(const void* pSrc, void* pDst) +__INLINE void CopyBlock24(const void* pSrc, void* pDst) { int k; for(k=0; k<24; k++ ) ((Ipp8u*)pDst)[k] = ((Ipp8u*)pSrc)[k]; } -__IPPCP_INLINE void CopyBlock32(const void* pSrc, void* pDst) +__INLINE void CopyBlock32(const void* pSrc, void* pDst) { int k; for(k=0; k<32; k++ ) @@ -68,7 +68,7 @@ __IPPCP_INLINE void CopyBlock32(const void* pSrc, void* pDst) /* // padding data block */ -__IPPCP_INLINE void PadBlock(Ipp8u paddingByte, void* pDst, cpSize numBytes) +__INLINE void PadBlock(Ipp8u paddingByte, void* pDst, cpSize numBytes) { Ipp8u* d = (Ipp8u*)pDst; cpSize k; @@ -77,7 +77,7 @@ __IPPCP_INLINE void PadBlock(Ipp8u paddingByte, void* pDst, cpSize numBytes) } #if !((_IPP>=_IPP_W7) || (_IPP32E>=_IPP32E_M7)) -__IPPCP_INLINE void PurgeBlock(void* pDst, int len) +__INLINE void PurgeBlock(void* pDst, int len) { int n; for(n=0; n> (blkBitSize -numSize)%8 ); @@ -193,7 +193,7 @@ __IPPCP_INLINE void StdIncrement(Ipp8u* pCounter, int blkBitSize, int numSize) } /* vb */ -__IPPCP_INLINE void ompStdIncrement64( void* pInitCtrVal, void* pCurrCtrVal, +__INLINE void ompStdIncrement64( void* pInitCtrVal, void* pCurrCtrVal, int ctrNumBitSize, int n ) { int k; @@ -247,7 +247,7 @@ __IPPCP_INLINE void ompStdIncrement64( void* pInitCtrVal, void* pCurrCtrVal, /* vb */ -__IPPCP_INLINE void ompStdIncrement128( void* pInitCtrVal, void* pCurrCtrVal, +__INLINE void ompStdIncrement128( void* pInitCtrVal, void* pCurrCtrVal, int ctrNumBitSize, int n ) { int k; @@ -342,7 +342,7 @@ __IPPCP_INLINE void ompStdIncrement128( void* pInitCtrVal, void* pCurrCtrVal, #if 0 /* vb */ -__IPPCP_INLINE void ompStdIncrement192( void* pInitCtrVal, void* pCurrCtrVal, +__INLINE void ompStdIncrement192( void* pInitCtrVal, void* pCurrCtrVal, int ctrNumBitSize, int n ) { int k; @@ -468,7 +468,7 @@ __IPPCP_INLINE void ompStdIncrement192( void* pInitCtrVal, void* pCurrCtrVal, #if 0 /* vb */ -__IPPCP_INLINE void ompStdIncrement256( void* pInitCtrVal, void* pCurrCtrVal, +__INLINE void ompStdIncrement256( void* pInitCtrVal, void* pCurrCtrVal, int ctrNumBitSize, int n ) { int k; diff --git a/sources/ippcp/sm2/ifma_arith_nsm2.c b/sources/ippcp/sm2/ifma_arith_nsm2.c index d6ba6a63..be0fa375 100644 --- a/sources/ippcp/sm2/ifma_arith_nsm2.c +++ b/sources/ippcp/sm2/ifma_arith_nsm2.c @@ -183,12 +183,12 @@ IPP_OWN_DEFN(fesm2, fesm2_from_mont_norder, (const fesm2 a)) { return r; } -__IPPCP_INLINE fesm2 mul_norder_norm(const fesm2 a, const fesm2 b) { +__INLINE fesm2 mul_norder_norm(const fesm2 a, const fesm2 b) { const fesm2 r = fesm2_mul_norder(a, b); return ifma_lnorm52(r); } -__IPPCP_INLINE fesm2 sqr_norder_norm(const fesm2 a) { +__INLINE fesm2 sqr_norder_norm(const fesm2 a) { const fesm2 r = fesm2_mul_norder(a, a); return ifma_lnorm52(r); } diff --git a/sources/ippcp/sm2/ifma_arith_psm2.c b/sources/ippcp/sm2/ifma_arith_psm2.c index 84950a63..127da410 100644 --- a/sources/ippcp/sm2/ifma_arith_psm2.c +++ b/sources/ippcp/sm2/ifma_arith_psm2.c @@ -246,12 +246,12 @@ IPP_OWN_DEFN(fesm2, fesm2_from_mont, (const fesm2 a)) { return r; } -__IPPCP_INLINE fesm2 fesm2_mul_norm(const fesm2 a, const fesm2 b) { +__INLINE fesm2 fesm2_mul_norm(const fesm2 a, const fesm2 b) { fesm2 r = fesm2_mul(a, b); return ifma_lnorm52(r); } -__IPPCP_INLINE fesm2 fesm2_sqr_norm(const fesm2 a) { +__INLINE fesm2 fesm2_sqr_norm(const fesm2 a) { fesm2 r = fesm2_sqr(a); return ifma_lnorm52(r); } @@ -262,7 +262,7 @@ __IPPCP_INLINE fesm2 fesm2_sqr_norm(const fesm2 a) { fesm2_mul_dual(&(R1), (A1), (B1), &(R2), (A2), (B2)); \ ifma_lnorm52_dual(&(R1), (R1), &(R2), (R2)); -__IPPCP_INLINE fesm2 fesm2_sqr_ntimes(const fesm2 a, int n) { +__INLINE fesm2 fesm2_sqr_ntimes(const fesm2 a, int n) { fesm2 r = a; for (; n > 0; --n) sqr(r, r); diff --git a/sources/ippcp/sm2/ifma_arith_psm2.h b/sources/ippcp/sm2/ifma_arith_psm2.h index f84e43a9..18dde980 100644 --- a/sources/ippcp/sm2/ifma_arith_psm2.h +++ b/sources/ippcp/sm2/ifma_arith_psm2.h @@ -62,7 +62,7 @@ IPP_OWN_DECL(fesm2, fesm2_mul, (const fesm2 a, const fesm2 b)) * \param[in] a value (in radix 2^52) * \return fesm2 not normalization value */ -__IPPCP_INLINE IPP_OWN_DEFN(fesm2, fesm2_sqr, (const fesm2 a)) { +__INLINE IPP_OWN_DEFN(fesm2, fesm2_sqr, (const fesm2 a)) { return fesm2_mul(a, a); } @@ -98,7 +98,7 @@ IPP_OWN_DECL(void, fesm2_mul_dual, (fesm2 pr1[], const fesm2 a1, const fesm2 b1, * \param[out] pr2 ptr second value no normalization * \param[in] a2 value (in radix 2^52) */ -__IPPCP_INLINE IPP_OWN_DEFN(void, fesm2_sqr_dual, (fesm2 pr1[], const fesm2 a1, fesm2 pr2[], const fesm2 a2)) { +__INLINE IPP_OWN_DEFN(void, fesm2_sqr_dual, (fesm2 pr1[], const fesm2 a1, fesm2 pr2[], const fesm2 a2)) { fesm2_mul_dual(pr1, a1, a1, pr2, a2, a2); return; } diff --git a/sources/ippcp/sm2/ifma_defs_sm2.h b/sources/ippcp/sm2/ifma_defs_sm2.h index a469d28d..3b7c29eb 100644 --- a/sources/ippcp/sm2/ifma_defs_sm2.h +++ b/sources/ippcp/sm2/ifma_defs_sm2.h @@ -50,7 +50,7 @@ static const __ALIGN64 Ipp64u PSM2_R[PSM2_LEN52] = { * 0xFF - is equal one * 0x00 - is no equal one */ -__IPPCP_INLINE mask8 sm2_is_msb(const mask8 a) { +__INLINE mask8 sm2_is_msb(const mask8 a) { return (mask8)((mask8)0 - (a >> 7)); } @@ -62,7 +62,7 @@ __IPPCP_INLINE mask8 sm2_is_msb(const mask8 a) { * 0xFF - is zero value * 0x00 - no equal zero */ -__IPPCP_INLINE mask8 sm2_is_zero_i64(const m512 a) { +__INLINE mask8 sm2_is_zero_i64(const m512 a) { const mask8 mask = cmp_i64_mask(a, setzero_i64(), _MM_CMPINT_NE); return sm2_is_msb((~mask & (mask - 1))); } diff --git a/sources/ippcp/sm2/ifma_ecpoint_sm2.c b/sources/ippcp/sm2/ifma_ecpoint_sm2.c index f4048113..c809c767 100644 --- a/sources/ippcp/sm2/ifma_ecpoint_sm2.c +++ b/sources/ippcp/sm2/ifma_ecpoint_sm2.c @@ -38,7 +38,7 @@ static const __ALIGN64 Ipp64u psm2_x8[PSM2_LEN52] = { 0x000ffffffffffff8, 0x000f800000007fff, 0x000fffffffffffff, 0x000fffffffffffff, 0x0007fffffff7ffff}; /* Mont(a) = a*r mod psm2, where r = 2^(6*52) mod psm2 */ -static const __ALIGN64 Ipp64u psm2_a[PSM2_LEN52] = { +static const __ALIGN64 Ipp64u psm2_a[PSM2_LEN52] = { 0x000ffffffcffffff, 0x000ff03000000fcf, 0x000cffffffffffff, 0x000fffffffffffff, 0x0000fcfffffeffff}; /* Mont(b) = b*r mod psm2, where r = 2^(6*52) mod psm2 */ @@ -502,7 +502,7 @@ static __NOINLINE void clear_secret_context(Ipp16u* wval, return; } -__IPPCP_INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) { +__INLINE mask8 is_eq_mask(const Ipp32s a, const Ipp32s b) { const Ipp32s eq = a ^ b; const Ipp32s v = ~eq & (eq - 1); const Ipp32s msb = 0 - (v >> (sizeof(a) * 8 - 1)); @@ -649,7 +649,7 @@ IPP_OWN_DEFN(void, gesm2_mul, (PSM2_POINT_IFMA * r, const PSM2_POINT_IFMA* p, co #define BP_WIN_SIZE BASE_POINT_WIN_SIZE #define BP_N_ENTRY BASE_POINT_N_ENTRY -__IPPCP_INLINE void extract_point_affine(PSM2_AFFINE_POINT_IFMA* r, +__INLINE void extract_point_affine(PSM2_AFFINE_POINT_IFMA* r, const SINGLE_PSM2_AFFINE_POINT_IFMA* tbl, const Ipp32s digit) { const Ipp32s idx = digit - 1; diff --git a/sources/ippcp/sm2/ifma_ecpoint_sm2.h b/sources/ippcp/sm2/ifma_ecpoint_sm2.h index 8f325659..2a9dab66 100644 --- a/sources/ippcp/sm2/ifma_ecpoint_sm2.h +++ b/sources/ippcp/sm2/ifma_ecpoint_sm2.h @@ -134,7 +134,7 @@ IPP_OWN_DECL(void, gesm2_select_ap_w7_ifma, (BNU_CHUNK_T * pAffinePoint, const B #include "pcpgfpstuff.h" #include "pcpgfpecstuff.h" -__IPPCP_INLINE void recode_point_to_mont52(PSM2_POINT_IFMA* pR, +__INLINE void recode_point_to_mont52(PSM2_POINT_IFMA* pR, const BNU_CHUNK_T* pP, BNU_CHUNK_T* pPool, ifmaArithMethod* method, @@ -161,7 +161,7 @@ __IPPCP_INLINE void recode_point_to_mont52(PSM2_POINT_IFMA* pR, pR->z = p_to_mont(pR->z); } -__IPPCP_INLINE void recode_point_to_mont64(IppsGFpECPoint* pR, +__INLINE void recode_point_to_mont64(IppsGFpECPoint* pR, PSM2_POINT_IFMA* pP, BNU_CHUNK_T* pPool, ifmaArithMethod* method, diff --git a/sources/ippcp/sm2/ifma_sm2_key_exchange_shared_key.c b/sources/ippcp/sm2/ifma_sm2_key_exchange_shared_key.c index a8f03c28..28e82729 100644 --- a/sources/ippcp/sm2/ifma_sm2_key_exchange_shared_key.c +++ b/sources/ippcp/sm2/ifma_sm2_key_exchange_shared_key.c @@ -26,7 +26,7 @@ /* clang-format off */ -__IPPCP_INLINE void ifma_sm2_set_affine_point_radix52(PSM2_POINT_IFMA *rp, +__INLINE void ifma_sm2_set_affine_point_radix52(PSM2_POINT_IFMA *rp, const BNU_CHUNK_T *x, const BNU_CHUNK_T *y, ifmaArithMethod *method) /* clang-format on */ @@ -45,7 +45,7 @@ __IPPCP_INLINE void ifma_sm2_set_affine_point_radix52(PSM2_POINT_IFMA *rp, } /* clang-format off */ -__IPPCP_INLINE void ifma_sm2_get_affine(BNU_CHUNK_T *x, BNU_CHUNK_T *y, +__INLINE void ifma_sm2_get_affine(BNU_CHUNK_T *x, BNU_CHUNK_T *y, const PSM2_POINT_IFMA* p, ifmaArithMethod* method) /* clang-format on */ diff --git a/sources/ippcp/sm2/sm2_stuff.c b/sources/ippcp/sm2/sm2_stuff.c index 0da31f65..8eb5fc04 100644 --- a/sources/ippcp/sm2/sm2_stuff.c +++ b/sources/ippcp/sm2/sm2_stuff.c @@ -51,7 +51,7 @@ IPP_OWN_DEFN(IppStatus, computeZa_user_id_hash_sm2, (Ipp8u * pZa_digest, IPP_BAD_PTR2_RET(pZa_digest, p_user_id); /* check border (user_id_len > 0) | (elem_len > 0) */ IPP_BADARG_RET(!(user_id_len > 0) || !(elem_len > 0), ippStsBadArgErr); - /* check (user_id_len*8 <= 0xFFFF) ~ (user_id_len <= 0x1FFF) for two bytes overflow. + /* check (user_id_len*8 <= 0xFFFF) ~ (user_id_len <= 0x1FFF) for two bytes overflow. user_id_len*8 operation will be executed in algorithm's flow */ IPP_BADARG_RET(user_id_len > 0x1FFF, ippStsBadArgErr); /* param curve: a, b, Gx, Gy */ @@ -97,7 +97,7 @@ IPP_OWN_DEFN(IppStatus, computeZa_user_id_hash_sm2, (Ipp8u * pZa_digest, #define SIZE_CT (4) -__IPPCP_INLINE void convert_ct_to_big_endian(Ipp8u pCt[SIZE_CT], const Ipp32u ct) +__INLINE void convert_ct_to_big_endian(Ipp8u pCt[SIZE_CT], const Ipp32u ct) { pCt[0] = (Ipp8u)(ct >> 24); pCt[1] = (Ipp8u)(ct >> 16); diff --git a/sources/ippcp/sm2/sm2_stuff.h b/sources/ippcp/sm2/sm2_stuff.h index ccef5ed6..f0ab23ad 100644 --- a/sources/ippcp/sm2/sm2_stuff.h +++ b/sources/ippcp/sm2/sm2_stuff.h @@ -46,7 +46,7 @@ * @param[in out] arr array data * @param[in] len length array */ -__IPPCP_INLINE void cpSM2KE_reverse_inplace(Ipp8u *arr, const int len) +__INLINE void cpSM2KE_reverse_inplace(Ipp8u *arr, const int len) { #define SWAPXOR(x, y) \ (x) ^= (y); \ @@ -68,7 +68,7 @@ __IPPCP_INLINE void cpSM2KE_reverse_inplace(Ipp8u *arr, const int len) * @param[in] p point copy * @param[in] pEC context Elliptic Curve */ -__IPPCP_INLINE void cpSM2KE_CopyPointData(IppsGFpECPoint *r, BNU_CHUNK_T *data, const IppsGFpECPoint *p, const IppsGFpECState *pEC) +__INLINE void cpSM2KE_CopyPointData(IppsGFpECPoint *r, BNU_CHUNK_T *data, const IppsGFpECPoint *p, const IppsGFpECState *pEC) { ECP_POINT_SET_ID(r); cpEcGFpInitPoint(r, data, ECP_POINT_FLAGS(p), pEC); @@ -86,7 +86,7 @@ __IPPCP_INLINE void cpSM2KE_CopyPointData(IppsGFpECPoint *r, BNU_CHUNK_T *data, * @param[in] a value x * @param[in] pEC context Elliptic Curve */ -__IPPCP_INLINE void cpSM2KE_reduction_x2w(BNU_CHUNK_T *r, const BNU_CHUNK_T *a, const IppsGFpECState *pEC) +__INLINE void cpSM2KE_reduction_x2w(BNU_CHUNK_T *r, const BNU_CHUNK_T *a, const IppsGFpECState *pEC) { const gsModEngine *pME = GFP_PMA(ECP_GFP(pEC)); @@ -107,7 +107,7 @@ __IPPCP_INLINE void cpSM2KE_reduction_x2w(BNU_CHUNK_T *r, const BNU_CHUNK_T *a, } /* clang-format off */ -__IPPCP_INLINE void cpSM2KE_get_affine_ext_euclid(BNU_CHUNK_T *x, BNU_CHUNK_T *y, +__INLINE void cpSM2KE_get_affine_ext_euclid(BNU_CHUNK_T *x, BNU_CHUNK_T *y, const IppsGFpECPoint *p, IppsGFpECState *pEC) /* clang-format on */ @@ -120,7 +120,7 @@ __IPPCP_INLINE void cpSM2KE_get_affine_ext_euclid(BNU_CHUNK_T *x, BNU_CHUNK_T *y return; } -__IPPCP_INLINE void cpSM2KE_xy_to_BE(BNU_CHUNK_T *x, BNU_CHUNK_T *y, const IppsGFpECState *pEC) +__INLINE void cpSM2KE_xy_to_BE(BNU_CHUNK_T *x, BNU_CHUNK_T *y, const IppsGFpECState *pEC) { const gsModEngine *pME = GFP_PMA(ECP_GFP(pEC)); @@ -139,7 +139,7 @@ __IPPCP_INLINE void cpSM2KE_xy_to_BE(BNU_CHUNK_T *x, BNU_CHUNK_T *y, const IppsG * @param[in] a hashing an array data * @param[in] numBytes number of bytes */ -__IPPCP_INLINE void cpSM2KE_compute_hash_SM3(Ipp8u *r, const Ipp8u *a, const int numBytes) +__INLINE void cpSM2KE_compute_hash_SM3(Ipp8u *r, const Ipp8u *a, const int numBytes) { static IppsHashState_rmf ctx; diff --git a/tools/ipp_custom_library_tool_python/gui/settings_panel.py b/tools/ipp_custom_library_tool_python/gui/settings_panel.py index 2146e797..5ec6f2fa 100644 --- a/tools/ipp_custom_library_tool_python/gui/settings_panel.py +++ b/tools/ipp_custom_library_tool_python/gui/settings_panel.py @@ -189,4 +189,4 @@ def disable_widgets(self): def get_formatted_button_name(self, button): button_name = button.text().replace('(R)', '') - return re.sub(r'[^\w-]', '', button_name.lower()) + return re.sub('[^\w-]', '', button_name.lower()) diff --git a/tools/ipp_custom_library_tool_python/tool/utils.py b/tools/ipp_custom_library_tool_python/tool/utils.py index 4067b79b..18ad9458 100644 --- a/tools/ipp_custom_library_tool_python/tool/utils.py +++ b/tools/ipp_custom_library_tool_python/tool/utils.py @@ -27,16 +27,16 @@ OPENMP = 'openmp' TL_TYPES = [TBB, OPENMP] -PATH_TO_PACKAGE_REGEX = r'(?P.*)\Wtools\W.*' -COMPONENTS_INSTALL_DIR_REGEX = r'(?P.*)\Wipp.*' -VERSION_REGEX = r'.*VERSION_STR\s*(?P.*)\s*' -STR_MACROS_REGEX = r'.*STR\((?P\S*)\).*' -C_STRING_REGEX = r'.*(\S|^)(?P\s*".*"\s*)(\S|$).*' -C_STRING_VALUE_REGEX = r'.*"(?P.*)".*' -FUNCTION_NAME_REGEX = r'IPPAPI\s*\(\s*(?P.*?)\s*,' \ - r'\s*(?P\S*)\s*,' \ - r'\s*\(?(?P.*?)\s*\)?\s*\)?\s*$' -ARGUMENT_REGEX = r'.*\W*\w+\W*\s+\W*(?P[^\W\d]+\w*)\W*?' +PATH_TO_PACKAGE_REGEX = '(?P.*)\Wtools\W.*' +COMPONENTS_INSTALL_DIR_REGEX = '(?P.*)\Wipp.*' +VERSION_REGEX = '.*VERSION_STR\s*(?P.*)\s*' +STR_MACROS_REGEX = '.*STR\((?P\S*)\).*' +C_STRING_REGEX = '.*(\S|^)(?P\s*".*"\s*)(\S|$).*' +C_STRING_VALUE_REGEX = '.*"(?P.*)".*' +FUNCTION_NAME_REGEX = 'IPPAPI\s*\(\s*(?P.*?)\s*,' \ + '\s*(?P\S*)\s*,' \ + '\s*\(?(?P.*?)\s*\)?\s*\)?\s*$' +ARGUMENT_REGEX = '.*\W*\w+\W*\s+\W*(?P[^\W\d]+\w*)\W*?' CUSTOM_LIBRARY_NAME = 'Custom library name' BUILD_SCRIPT_NAME = 'Build script name'