From 586874b9970c30a4ab4784aebebf777320e1703b Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 26 Jun 2018 11:40:34 -0700 Subject: [PATCH] Rename INLINE 1. Renamed the macro INLINE as WC_INLINE. 2. For FIPS and the "selftest" build, define INLINE as WC_INLINE. Allows the FIPS code to work unchanged. --- doc/dox_comments/header_files/ssl.h | 2 +- src/crl.c | 2 +- src/internal.c | 44 ++++---- src/ssl.c | 32 +++--- src/tls.c | 12 +-- src/tls13.c | 10 +- src/wolfio.c | 4 +- tests/api.c | 2 +- wolfcrypt/benchmark/benchmark.c | 18 ++-- wolfcrypt/src/aes.c | 26 ++--- wolfcrypt/src/arc4.c | 2 +- wolfcrypt/src/asm.c | 2 +- wolfcrypt/src/asn.c | 14 +-- wolfcrypt/src/blake2b.c | 8 +- wolfcrypt/src/chacha.c | 2 +- wolfcrypt/src/des3.c | 4 +- wolfcrypt/src/ecc.c | 8 +- wolfcrypt/src/fe_x25519_x64.i | 20 ++-- wolfcrypt/src/ge_operations.c | 16 +-- wolfcrypt/src/hc128.c | 4 +- wolfcrypt/src/idea.c | 4 +- wolfcrypt/src/logging.c | 2 +- wolfcrypt/src/md4.c | 2 +- wolfcrypt/src/md5.c | 2 +- wolfcrypt/src/misc.c | 62 ++++++------ wolfcrypt/src/port/arm/armv8-aes.c | 10 +- wolfcrypt/src/port/arm/armv8-sha256.c | 10 +- wolfcrypt/src/port/caam/caam_aes.c | 2 +- wolfcrypt/src/port/st/stm32.c | 12 +-- wolfcrypt/src/rabbit.c | 4 +- wolfcrypt/src/random.c | 16 +-- wolfcrypt/src/ripemd.c | 2 +- wolfcrypt/src/rsa.c | 2 +- wolfcrypt/src/sha.c | 2 +- wolfcrypt/src/sha256.c | 6 +- wolfcrypt/src/sha512.c | 6 +- wolfcrypt/src/sp_arm32.c | 28 +++--- wolfcrypt/src/sp_arm64.c | 28 +++--- wolfcrypt/src/sp_x86_64.c | 28 +++--- wolfcrypt/src/tfm.c | 4 +- wolfcrypt/user-crypto/src/rsa.c | 2 +- wolfssl/test.h | 140 +++++++++++++------------- wolfssl/wolfcrypt/blake2-impl.h | 22 ++-- wolfssl/wolfcrypt/blake2-int.h | 2 +- wolfssl/wolfcrypt/mem_track.h | 16 +-- wolfssl/wolfcrypt/types.h | 20 ++-- 46 files changed, 335 insertions(+), 331 deletions(-) diff --git a/doc/dox_comments/header_files/ssl.h b/doc/dox_comments/header_files/ssl.h index ed2d0b498..4d7a5c948 100644 --- a/doc/dox_comments/header_files/ssl.h +++ b/doc/dox_comments/header_files/ssl.h @@ -4607,7 +4607,7 @@ WOLFSSL_API void wolfSSL_ERR_print_errors_fp(FILE*, int err); \code WOLFSSL_CTX* ctx = WOLFSSL_CTX_new( protocol def ); … - static INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, + static WC_INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, char* identity, unsigned int id_max_len, unsigned char* key, Unsigned int key_max_len){ … diff --git a/src/crl.c b/src/crl.c index fd0ce6f65..59b2bcb63 100644 --- a/src/crl.c +++ b/src/crl.c @@ -771,7 +771,7 @@ static void* DoMonitor(void* arg) #ifndef max - static INLINE int max(int a, int b) + static WC_INLINE int max(int a, int b) { return a > b ? a : b; } diff --git a/src/internal.c b/src/internal.c index dfb3a2fe9..908f4b555 100644 --- a/src/internal.c +++ b/src/internal.c @@ -117,8 +117,8 @@ WOLFSSL_CALLBACKS needs LARGE_STATIC_BUFFERS, please add LARGE_STATIC_BUFFERS #endif /* !WOLFSSL_NO_TLS12 */ #ifdef WOLFSSL_DTLS - static INLINE int DtlsCheckWindow(WOLFSSL* ssl); - static INLINE int DtlsUpdateWindow(WOLFSSL* ssl); + static WC_INLINE int DtlsCheckWindow(WOLFSSL* ssl); + static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl); #endif @@ -185,7 +185,7 @@ int IsAtLeastTLSv1_3(const ProtocolVersion pv) return (pv.major == SSLv3_MAJOR && pv.minor >= TLSv1_3_MINOR); } -static INLINE int IsEncryptionOn(WOLFSSL* ssl, int isSend) +static WC_INLINE int IsEncryptionOn(WOLFSSL* ssl, int isSend) { (void)isSend; @@ -201,7 +201,7 @@ static INLINE int IsEncryptionOn(WOLFSSL* ssl, int isSend) /* If SCTP is not enabled returns the state of the dtls option. * If SCTP is enabled returns dtls && !sctp. */ -static INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) +static WC_INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) { int result = ssl->options.dtls; @@ -2707,7 +2707,7 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA, * hashalgo The hash algorithm. * hsType The signature type. */ -static INLINE void DecodeSigAlg(const byte* input, byte* hashAlgo, byte* hsType) +static WC_INLINE void DecodeSigAlg(const byte* input, byte* hashAlgo, byte* hsType) { switch (input[0]) { case NEW_SA_MAJOR: @@ -2869,7 +2869,7 @@ void FreeX509(WOLFSSL_X509* x509) * hsType The signature type. * output The buffer to encode into. */ -static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) +static WC_INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) { switch (hsType) { #ifdef HAVE_ECC @@ -5310,7 +5310,7 @@ void FreeSSL(WOLFSSL* ssl, void* heap) #if !defined(NO_OLD_TLS) || defined(WOLFSSL_DTLS) || \ ((defined(HAVE_CHACHA) || defined(HAVE_AESCCM) || defined(HAVE_AESGCM)) \ && defined(HAVE_AEAD)) -static INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) +static WC_INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) { if (verify) { seq[0] = ssl->keys.peer_sequence_number_hi; @@ -5332,7 +5332,7 @@ static INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) #ifdef WOLFSSL_DTLS -static INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) +static WC_INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) { if (order == PREV_ORDER) { /* Previous epoch case */ @@ -5376,7 +5376,7 @@ static INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) } } -static INLINE void DtlsSEQIncrement(WOLFSSL* ssl, int order) +static WC_INLINE void DtlsSEQIncrement(WOLFSSL* ssl, int order) { word32 seq; @@ -5405,7 +5405,7 @@ static INLINE void DtlsSEQIncrement(WOLFSSL* ssl, int order) #endif /* WOLFSSL_DTLS */ -static INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) +static WC_INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) { word32 seq[2] = {0, 0}; @@ -6593,7 +6593,7 @@ int SendBuffered(WOLFSSL* ssl) /* Grow the output buffer */ -static INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size) +static WC_INLINE int GrowOutputBuffer(WOLFSSL* ssl, int size) { byte* tmp; #if WOLFSSL_GENERAL_ALIGNMENT > 0 @@ -10551,7 +10551,7 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, #ifdef WOLFSSL_DTLS -static INLINE int DtlsCheckWindow(WOLFSSL* ssl) +static WC_INLINE int DtlsCheckWindow(WOLFSSL* ssl) { word32* window; word16 cur_hi, next_hi; @@ -10652,7 +10652,7 @@ static INLINE int DtlsCheckWindow(WOLFSSL* ssl) #ifdef WOLFSSL_MULTICAST -static INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, +static WC_INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, word32 second, word32 max) { word32 newCur = 0; @@ -10669,7 +10669,7 @@ static INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, #endif /* WOLFSSL_MULTICAST */ -static INLINE int DtlsUpdateWindow(WOLFSSL* ssl) +static WC_INLINE int DtlsUpdateWindow(WOLFSSL* ssl) { word32* window; word32* next_lo; @@ -10934,7 +10934,7 @@ static int DoDtlsHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, #ifndef WOLFSSL_NO_TLS12 #ifdef HAVE_AEAD -static INLINE void AeadIncrementExpIV(WOLFSSL* ssl) +static WC_INLINE void AeadIncrementExpIV(WOLFSSL* ssl) { int i; for (i = AEAD_MAX_EXP_SZ-1; i >= 0; i--) { @@ -11290,7 +11290,7 @@ static int ChachaAEADDecrypt(WOLFSSL* ssl, byte* plain, const byte* input, #endif /* HAVE_AEAD */ -static INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input, +static WC_INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input, word16 sz, int asyncOkay) { int ret = 0; @@ -11467,7 +11467,7 @@ static INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input, return ret; } -static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz, +static WC_INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz, int asyncOkay) { int ret = 0; @@ -11559,7 +11559,7 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz, return ret; } -static INLINE int DecryptDo(WOLFSSL* ssl, byte* plain, const byte* input, +static WC_INLINE int DecryptDo(WOLFSSL* ssl, byte* plain, const byte* input, word16 sz) { int ret = 0; @@ -11716,7 +11716,7 @@ static INLINE int DecryptDo(WOLFSSL* ssl, byte* plain, const byte* input, return ret; } -static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input, +static WC_INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input, word16 sz) { int ret = 0; @@ -11826,7 +11826,7 @@ static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input, * ssl The SSL/TLS object. * returns 1 if the cipher in use has an explicit IV and 0 otherwise. */ -static INLINE int CipherHasExpIV(WOLFSSL *ssl) +static WC_INLINE int CipherHasExpIV(WOLFSSL *ssl) { #ifdef WOLFSSL_TLS13 if (ssl->options.tls1_3) @@ -12221,7 +12221,7 @@ static int GetInputData(WOLFSSL *ssl, word32 size) } -static INLINE int VerifyMac(WOLFSSL* ssl, const byte* input, word32 msgSz, +static WC_INLINE int VerifyMac(WOLFSSL* ssl, const byte* input, word32 msgSz, int content, word32* padSz) { #ifndef WOLFSSL_NO_TLS12 @@ -16730,7 +16730,7 @@ exit_dpk: } - static INLINE int DSH_CheckSessionId(WOLFSSL* ssl) + static WC_INLINE int DSH_CheckSessionId(WOLFSSL* ssl) { int ret = 0; diff --git a/src/ssl.c b/src/ssl.c index 22117db4f..1a168697c 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -905,7 +905,7 @@ int wolfSSL_mcast_get_max_peers(void) } #ifdef WOLFSSL_DTLS -static INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, +static WC_INLINE word32 UpdateHighwaterMark(word32 cur, word32 first, word32 second, word32 max) { word32 newCur = 0; @@ -3610,7 +3610,7 @@ int wolfSSL_SetVersion(WOLFSSL* ssl, int version) #if !defined(NO_CERTS) || !defined(NO_SESSION_CACHE) /* Make a work from the front of random hash */ -static INLINE word32 MakeWordFromHash(const byte* hashID) +static WC_INLINE word32 MakeWordFromHash(const byte* hashID) { return ((word32)hashID[0] << 24) | (hashID[1] << 16) | (hashID[2] << 8) | hashID[3]; @@ -3622,7 +3622,7 @@ static INLINE word32 MakeWordFromHash(const byte* hashID) #ifndef NO_CERTS /* hash is the SHA digest of name, just use first 32 bits as hash */ -static INLINE word32 HashSigner(const byte* hash) +static WC_INLINE word32 HashSigner(const byte* hash) { return MakeWordFromHash(hash) % CA_TABLE_SIZE; } @@ -3668,7 +3668,7 @@ int AlreadySigner(WOLFSSL_CERT_MANAGER* cm, byte* hash) #ifdef WOLFSSL_TRUST_PEER_CERT /* hash is the SHA digest of name, just use first 32 bits as hash */ -static INLINE word32 TrustedPeerHashSigner(const byte* hash) +static WC_INLINE word32 TrustedPeerHashSigner(const byte* hash) { return MakeWordFromHash(hash) % TP_TABLE_SIZE; } @@ -5032,7 +5032,7 @@ static int ProcessChainBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff, } -static INLINE WOLFSSL_METHOD* cm_pick_method(void) +static WC_INLINE WOLFSSL_METHOD* cm_pick_method(void) { #ifndef NO_WOLFSSL_CLIENT #if defined(WOLFSSL_ALLOW_SSLV3) && !defined(NO_OLD_TLS) @@ -7827,7 +7827,7 @@ typedef struct { /* Return memory needed to persist this signer, have lock */ -static INLINE int GetSignerMemory(Signer* signer) +static WC_INLINE int GetSignerMemory(Signer* signer) { int sz = sizeof(signer->pubKeySize) + sizeof(signer->keyOID) + sizeof(signer->nameLen) + sizeof(signer->subjectNameHash); @@ -7845,7 +7845,7 @@ static INLINE int GetSignerMemory(Signer* signer) /* Return memory needed to persist this row, have lock */ -static INLINE int GetCertCacheRowMemory(Signer* row) +static WC_INLINE int GetCertCacheRowMemory(Signer* row) { int sz = 0; @@ -7859,7 +7859,7 @@ static INLINE int GetCertCacheRowMemory(Signer* row) /* get the size of persist cert cache, have lock */ -static INLINE int GetCertCacheMemSize(WOLFSSL_CERT_MANAGER* cm) +static WC_INLINE int GetCertCacheMemSize(WOLFSSL_CERT_MANAGER* cm) { int sz; int i; @@ -7874,7 +7874,7 @@ static INLINE int GetCertCacheMemSize(WOLFSSL_CERT_MANAGER* cm) /* Store cert cache header columns with number of items per list, have lock */ -static INLINE void SetCertHeaderColumns(WOLFSSL_CERT_MANAGER* cm, int* columns) +static WC_INLINE void SetCertHeaderColumns(WOLFSSL_CERT_MANAGER* cm, int* columns) { int i; Signer* row; @@ -7894,7 +7894,7 @@ static INLINE void SetCertHeaderColumns(WOLFSSL_CERT_MANAGER* cm, int* columns) /* Restore whole cert row from memory, have lock, return bytes consumed, < 0 on error, have lock */ -static INLINE int RestoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, +static WC_INLINE int RestoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, int row, int listSz, const byte* end) { int idx = 0; @@ -7986,7 +7986,7 @@ static INLINE int RestoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, /* Store whole cert row into memory, have lock, return bytes added */ -static INLINE int StoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, int row) +static WC_INLINE int StoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, int row) { int added = 0; Signer* list = cm->caTable[row]; @@ -8023,7 +8023,7 @@ static INLINE int StoreCertRow(WOLFSSL_CERT_MANAGER* cm, byte* current, int row) /* Persist cert cache to memory, have lock */ -static INLINE int DoMemSaveCertCache(WOLFSSL_CERT_MANAGER* cm, +static WC_INLINE int DoMemSaveCertCache(WOLFSSL_CERT_MANAGER* cm, void* mem, int sz) { int realSz; @@ -8521,7 +8521,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, /* If SCTP is not enabled returns the state of the dtls option. * If SCTP is enabled returns dtls && !sctp. */ - static INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) + static WC_INLINE int IsDtlsNotSctpMode(WOLFSSL* ssl) { int result = ssl->options.dtls; @@ -9259,7 +9259,7 @@ int wolfSSL_Cleanup(void) /* some session IDs aren't random after all, let's make them random */ -static INLINE word32 HashSession(const byte* sessionID, word32 len, int* error) +static WC_INLINE word32 HashSession(const byte* sessionID, word32 len, int* error) { byte digest[WC_MAX_DIGEST_SIZE]; @@ -9403,7 +9403,7 @@ WOLFSSL_SESSION* GetSessionClient(WOLFSSL* ssl, const byte* id, int len) * masterSecret The master secret from the cached session. * restoreSessionCerts Restoring session certificates is required. */ -static INLINE void RestoreSession(WOLFSSL* ssl, WOLFSSL_SESSION* session, +static WC_INLINE void RestoreSession(WOLFSSL* ssl, WOLFSSL_SESSION* session, byte* masterSecret, byte restoreSessionCerts) { (void)ssl; @@ -20723,7 +20723,7 @@ int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio, const WOLFSSL_ASN1_UTCTIME* a) * n The number of the month as a two characters (1 based). * returns the month as a string. */ -static INLINE const char* MonthStr(const char* n) +static WC_INLINE const char* MonthStr(const char* n) { static const char monthStr[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", diff --git a/src/tls.c b/src/tls.c index 9f0c49497..3ce43395c 100644 --- a/src/tls.c +++ b/src/tls.c @@ -240,7 +240,7 @@ static int p_hash(byte* result, word32 resLen, const byte* secret, #ifndef NO_OLD_TLS /* calculate XOR for TLSv1 PRF */ -static INLINE void get_xor(byte *digest, word32 digLen, byte* md5, byte* sha) +static WC_INLINE void get_xor(byte *digest, word32 digLen, byte* md5, byte* sha) { word32 i; @@ -723,7 +723,7 @@ int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* msk, unsigned int len, } -static INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) +static WC_INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) { if (verify) { seq[0] = ssl->keys.peer_sequence_number_hi; @@ -745,7 +745,7 @@ static INLINE void GetSEQIncrement(WOLFSSL* ssl, int verify, word32 seq[2]) #ifdef WOLFSSL_DTLS -static INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) +static WC_INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) { if (order == PREV_ORDER) { /* Previous epoch case */ @@ -767,7 +767,7 @@ static INLINE void DtlsGetSEQ(WOLFSSL* ssl, int order, word32 seq[2]) #endif /* WOLFSSL_DTLS */ -static INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) +static WC_INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) { word32 seq[2] = {0, 0}; @@ -1390,7 +1390,7 @@ int TLS_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz, int padSz, * available semaphores, check for a possible collision with with a * 'remapped' extension type. */ -static INLINE word16 TLSX_ToSemaphore(word16 type) +static WC_INLINE word16 TLSX_ToSemaphore(word16 type) { switch (type) { @@ -7554,7 +7554,7 @@ static int TLSX_PreSharedKey_New(PreSharedKey** list, byte* identity, return 0; } -static INLINE byte GetHmacLength(int hmac) +static WC_INLINE byte GetHmacLength(int hmac) { switch (hmac) { #ifndef NO_SHA256 diff --git a/src/tls13.c b/src/tls13.c index ac9bd57eb..f9fbdf58c 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -1494,7 +1494,7 @@ static void AddTls13FragHeaders(byte* output, word32 fragSz, word32 fragOffset, * verifyOrder Which set of sequence numbers to use. * out The buffer to write into. */ -static INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) +static WC_INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) { word32 seq[2] = {0, 0}; @@ -1524,7 +1524,7 @@ static INLINE void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out) * iv The derived IV. * order The side on which the message is to be or was sent. */ -static INLINE void BuildTls13Nonce(WOLFSSL* ssl, byte* nonce, const byte* iv, +static WC_INLINE void BuildTls13Nonce(WOLFSSL* ssl, byte* nonce, const byte* iv, int order) { int i; @@ -4480,7 +4480,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx, * hsType The signature type. * output The buffer to encode into. */ -static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) +static WC_INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) { switch (hsType) { #ifdef HAVE_ECC @@ -4514,7 +4514,7 @@ static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output) * hashalgo The hash algorithm. * hsType The signature type. */ -static INLINE void DecodeSigAlg(byte* input, byte* hashAlgo, byte* hsType) +static WC_INLINE void DecodeSigAlg(byte* input, byte* hashAlgo, byte* hsType) { switch (input[0]) { case NEW_SA_MAJOR: @@ -4546,7 +4546,7 @@ static INLINE void DecodeSigAlg(byte* input, byte* hashAlgo, byte* hsType) * hash The buffer to write the hash to. * returns the length of the hash. */ -static INLINE int GetMsgHash(WOLFSSL* ssl, byte* hash) +static WC_INLINE int GetMsgHash(WOLFSSL* ssl, byte* hash) { int ret = 0; switch (ssl->specs.mac_algorithm) { diff --git a/src/wolfio.c b/src/wolfio.c index d99280236..6974dd88e 100644 --- a/src/wolfio.c +++ b/src/wolfio.c @@ -64,7 +64,7 @@ Possible IO enable options: /* Translates return codes returned from * send() and recv() if need be. */ -static INLINE int TranslateReturnCode(int old, int sd) +static WC_INLINE int TranslateReturnCode(int old, int sd) { (void)sd; @@ -88,7 +88,7 @@ static INLINE int TranslateReturnCode(int old, int sd) return old; } -static INLINE int wolfSSL_LastError(void) +static WC_INLINE int wolfSSL_LastError(void) { #ifdef USE_WINDOWS_API return WSAGetLastError(); diff --git a/tests/api.c b/tests/api.c index ccaa4fa33..2967329bd 100644 --- a/tests/api.c +++ b/tests/api.c @@ -2930,7 +2930,7 @@ static void test_wolfSSL_PKCS12(void) !defined(NO_DES3) && !defined(NO_FILESYSTEM) && \ !defined(NO_ASN) && !defined(NO_PWDBASED) && !defined(NO_RSA) /* for PKCS8 test case */ -static INLINE int PKCS8TestCallBack(char* passwd, int sz, int rw, void* userdata) +static WC_INLINE int PKCS8TestCallBack(char* passwd, int sz, int rw, void* userdata) { int flag = 0; diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index bed73350d..ac2235c73 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -413,7 +413,7 @@ static const bench_alg bench_other_opt[] = { #if defined(__GNUC__) && defined(__x86_64__) && !defined(NO_ASM) && !defined(WOLFSSL_SGX) #define HAVE_GET_CYCLES - static INLINE word64 get_intel_cycles(void); + static WC_INLINE word64 get_intel_cycles(void); static THREAD_LS_T word64 total_cycles; #define INIT_CYCLE_COUNTER #define BEGIN_INTEL_CYCLES total_cycles = get_intel_cycles(); @@ -592,7 +592,7 @@ static THREAD_LS_T int devId = INVALID_DEVID; return (*ret >= 0) ? 1 : 0; } - static INLINE int bench_async_poll(int* pending) + static WC_INLINE int bench_async_poll(int* pending) { int ret, asyncDone = 0; @@ -620,7 +620,7 @@ static THREAD_LS_T int devId = INVALID_DEVID; #define BENCH_ASYNC_GET_NAME(doAsync) "" #define BENCH_ASYNC_GET_DEV(obj) NULL - static INLINE int bench_async_check(int* ret, void* asyncDev, + static WC_INLINE int bench_async_check(int* ret, void* asyncDev, int callAgain, int* times, int limit, int* pending) { (void)ret; @@ -633,7 +633,7 @@ static THREAD_LS_T int devId = INVALID_DEVID; return 1; } - static INLINE int bench_async_handle(int* ret, void* asyncDev, + static WC_INLINE int bench_async_handle(int* ret, void* asyncDev, int callAgain, int* times, int* pending) { (void)asyncDev; @@ -831,7 +831,7 @@ static THREAD_LS_T byte* bench_iv = NULL; } #endif /* WOLFSSL_ASYNC_CRYPT && !WC_NO_ASYNC_THREADING */ -static INLINE void bench_stats_init(void) +static WC_INLINE void bench_stats_init(void) { #if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_NO_ASYNC_THREADING) bench_stats_head = NULL; @@ -840,14 +840,14 @@ static INLINE void bench_stats_init(void) INIT_CYCLE_COUNTER } -static INLINE void bench_stats_start(int* count, double* start) +static WC_INLINE void bench_stats_start(int* count, double* start) { *count = 0; *start = current_time(1); BEGIN_INTEL_CYCLES } -static INLINE int bench_stats_sym_check(double start) +static WC_INLINE int bench_stats_sym_check(double start) { return ((current_time(0) - start) < BENCH_MIN_RUNTIME_SEC); } @@ -952,7 +952,7 @@ static void bench_stats_asym_finish(const char* algo, int strength, } #endif /* BENCH_ASYM */ -static INLINE void bench_stats_free(void) +static WC_INLINE void bench_stats_free(void) { #if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_NO_ASYNC_THREADING) bench_stats_t* stat; @@ -4821,7 +4821,7 @@ exit_ed_verify: #if defined(HAVE_GET_CYCLES) -static INLINE word64 get_intel_cycles(void) +static WC_INLINE word64 get_intel_cycles(void) { unsigned int lo_c, hi_c; __asm__ __volatile__ ( diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 08955a6e3..04adcdd22 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -1418,7 +1418,7 @@ static const byte Td4[256] = /* load 4 Te Tables into cache by cache line stride */ -static INLINE word32 PreFetchTe(void) +static WC_INLINE word32 PreFetchTe(void) { word32 x = 0; int i,j; @@ -1624,7 +1624,7 @@ static void wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock) #if defined(HAVE_AES_CBC) || defined(WOLFSSL_AES_DIRECT) /* load 4 Td Tables into cache by cache line stride */ -static INLINE word32 PreFetchTd(void) +static WC_INLINE word32 PreFetchTd(void) { word32 x = 0; int i,j; @@ -1639,7 +1639,7 @@ static INLINE word32 PreFetchTd(void) } /* load Td Table4 into cache by cache line stride */ -static INLINE word32 PreFetchTd4(void) +static WC_INLINE word32 PreFetchTd4(void) { word32 x = 0; int i; @@ -3297,7 +3297,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) #ifdef NEED_AES_CTR_SOFT /* Increment AES counter */ - static INLINE void IncrementAesCounter(byte* inOutCtr) + static WC_INLINE void IncrementAesCounter(byte* inOutCtr) { /* in network byte order so start at end and work back */ int i; @@ -3384,7 +3384,7 @@ enum { }; #if (defined(HAVE_AESGCM) && !defined(WC_NO_RNG)) || defined(HAVE_AESCCM) -static INLINE void IncCtr(byte* ctr, word32 ctrSz) +static WC_INLINE void IncCtr(byte* ctr, word32 ctrSz) { int i; for (i = ctrSz-1; i >= 0; i--) { @@ -3406,7 +3406,7 @@ static INLINE void IncCtr(byte* ctr, word32 ctrSz) #endif #if !defined(FREESCALE_LTC_AES_GCM) -static INLINE void IncrementGcmCounter(byte* inOutCtr) +static WC_INLINE void IncrementGcmCounter(byte* inOutCtr) { int i; @@ -3420,7 +3420,7 @@ static INLINE void IncrementGcmCounter(byte* inOutCtr) #if defined(GCM_SMALL) || defined(GCM_TABLE) -static INLINE void FlattenSzInBits(byte* buf, word32 sz) +static WC_INLINE void FlattenSzInBits(byte* buf, word32 sz) { /* Multiply the sz by 8 */ word32 szHi = (sz >> (8*sizeof(sz) - 3)); @@ -3438,7 +3438,7 @@ static INLINE void FlattenSzInBits(byte* buf, word32 sz) } -static INLINE void RIGHTSHIFTX(byte* x) +static WC_INLINE void RIGHTSHIFTX(byte* x) { int i; int carryOut = 0; @@ -8292,7 +8292,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, #else #if defined(STM32_CRYPTO) && (defined(WOLFSSL_STM32F4) || \ defined(WOLFSSL_STM32F7)) -static INLINE int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, +static WC_INLINE int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz, const byte* iv, word32 ivSz, byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz) @@ -9269,7 +9269,7 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out) } -static INLINE void AesCcmCtrInc(byte* B, word32 lenSz) +static WC_INLINE void AesCcmCtrInc(byte* B, word32 lenSz) { word32 i; @@ -9742,7 +9742,7 @@ int wc_AesCfbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz) #ifdef HAVE_AES_KEYWRAP /* Initialize key wrap counter with value */ -static INLINE void InitKeyWrapCounter(byte* inOutCtr, word32 value) +static WC_INLINE void InitKeyWrapCounter(byte* inOutCtr, word32 value) { int i; word32 bytes; @@ -9755,7 +9755,7 @@ static INLINE void InitKeyWrapCounter(byte* inOutCtr, word32 value) } /* Increment key wrap counter */ -static INLINE void IncrementKeyWrapCounter(byte* inOutCtr) +static WC_INLINE void IncrementKeyWrapCounter(byte* inOutCtr) { int i; @@ -9767,7 +9767,7 @@ static INLINE void IncrementKeyWrapCounter(byte* inOutCtr) } /* Decrement key wrap counter */ -static INLINE void DecrementKeyWrapCounter(byte* inOutCtr) +static WC_INLINE void DecrementKeyWrapCounter(byte* inOutCtr) { int i; diff --git a/wolfcrypt/src/arc4.c b/wolfcrypt/src/arc4.c index 3a7e1e7c8..4c4cf1fad 100644 --- a/wolfcrypt/src/arc4.c +++ b/wolfcrypt/src/arc4.c @@ -70,7 +70,7 @@ int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length) } -static INLINE byte MakeByte(word32* x, word32* y, byte* s) +static WC_INLINE byte MakeByte(word32* x, word32* y, byte* s) { word32 a = s[*x], b; *y = (*y+a) & 0xff; diff --git a/wolfcrypt/src/asm.c b/wolfcrypt/src/asm.c index 91726dd9a..4101a723e 100644 --- a/wolfcrypt/src/asm.c +++ b/wolfcrypt/src/asm.c @@ -108,7 +108,7 @@ static word32 cpuid_flag(word32 leaf, word32 sub, word32 num, word32 bit) { return 0 ; } -INLINE static int set_cpuid_flags(void) { +WC_INLINE static int set_cpuid_flags(void) { if(cpuid_check == 0) { if(cpuid_flag(7, 0, EBX, 8)){ cpuid_flags |= CPUID_BMI2 ; } if(cpuid_flag(7, 0, EBX,19)){ cpuid_flags |= CPUID_ADX ; } diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 92b9f5316..008776d27 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -3517,7 +3517,7 @@ static mp_int* GetDsaInt(DsaKey* key, int idx) } /* Release Tmp DSA resources */ -static INLINE void FreeTmpDsas(byte** tmps, void* heap) +static WC_INLINE void FreeTmpDsas(byte** tmps, void* heap) { int i; @@ -4410,7 +4410,7 @@ static int GetName(DecodedCert* cert, int nameType) #ifndef NO_ASN_TIME /* two byte date/time, add to value */ -static INLINE void GetTime(int* value, const byte* date, int* idx) +static WC_INLINE void GetTime(int* value, const byte* date, int* idx) { int i = *idx; @@ -4527,7 +4527,7 @@ static int DateGreaterThan(const struct tm* a, const struct tm* b) } -static INLINE int DateLessThan(const struct tm* a, const struct tm* b) +static WC_INLINE int DateLessThan(const struct tm* a, const struct tm* b) { return DateGreaterThan(b,a); } @@ -4959,7 +4959,7 @@ static int SetCurve(ecc_key* key, byte* output) #ifdef HAVE_ECC -static INLINE int IsSigAlgoECDSA(int algoOID) +static WC_INLINE int IsSigAlgoECDSA(int algoOID) { /* ECDSA sigAlgo must not have ASN1 NULL parameters */ if (algoOID == CTC_SHAwECDSA || algoOID == CTC_SHA256wECDSA || @@ -7962,7 +7962,7 @@ int wc_PemToDer(const unsigned char* buff, long longSz, int type, /* our KeyPemToDer password callback, password in userData */ -static INLINE int OurPasswordCb(char* passwd, int sz, int rw, void* userdata) +static WC_INLINE int OurPasswordCb(char* passwd, int sz, int rw, void* userdata) { (void)rw; @@ -8511,7 +8511,7 @@ static mp_int* GetRsaInt(RsaKey* key, int idx) /* Release Tmp RSA resources */ -static INLINE void FreeTmpRsas(byte** tmps, void* heap) +static WC_INLINE void FreeTmpRsas(byte** tmps, void* heap) { int i; @@ -8977,7 +8977,7 @@ int wc_Ed25519PublicKeyToDer(ed25519_key* key, byte* output, word32 inLen, #ifdef WOLFSSL_CERT_GEN -static INLINE byte itob(int number) +static WC_INLINE byte itob(int number) { return (byte)number + 0x30; } diff --git a/wolfcrypt/src/blake2b.c b/wolfcrypt/src/blake2b.c index d043da8a2..725eb87d7 100644 --- a/wolfcrypt/src/blake2b.c +++ b/wolfcrypt/src/blake2b.c @@ -70,14 +70,14 @@ static const byte blake2b_sigma[12][16] = }; -static INLINE int blake2b_set_lastnode( blake2b_state *S ) +static WC_INLINE int blake2b_set_lastnode( blake2b_state *S ) { S->f[1] = ~0ULL; return 0; } /* Some helper functions, not necessarily useful */ -static INLINE int blake2b_set_lastblock( blake2b_state *S ) +static WC_INLINE int blake2b_set_lastblock( blake2b_state *S ) { if( S->last_node ) blake2b_set_lastnode( S ); @@ -85,7 +85,7 @@ static INLINE int blake2b_set_lastblock( blake2b_state *S ) return 0; } -static INLINE int blake2b_increment_counter( blake2b_state *S, const word64 +static WC_INLINE int blake2b_increment_counter( blake2b_state *S, const word64 inc ) { S->t[0] += inc; @@ -93,7 +93,7 @@ static INLINE int blake2b_increment_counter( blake2b_state *S, const word64 return 0; } -static INLINE int blake2b_init0( blake2b_state *S ) +static WC_INLINE int blake2b_init0( blake2b_state *S ) { int i; XMEMSET( S, 0, sizeof( blake2b_state ) ); diff --git a/wolfcrypt/src/chacha.c b/wolfcrypt/src/chacha.c index 3ebded8c4..1f8e6368d 100644 --- a/wolfcrypt/src/chacha.c +++ b/wolfcrypt/src/chacha.c @@ -384,7 +384,7 @@ int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz) /** * Converts word into bytes with rotations having been done. */ -static INLINE void wc_Chacha_wordtobyte(word32 output[CHACHA_CHUNK_WORDS], +static WC_INLINE void wc_Chacha_wordtobyte(word32 output[CHACHA_CHUNK_WORDS], const word32 input[CHACHA_CHUNK_WORDS]) { word32 x[CHACHA_CHUNK_WORDS]; diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index 0a2b7ae7a..ebf46b0fa 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -1300,7 +1300,7 @@ 0x00001040,0x00040040,0x10000000,0x10041000} }; - static INLINE void IPERM(word32* left, word32* right) + static WC_INLINE void IPERM(word32* left, word32* right) { word32 work; @@ -1326,7 +1326,7 @@ *right ^= work; } - static INLINE void FPERM(word32* left, word32* right) + static WC_INLINE void FPERM(word32* left, word32* right) { word32 work; diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 23643dd27..44e16699b 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -2906,7 +2906,7 @@ int wc_ecc_get_curve_id_from_params(int fieldSize, #ifdef WOLFSSL_ASYNC_CRYPT -static INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp) +static WC_INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp) { if (key == NULL || mp == NULL) return BAD_FUNC_ARG; @@ -2919,7 +2919,7 @@ static INLINE int wc_ecc_alloc_mpint(ecc_key* key, mp_int** mp) } return 0; } -static INLINE void wc_ecc_free_mpint(ecc_key* key, mp_int** mp) +static WC_INLINE void wc_ecc_free_mpint(ecc_key* key, mp_int** mp) { if (key && mp && *mp) { mp_clear(*mp); @@ -3333,7 +3333,7 @@ static int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order) #endif #endif /* !WOLFSSL_ATECC508A */ -static INLINE void wc_ecc_reset(ecc_key* key) +static WC_INLINE void wc_ecc_reset(ecc_key* key) { /* make sure required key variables are reset */ key->state = ECC_STATE_NONE; @@ -8742,7 +8742,7 @@ int wc_ecc_set_custom_curve(ecc_key* key, const ecc_set_type* dp) #ifdef HAVE_X963_KDF -static INLINE void IncrementX963KdfCounter(byte* inOutCtr) +static WC_INLINE void IncrementX963KdfCounter(byte* inOutCtr) { int i; diff --git a/wolfcrypt/src/fe_x25519_x64.i b/wolfcrypt/src/fe_x25519_x64.i index b1c094c6b..ac15a492a 100644 --- a/wolfcrypt/src/fe_x25519_x64.i +++ b/wolfcrypt/src/fe_x25519_x64.i @@ -242,7 +242,7 @@ void fe_copy(fe r, const fe a) * b A field element. * c If 1 then swap and if 0 then don't swap. */ -static INLINE void fe_cswap_int(fe a, fe b, int c) +static WC_INLINE void fe_cswap_int(fe a, fe b, int c) { __asm__ __volatile__ ( "movslq %[c], %%rax\n\t" @@ -284,7 +284,7 @@ void fe_cswap(fe a, fe b, int c) * a A field element. * b A field element. */ -static INLINE void fe_sub_int(fe r, const fe a, const fe b) +static WC_INLINE void fe_sub_int(fe r, const fe a, const fe b) { __asm__ __volatile__ ( "movq $0x7fffffffffffffff, %%rcx\n\t" @@ -328,7 +328,7 @@ void fe_sub(fe r, const fe a, const fe b) * a A field element. * b A field element. */ -static INLINE void fe_add_int(fe r, const fe a, const fe b) +static WC_INLINE void fe_add_int(fe r, const fe a, const fe b) { __asm__ __volatile__ ( "movq 0(%[a]), %%rax\n\t" @@ -378,7 +378,7 @@ void fe_mul(fe r, const fe a, const fe b) } #ifdef HAVE_INTEL_AVX2 -static INLINE void fe_mul_avx2(fe r, const fe a, const fe b) +static WC_INLINE void fe_mul_avx2(fe r, const fe a, const fe b) { __asm__ __volatile__ ( "# A[0] * B[0]\n\t" @@ -506,7 +506,7 @@ static INLINE void fe_mul_avx2(fe r, const fe a, const fe b) } #endif /* HAVE_INTEL_AVX2 */ -static INLINE void fe_mul_x64(fe r, const fe a, const fe b) +static WC_INLINE void fe_mul_x64(fe r, const fe a, const fe b) { __asm__ __volatile__ ( "# A[0] * B[0]\n\t" @@ -670,7 +670,7 @@ void fe_sq(fe r, const fe a) } #ifdef HAVE_INTEL_AVX2 -static INLINE void fe_sq_avx2(fe r, const fe a) +static WC_INLINE void fe_sq_avx2(fe r, const fe a) { __asm__ __volatile__ ( "# A[0] * A[1]\n\t" @@ -774,7 +774,7 @@ static INLINE void fe_sq_avx2(fe r, const fe a) } #endif /* HAVE_INTEL_AVX2 */ -static INLINE void fe_sq_x64(fe r, const fe a) +static WC_INLINE void fe_sq_x64(fe r, const fe a) { __asm__ __volatile__ ( "# A[0] * A[1]\n\t" @@ -905,7 +905,7 @@ static INLINE void fe_sq_x64(fe r, const fe a) * a A field element. * b A field element. */ -static INLINE void fe_mul121666_int(fe r, fe a) +static WC_INLINE void fe_mul121666_int(fe r, fe a) { __asm__ __volatile__ ( "movq $0x7fffffffffffffff, %%rcx\n\t" @@ -1249,7 +1249,7 @@ void fe_sq2(fe r, const fe a) } #ifdef HAVE_INTEL_AVX2 -static INLINE void fe_sq2_avx2(fe r, const fe a) +static WC_INLINE void fe_sq2_avx2(fe r, const fe a) { __asm__ __volatile__ ( "# A[0] * A[1]\n\t" @@ -1364,7 +1364,7 @@ static INLINE void fe_sq2_avx2(fe r, const fe a) } #endif /* HAVE_INTEL_AVX2 */ -static INLINE void fe_sq2_x64(fe r, const fe a) +static WC_INLINE void fe_sq2_x64(fe r, const fe a) { __asm__ __volatile__ ( "# A[0] * A[1]\n\t" diff --git a/wolfcrypt/src/ge_operations.c b/wolfcrypt/src/ge_operations.c index b64a46038..a4dbd8bad 100644 --- a/wolfcrypt/src/ge_operations.c +++ b/wolfcrypt/src/ge_operations.c @@ -925,7 +925,7 @@ int ge_compress_key(byte* out, const byte* xIn, const byte* yIn, word32 keySz) /* r = p + q */ -static INLINE void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q) +static WC_INLINE void ge_add(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q) { #ifndef CURVED25519_X64 ge t0; @@ -967,7 +967,7 @@ static unsigned char negative(signed char b) } -static INLINE void cmov(ge_precomp *t,const ge_precomp *u,unsigned char b, +static WC_INLINE void cmov(ge_precomp *t,const ge_precomp *u,unsigned char b, unsigned char n) { b = equal(b,n); @@ -6773,7 +6773,7 @@ int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s) r = p + q */ -static INLINE void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q) +static WC_INLINE void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q) { #ifndef CURVED25519_X64 ge t0; @@ -6800,7 +6800,7 @@ static INLINE void ge_madd(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q) r = p - q */ -static INLINE void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q) +static WC_INLINE void ge_msub(ge_p1p1 *r,const ge_p3 *p,const ge_precomp *q) { #ifndef CURVED25519_X64 ge t0; @@ -6844,7 +6844,7 @@ static void ge_p1p1_to_p2(ge_p2 *r,const ge_p1p1 *p) r = p */ -static INLINE void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p) +static WC_INLINE void ge_p1p1_to_p3(ge_p3 *r,const ge_p1p1 *p) { #ifndef CURVED25519_X64 fe_mul(r->X,p->X,p->T); @@ -6873,7 +6873,7 @@ static void ge_p2_0(ge_p2 *h) r = 2 * p */ -static INLINE void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p) +static WC_INLINE void ge_p2_dbl(ge_p1p1 *r,const ge_p2 *p) { #ifndef CURVED25519_X64 ge t0; @@ -6929,7 +6929,7 @@ static const ge d2 = { #endif -static INLINE void ge_p3_to_cached(ge_cached *r,const ge_p3 *p) +static WC_INLINE void ge_p3_to_cached(ge_cached *r,const ge_p3 *p) { fe_add(r->YplusX,p->Y,p->X); fe_sub(r->YminusX,p->Y,p->X); @@ -6982,7 +6982,7 @@ static void ge_precomp_0(ge_precomp *h) r = p - q */ -static INLINE void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q) +static WC_INLINE void ge_sub(ge_p1p1 *r,const ge_p3 *p,const ge_cached *q) { #ifndef CURVED25519_X64 ge t0; diff --git a/wolfcrypt/src/hc128.c b/wolfcrypt/src/hc128.c index 59739bba1..317aeea46 100644 --- a/wolfcrypt/src/hc128.c +++ b/wolfcrypt/src/hc128.c @@ -272,7 +272,7 @@ static void Hc128_SetIV(HC128* ctx, const byte* inIv) } -static INLINE int DoKey(HC128* ctx, const byte* key, const byte* iv) +static WC_INLINE int DoKey(HC128* ctx, const byte* key, const byte* iv) { word32 i; @@ -335,7 +335,7 @@ int wc_Hc128_SetKey(HC128* ctx, const byte* key, const byte* iv) /* The following defines the encryption of data stream */ -static INLINE int DoProcess(HC128* ctx, byte* output, const byte* input, +static WC_INLINE int DoProcess(HC128* ctx, byte* output, const byte* input, word32 msglen) { word32 i, keystream[16]; diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 708c4e919..e00bb2d03 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -44,7 +44,7 @@ * IDEA specify a special case when an entry value is 0 ( x or y) * then it must be replaced by 2^16 */ -static INLINE word16 idea_mult(word16 x, word16 y) +static WC_INLINE word16 idea_mult(word16 x, word16 y) { long mul, res; @@ -66,7 +66,7 @@ static INLINE word16 idea_mult(word16 x, word16 y) /* compute 1/a modulo 2^16+1 using Extended euclidean algorithm * adapted from fp_invmod */ -static INLINE word16 idea_invmod(word16 x) +static WC_INLINE word16 idea_invmod(word16 x) { int u, v, b, d; diff --git a/wolfcrypt/src/logging.c b/wolfcrypt/src/logging.c index cc7d1545c..fb7d46298 100644 --- a/wolfcrypt/src/logging.c +++ b/wolfcrypt/src/logging.c @@ -101,7 +101,7 @@ static const char* wc_func_name[WC_FUNC_COUNT] = { #include /* WARNING: This function is not portable. */ -static INLINE double current_time(int reset) +static WC_INLINE double current_time(int reset) { struct timeval tv; gettimeofday(&tv, 0); diff --git a/wolfcrypt/src/md4.c b/wolfcrypt/src/md4.c index 437d2e82d..bef6cd57e 100644 --- a/wolfcrypt/src/md4.c +++ b/wolfcrypt/src/md4.c @@ -130,7 +130,7 @@ static void Transform(Md4* md4) } -static INLINE void AddLength(Md4* md4, word32 len) +static WC_INLINE void AddLength(Md4* md4, word32 len) { word32 tmp = md4->loLen; if ( (md4->loLen += len) < tmp) diff --git a/wolfcrypt/src/md5.c b/wolfcrypt/src/md5.c index e8314b213..64ba4b426 100644 --- a/wolfcrypt/src/md5.c +++ b/wolfcrypt/src/md5.c @@ -234,7 +234,7 @@ #ifndef HAVE_MD5_CUST_API -static INLINE void AddLength(wc_Md5* md5, word32 len) +static WC_INLINE void AddLength(wc_Md5* md5, word32 len) { word32 tmp = md5->loLen; if ((md5->loLen += len) < tmp) { diff --git a/wolfcrypt/src/misc.c b/wolfcrypt/src/misc.c index f5017e356..62de6d97a 100644 --- a/wolfcrypt/src/misc.c +++ b/wolfcrypt/src/misc.c @@ -66,25 +66,25 @@ * i.e., _rotl and _rotr */ #pragma intrinsic(_lrotl, _lrotr) - STATIC INLINE word32 rotlFixed(word32 x, word32 y) + STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y) { return y ? _lrotl(x, y) : x; } - STATIC INLINE word32 rotrFixed(word32 x, word32 y) + STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y) { return y ? _lrotr(x, y) : x; } #else /* generic */ - STATIC INLINE word32 rotlFixed(word32 x, word32 y) + STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y) { return (x << y) | (x >> (sizeof(y) * 8 - y)); } - STATIC INLINE word32 rotrFixed(word32 x, word32 y) + STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y) { return (x >> y) | (x << (sizeof(y) * 8 - y)); } @@ -92,7 +92,7 @@ #endif -STATIC INLINE word32 ByteReverseWord32(word32 value) +STATIC WC_INLINE word32 ByteReverseWord32(word32 value) { #ifdef PPC_INTRINSICS /* PPC: load reverse indexed instruction */ @@ -116,7 +116,7 @@ STATIC INLINE word32 ByteReverseWord32(word32 value) } -STATIC INLINE void ByteReverseWords(word32* out, const word32* in, +STATIC WC_INLINE void ByteReverseWords(word32* out, const word32* in, word32 byteCount) { word32 count = byteCount/(word32)sizeof(word32), i; @@ -130,19 +130,19 @@ STATIC INLINE void ByteReverseWords(word32* out, const word32* in, #ifdef WORD64_AVAILABLE -STATIC INLINE word64 rotlFixed64(word64 x, word64 y) +STATIC WC_INLINE word64 rotlFixed64(word64 x, word64 y) { return (x << y) | (x >> (sizeof(y) * 8 - y)); } -STATIC INLINE word64 rotrFixed64(word64 x, word64 y) +STATIC WC_INLINE word64 rotrFixed64(word64 x, word64 y) { return (x >> y) | (x << (sizeof(y) * 8 - y)); } -STATIC INLINE word64 ByteReverseWord64(word64 value) +STATIC WC_INLINE word64 ByteReverseWord64(word64 value) { #if defined(WOLF_ALLOW_BUILTIN) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) return (word64)__builtin_bswap64(value); @@ -159,7 +159,7 @@ STATIC INLINE word64 ByteReverseWord64(word64 value) } -STATIC INLINE void ByteReverseWords64(word64* out, const word64* in, +STATIC WC_INLINE void ByteReverseWords64(word64* out, const word64* in, word32 byteCount) { word32 count = byteCount/(word32)sizeof(word64), i; @@ -172,7 +172,7 @@ STATIC INLINE void ByteReverseWords64(word64* out, const word64* in, #endif /* WORD64_AVAILABLE */ -STATIC INLINE void XorWords(wolfssl_word* r, const wolfssl_word* a, word32 n) +STATIC WC_INLINE void XorWords(wolfssl_word* r, const wolfssl_word* a, word32 n) { word32 i; @@ -180,7 +180,7 @@ STATIC INLINE void XorWords(wolfssl_word* r, const wolfssl_word* a, word32 n) } -STATIC INLINE void xorbuf(void* buf, const void* mask, word32 count) +STATIC WC_INLINE void xorbuf(void* buf, const void* mask, word32 count) { if (((wolfssl_word)buf | (wolfssl_word)mask | count) % WOLFSSL_WORD_SIZE == 0) XorWords( (wolfssl_word*)buf, @@ -196,7 +196,7 @@ STATIC INLINE void xorbuf(void* buf, const void* mask, word32 count) /* Make sure compiler doesn't skip */ -STATIC INLINE void ForceZero(const void* mem, word32 len) +STATIC WC_INLINE void ForceZero(const void* mem, word32 len) { volatile byte* z = (volatile byte*)mem; @@ -220,7 +220,7 @@ STATIC INLINE void ForceZero(const void* mem, word32 len) /* check all length bytes for equality, return 0 on success */ -STATIC INLINE int ConstantCompare(const byte* a, const byte* b, int length) +STATIC WC_INLINE int ConstantCompare(const byte* a, const byte* b, int length) { int i; int compareSum = 0; @@ -238,7 +238,7 @@ STATIC INLINE int ConstantCompare(const byte* a, const byte* b, int length) #if defined(HAVE_FIPS) && !defined(min) /* so ifdef check passes */ #define min min #endif - STATIC INLINE word32 min(word32 a, word32 b) + STATIC WC_INLINE word32 min(word32 a, word32 b) { return a > b ? b : a; } @@ -249,14 +249,14 @@ STATIC INLINE int ConstantCompare(const byte* a, const byte* b, int length) #if defined(HAVE_FIPS) && !defined(max) /* so ifdef check passes */ #define max max #endif - STATIC INLINE word32 max(word32 a, word32 b) + STATIC WC_INLINE word32 max(word32 a, word32 b) { return a > b ? a : b; } #endif /* !WOLFSSL_HAVE_MAX */ /* converts a 32 bit integer to 24 bit */ -STATIC INLINE void c32to24(word32 in, word24 out) +STATIC WC_INLINE void c32to24(word32 in, word24 out) { out[0] = (in >> 16) & 0xff; out[1] = (in >> 8) & 0xff; @@ -264,14 +264,14 @@ STATIC INLINE void c32to24(word32 in, word24 out) } /* convert 16 bit integer to opaque */ -STATIC INLINE void c16toa(word16 wc_u16, byte* c) +STATIC WC_INLINE void c16toa(word16 wc_u16, byte* c) { c[0] = (wc_u16 >> 8) & 0xff; c[1] = wc_u16 & 0xff; } /* convert 32 bit integer to opaque */ -STATIC INLINE void c32toa(word32 wc_u32, byte* c) +STATIC WC_INLINE void c32toa(word32 wc_u32, byte* c) { c[0] = (wc_u32 >> 24) & 0xff; c[1] = (wc_u32 >> 16) & 0xff; @@ -280,75 +280,75 @@ STATIC INLINE void c32toa(word32 wc_u32, byte* c) } /* convert a 24 bit integer into a 32 bit one */ -STATIC INLINE void c24to32(const word24 wc_u24, word32* wc_u32) +STATIC WC_INLINE void c24to32(const word24 wc_u24, word32* wc_u32) { *wc_u32 = (wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2]; } /* convert opaque to 24 bit integer */ -STATIC INLINE void ato24(const byte* c, word32* wc_u24) +STATIC WC_INLINE void ato24(const byte* c, word32* wc_u24) { *wc_u24 = (c[0] << 16) | (c[1] << 8) | c[2]; } /* convert opaque to 16 bit integer */ -STATIC INLINE void ato16(const byte* c, word16* wc_u16) +STATIC WC_INLINE void ato16(const byte* c, word16* wc_u16) { *wc_u16 = (word16) ((c[0] << 8) | (c[1])); } /* convert opaque to 32 bit integer */ -STATIC INLINE void ato32(const byte* c, word32* wc_u32) +STATIC WC_INLINE void ato32(const byte* c, word32* wc_u32) { *wc_u32 = ((word32)c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3]; } -STATIC INLINE word32 btoi(byte b) +STATIC WC_INLINE word32 btoi(byte b) { return (word32)(b - 0x30); } /* Constant time - mask set when a > b. */ -STATIC INLINE byte ctMaskGT(int a, int b) +STATIC WC_INLINE byte ctMaskGT(int a, int b) { return (((word32)a - b - 1) >> 31) - 1; } /* Constant time - mask set when a >= b. */ -STATIC INLINE byte ctMaskGTE(int a, int b) +STATIC WC_INLINE byte ctMaskGTE(int a, int b) { return (((word32)a - b ) >> 31) - 1; } /* Constant time - mask set when a < b. */ -STATIC INLINE byte ctMaskLT(int a, int b) +STATIC WC_INLINE byte ctMaskLT(int a, int b) { return (((word32)b - a - 1) >> 31) - 1; } /* Constant time - mask set when a <= b. */ -STATIC INLINE byte ctMaskLTE(int a, int b) +STATIC WC_INLINE byte ctMaskLTE(int a, int b) { return (((word32)b - a ) >> 31) - 1; } /* Constant time - mask set when a == b. */ -STATIC INLINE byte ctMaskEq(int a, int b) +STATIC WC_INLINE byte ctMaskEq(int a, int b) { return 0 - (a == b); } /* Constant time - select b when mask is set and a otherwise. */ -STATIC INLINE byte ctMaskSel(byte m, byte a, byte b) +STATIC WC_INLINE byte ctMaskSel(byte m, byte a, byte b) { return (a & ~m) | (b & m); } /* Constant time - bit set when a <= b. */ -STATIC INLINE byte ctSetLTE(int a, int b) +STATIC WC_INLINE byte ctSetLTE(int a, int b) { return ((word32)a - b - 1) >> 31; } diff --git a/wolfcrypt/src/port/arm/armv8-aes.c b/wolfcrypt/src/port/arm/armv8-aes.c index e0575a4a4..ffc5f7df4 100644 --- a/wolfcrypt/src/port/arm/armv8-aes.c +++ b/wolfcrypt/src/port/arm/armv8-aes.c @@ -115,7 +115,7 @@ enum { CTR_SZ = 4 }; -static INLINE void IncrementGcmCounter(byte* inOutCtr) +static WC_INLINE void IncrementGcmCounter(byte* inOutCtr) { int i; @@ -127,7 +127,7 @@ static INLINE void IncrementGcmCounter(byte* inOutCtr) } -static INLINE void FlattenSzInBits(byte* buf, word32 sz) +static WC_INLINE void FlattenSzInBits(byte* buf, word32 sz) { /* Multiply the sz by 8 */ word32 szHi = (sz >> (8*sizeof(sz) - 3)); @@ -886,7 +886,7 @@ void wc_AesFree(Aes* aes) #ifdef WOLFSSL_AES_COUNTER /* Increment AES counter */ - static INLINE void IncrementAesCounter(byte* inOutCtr) + static WC_INLINE void IncrementAesCounter(byte* inOutCtr) { int i; @@ -3530,7 +3530,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, #ifdef WOLFSSL_AES_COUNTER /* Increment AES counter */ - static INLINE void IncrementAesCounter(byte* inOutCtr) + static WC_INLINE void IncrementAesCounter(byte* inOutCtr) { int i; @@ -4444,7 +4444,7 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out) } -static INLINE void AesCcmCtrInc(byte* B, word32 lenSz) +static WC_INLINE void AesCcmCtrInc(byte* B, word32 lenSz) { word32 i; diff --git a/wolfcrypt/src/port/arm/armv8-sha256.c b/wolfcrypt/src/port/arm/armv8-sha256.c index 66e9d5c99..ea709bf32 100644 --- a/wolfcrypt/src/port/arm/armv8-sha256.c +++ b/wolfcrypt/src/port/arm/armv8-sha256.c @@ -82,7 +82,7 @@ static int InitSha256(wc_Sha256* sha256) return ret; } -static INLINE void AddLength(wc_Sha256* sha256, word32 len) +static WC_INLINE void AddLength(wc_Sha256* sha256, word32 len) { word32 tmp = sha256->loLen; if ((sha256->loLen += len) < tmp) @@ -93,7 +93,7 @@ static INLINE void AddLength(wc_Sha256* sha256, word32 len) #ifdef __aarch64__ /* ARMv8 hardware accleration */ -static INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) +static WC_INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) { word32 add; word32 numBlocks; @@ -306,7 +306,7 @@ static INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) } -static INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) +static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) { byte* local; @@ -655,7 +655,7 @@ static INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) #else /* not using 64 bit */ /* ARMv8 hardware accleration Aarch32 */ -static INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) +static WC_INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) { word32 add; word32 numBlocks; @@ -882,7 +882,7 @@ static INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) } -static INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) +static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) { byte* local; diff --git a/wolfcrypt/src/port/caam/caam_aes.c b/wolfcrypt/src/port/caam/caam_aes.c index baef92d4e..5ade5908d 100644 --- a/wolfcrypt/src/port/caam/caam_aes.c +++ b/wolfcrypt/src/port/caam/caam_aes.c @@ -299,7 +299,7 @@ int wc_AesEcbDecrypt(Aes* aes, byte* out, /* AES-CTR */ #ifdef WOLFSSL_AES_COUNTER /* Increment AES counter (from wolfcrypt/src/aes.c) */ -static INLINE void IncrementAesCounter(byte* inOutCtr) +static WC_INLINE void IncrementAesCounter(byte* inOutCtr) { /* in network byte order so start at end and work back */ int i; diff --git a/wolfcrypt/src/port/st/stm32.c b/wolfcrypt/src/port/st/stm32.c index dbfcd5450..07bb30f91 100644 --- a/wolfcrypt/src/port/st/stm32.c +++ b/wolfcrypt/src/port/st/stm32.c @@ -43,7 +43,7 @@ /* User can override STM32_HASH_CLOCK_ENABLE and STM32_HASH_CLOCK_DISABLE */ #ifndef STM32_HASH_CLOCK_ENABLE - static INLINE void wc_Stm32_Hash_Clock_Enable(STM32_HASH_Context* stmCtx) + static WC_INLINE void wc_Stm32_Hash_Clock_Enable(STM32_HASH_Context* stmCtx) { #ifdef WOLFSSL_STM32_CUBEMX __HAL_RCC_HASH_CLK_ENABLE(); @@ -56,7 +56,7 @@ #endif #ifndef STM32_HASH_CLOCK_DISABLE - static INLINE void wc_Stm32_Hash_Clock_Disable(STM32_HASH_Context* stmCtx) + static WC_INLINE void wc_Stm32_Hash_Clock_Disable(STM32_HASH_Context* stmCtx) { #ifdef WOLFSSL_STM32_CUBEMX __HAL_RCC_HASH_CLK_DISABLE(); @@ -69,7 +69,7 @@ #endif /* STM32 Port Internal Functions */ -static INLINE void wc_Stm32_Hash_SaveContext(STM32_HASH_Context* ctx) +static WC_INLINE void wc_Stm32_Hash_SaveContext(STM32_HASH_Context* ctx) { int i; @@ -82,7 +82,7 @@ static INLINE void wc_Stm32_Hash_SaveContext(STM32_HASH_Context* ctx) } } -static INLINE int wc_Stm32_Hash_RestoreContext(STM32_HASH_Context* ctx) +static WC_INLINE int wc_Stm32_Hash_RestoreContext(STM32_HASH_Context* ctx) { int i; @@ -104,7 +104,7 @@ static INLINE int wc_Stm32_Hash_RestoreContext(STM32_HASH_Context* ctx) return 0; } -static INLINE void wc_Stm32_Hash_GetDigest(byte* hash, int digestSize) +static WC_INLINE void wc_Stm32_Hash_GetDigest(byte* hash, int digestSize) { word32 digest[HASH_MAX_DIGEST/sizeof(word32)]; @@ -132,7 +132,7 @@ static INLINE void wc_Stm32_Hash_GetDigest(byte* hash, int digestSize) /* STM32 Port Exposed Functions */ -static INLINE int wc_Stm32_Hash_WaitDone(void) +static WC_INLINE int wc_Stm32_Hash_WaitDone(void) { /* wait until hash hardware is not busy */ int timeout = 0; diff --git a/wolfcrypt/src/rabbit.c b/wolfcrypt/src/rabbit.c index 9875a357a..2971bef83 100644 --- a/wolfcrypt/src/rabbit.c +++ b/wolfcrypt/src/rabbit.c @@ -145,7 +145,7 @@ static void wc_RabbitSetIV(Rabbit* ctx, const byte* inIv) /* Key setup */ -static INLINE int DoKey(Rabbit* ctx, const byte* key, const byte* iv) +static WC_INLINE int DoKey(Rabbit* ctx, const byte* key, const byte* iv) { /* Temporary variables */ word32 k0, k1, k2, k3, i; @@ -247,7 +247,7 @@ int wc_RabbitSetKey(Rabbit* ctx, const byte* key, const byte* iv) /* Encrypt/decrypt a message of any size */ -static INLINE int DoProcess(Rabbit* ctx, byte* output, const byte* input, +static WC_INLINE int DoProcess(Rabbit* ctx, byte* output, const byte* input, word32 msglen) { /* Encrypt/decrypt all full blocks */ diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index bdbccae04..9b097b74d 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -330,7 +330,7 @@ int wc_RNG_DRBG_Reseed(WC_RNG* rng, const byte* entropy, word32 entropySz) return Hash_DRBG_Reseed(rng->drbg, entropy, entropySz); } -static INLINE void array_add_one(byte* data, word32 dataSz) +static WC_INLINE void array_add_one(byte* data, word32 dataSz) { int i; @@ -411,7 +411,7 @@ static int Hash_gen(DRBG* drbg, byte* out, word32 outSz, const byte* V) return (ret == 0) ? DRBG_SUCCESS : DRBG_FAILURE; } -static INLINE void array_add(byte* d, word32 dLen, const byte* s, word32 sLen) +static WC_INLINE void array_add(byte* d, word32 dLen, const byte* s, word32 sLen) { word16 carry = 0; @@ -1084,7 +1084,7 @@ int wc_FreeNetRandom(void) #ifndef USE_WINDOWS_API /* return 0 on success */ - static INLINE int IntelRDseed64(word64* seed) + static WC_INLINE int IntelRDseed64(word64* seed) { unsigned char ok; @@ -1097,7 +1097,7 @@ int wc_FreeNetRandom(void) * It does allow for Intel intrinsic functions. */ /* return 0 on success */ - static INLINE int IntelRDseed64(word64* seed) + static WC_INLINE int IntelRDseed64(word64* seed) { int ok; @@ -1108,7 +1108,7 @@ int wc_FreeNetRandom(void) #endif /* USE_WINDOWS_API */ /* return 0 on success */ -static INLINE int IntelRDseed64_r(word64* rnd) +static WC_INLINE int IntelRDseed64_r(word64* rnd) { int i; for (i = 0; i < INTELRD_RETRY; i++) { @@ -1156,7 +1156,7 @@ static int wc_GenerateSeed_IntelRD(OS_Seed* os, byte* output, word32 sz) #ifndef USE_WINDOWS_API /* return 0 on success */ -static INLINE int IntelRDrand64(word64 *rnd) +static WC_INLINE int IntelRDrand64(word64 *rnd) { unsigned char ok; @@ -1170,7 +1170,7 @@ static INLINE int IntelRDrand64(word64 *rnd) * It does allow for Intel intrinsic functions. */ /* return 0 on success */ -static INLINE int IntelRDrand64(word64 *rnd) +static WC_INLINE int IntelRDrand64(word64 *rnd) { int ok; @@ -1182,7 +1182,7 @@ static INLINE int IntelRDrand64(word64 *rnd) #endif /* USE_WINDOWS_API */ /* return 0 on success */ -static INLINE int IntelRDrand64_r(word64 *rnd) +static WC_INLINE int IntelRDrand64_r(word64 *rnd) { int i; for (i = 0; i < INTELRD_RETRY; i++) { diff --git a/wolfcrypt/src/ripemd.c b/wolfcrypt/src/ripemd.c index a865ac4a4..65b671281 100644 --- a/wolfcrypt/src/ripemd.c +++ b/wolfcrypt/src/ripemd.c @@ -271,7 +271,7 @@ static void Transform(RipeMd* ripemd) } -static INLINE void AddLength(RipeMd* ripemd, word32 len) +static WC_INLINE void AddLength(RipeMd* ripemd, word32 len) { word32 tmp = ripemd->loLen; if ( (ripemd->loLen += len) < tmp) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 5b0857e00..7ef917f5c 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -2618,7 +2618,7 @@ static const byte lower_bound[] = { /* returns 1 on key size ok and 0 if not ok */ -static INLINE int RsaSizeCheck(int size) +static WC_INLINE int RsaSizeCheck(int size) { if (size < RSA_MIN_SIZE || size > RSA_MAX_SIZE) { return 0; diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c index 129fe689a..65e8a375c 100644 --- a/wolfcrypt/src/sha.c +++ b/wolfcrypt/src/sha.c @@ -267,7 +267,7 @@ /* Software implementation */ #ifdef USE_SHA_SOFTWARE_IMPL -static INLINE void AddLength(wc_Sha* sha, word32 len) +static WC_INLINE void AddLength(wc_Sha* sha, word32 len) { word32 tmp = sha->loLen; if ((sha->loLen += len) < tmp) diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index e7e60e672..560126428 100644 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -572,14 +572,14 @@ static int InitSha256(wc_Sha256* sha256) #ifdef XTRANSFORM - static INLINE void AddLength(wc_Sha256* sha256, word32 len) + static WC_INLINE void AddLength(wc_Sha256* sha256, word32 len) { word32 tmp = sha256->loLen; if ((sha256->loLen += len) < tmp) sha256->hiLen++; /* carry low to high */ } - static INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) + static WC_INLINE int Sha256Update(wc_Sha256* sha256, const byte* data, word32 len) { int ret = 0; byte* local; @@ -702,7 +702,7 @@ static int InitSha256(wc_Sha256* sha256) return Sha256Update(sha256, data, len); } - static INLINE int Sha256Final(wc_Sha256* sha256) + static WC_INLINE int Sha256Final(wc_Sha256* sha256) { int ret; diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index 82d0fcea9..22023813e 100644 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -519,14 +519,14 @@ static int _Transform_Sha512(wc_Sha512* sha512) } -static INLINE void AddLength(wc_Sha512* sha512, word32 len) +static WC_INLINE void AddLength(wc_Sha512* sha512, word32 len) { word64 tmp = sha512->loLen; if ( (sha512->loLen += len) < tmp) sha512->hiLen++; /* carry low to high */ } -static INLINE int Sha512Update(wc_Sha512* sha512, const byte* data, word32 len) +static WC_INLINE int Sha512Update(wc_Sha512* sha512, const byte* data, word32 len) { int ret = 0; /* do block size increments */ @@ -643,7 +643,7 @@ int wc_Sha512Update(wc_Sha512* sha512, const byte* data, word32 len) } #endif /* WOLFSSL_IMX6_CAAM */ -static INLINE int Sha512Final(wc_Sha512* sha512) +static WC_INLINE int Sha512Final(wc_Sha512* sha512) { byte* local = (byte*)sha512->buffer; int ret; diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c index 1b104cf97..e611fe0d1 100644 --- a/wolfcrypt/src/sp_arm32.c +++ b/wolfcrypt/src/sp_arm32.c @@ -4021,7 +4021,7 @@ static int32_t sp_2048_cmp_32(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[64], t2[33]; @@ -4057,7 +4057,7 @@ static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_32(a, m, NULL, r); } @@ -6565,7 +6565,7 @@ static int32_t sp_2048_cmp_64(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_64(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_64(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[128], t2[65]; @@ -6601,7 +6601,7 @@ static INLINE int sp_2048_div_64(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_64(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_64(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_64(a, m, NULL, r); } @@ -6615,7 +6615,7 @@ static INLINE int sp_2048_mod_64(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_64_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_64_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[128], t2[65]; @@ -6652,7 +6652,7 @@ static INLINE int sp_2048_div_64_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_64_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_64_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_64_cond(a, m, NULL, r); } @@ -12468,7 +12468,7 @@ static int32_t sp_3072_cmp_48(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[96], t2[49]; @@ -12504,7 +12504,7 @@ static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_48(a, m, NULL, r); } @@ -15969,7 +15969,7 @@ static int32_t sp_3072_cmp_96(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_96(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_96(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[192], t2[97]; @@ -16005,7 +16005,7 @@ static INLINE int sp_3072_div_96(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_96(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_96(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_96(a, m, NULL, r); } @@ -16019,7 +16019,7 @@ static INLINE int sp_3072_mod_96(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_96_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_96_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[192], t2[97]; @@ -16056,7 +16056,7 @@ static INLINE int sp_3072_div_96_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_96_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_96_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_96_cond(a, m, NULL, r); } @@ -23226,7 +23226,7 @@ static void sp_256_mask_8(sp_digit* r, sp_digit* a, sp_digit m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_div_8(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_256_div_8(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[16], t2[9]; @@ -23262,7 +23262,7 @@ static INLINE int sp_256_div_8(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_mod_8(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_256_mod_8(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_256_div_8(a, m, NULL, r); } diff --git a/wolfcrypt/src/sp_arm64.c b/wolfcrypt/src/sp_arm64.c index f8ba325d0..66a9b054b 100644 --- a/wolfcrypt/src/sp_arm64.c +++ b/wolfcrypt/src/sp_arm64.c @@ -2655,7 +2655,7 @@ static int64_t sp_2048_cmp_16(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[32], t2[17]; @@ -2691,7 +2691,7 @@ static INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_16(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_16(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_16(a, m, NULL, r); } @@ -4295,7 +4295,7 @@ static int64_t sp_2048_cmp_32(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[64], t2[33]; @@ -4331,7 +4331,7 @@ static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_32(a, m, NULL, r); } @@ -4345,7 +4345,7 @@ static INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[64], t2[33]; @@ -4382,7 +4382,7 @@ static INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_32_cond(a, m, NULL, r); } @@ -9127,7 +9127,7 @@ static int64_t sp_3072_cmp_24(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[48], t2[25]; @@ -9163,7 +9163,7 @@ static INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_24(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_24(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_24(a, m, NULL, r); } @@ -11276,7 +11276,7 @@ static int64_t sp_3072_cmp_48(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[96], t2[49]; @@ -11312,7 +11312,7 @@ static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_48(a, m, NULL, r); } @@ -11326,7 +11326,7 @@ static INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[96], t2[49]; @@ -11363,7 +11363,7 @@ static INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_48_cond(a, m, NULL, r); } @@ -28391,7 +28391,7 @@ static void sp_256_mask_4(sp_digit* r, sp_digit* a, sp_digit m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[8], t2[5]; @@ -28427,7 +28427,7 @@ static INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_mod_4(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_256_mod_4(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_256_div_4(a, m, NULL, r); } diff --git a/wolfcrypt/src/sp_x86_64.c b/wolfcrypt/src/sp_x86_64.c index 692faba19..fd792d103 100644 --- a/wolfcrypt/src/sp_x86_64.c +++ b/wolfcrypt/src/sp_x86_64.c @@ -6911,7 +6911,7 @@ static int64_t sp_2048_cmp_16(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[32], t2[17]; @@ -6955,7 +6955,7 @@ static INLINE int sp_2048_div_16(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_16(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_16(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_16(a, m, NULL, r); } @@ -8889,7 +8889,7 @@ static int64_t sp_2048_cmp_32(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[64], t2[33]; @@ -8933,7 +8933,7 @@ static INLINE int sp_2048_div_32(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_32(a, m, NULL, r); } @@ -8947,7 +8947,7 @@ static INLINE int sp_2048_mod_32(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[64], t2[33]; @@ -8992,7 +8992,7 @@ static INLINE int sp_2048_div_32_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_2048_mod_32_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_2048_div_32_cond(a, m, NULL, r); } @@ -23470,7 +23470,7 @@ static int64_t sp_3072_cmp_24(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[48], t2[25]; @@ -23514,7 +23514,7 @@ static INLINE int sp_3072_div_24(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_24(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_24(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_24(a, m, NULL, r); } @@ -26120,7 +26120,7 @@ static int64_t sp_3072_cmp_48(sp_digit* a, sp_digit* b) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[96], t2[49]; @@ -26164,7 +26164,7 @@ static INLINE int sp_3072_div_48(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_48(a, m, NULL, r); } @@ -26178,7 +26178,7 @@ static INLINE int sp_3072_mod_48(sp_digit* r, sp_digit* a, sp_digit* m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[96], t2[49]; @@ -26223,7 +26223,7 @@ static INLINE int sp_3072_div_48_cond(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_3072_mod_48_cond(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_3072_div_48_cond(a, m, NULL, r); } @@ -45114,7 +45114,7 @@ static void sp_256_mask_4(sp_digit* r, sp_digit* a, sp_digit m) * r Remainder from the division. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, +static WC_INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, sp_digit* r) { sp_digit t1[8], t2[5]; @@ -45158,7 +45158,7 @@ static INLINE int sp_256_div_4(sp_digit* a, sp_digit* d, sp_digit* m, * m A single precision number that is the modulus to reduce with. * returns MP_OKAY indicating success. */ -static INLINE int sp_256_mod_4(sp_digit* r, sp_digit* a, sp_digit* m) +static WC_INLINE int sp_256_mod_4(sp_digit* r, sp_digit* a, sp_digit* m) { return sp_256_div_4(a, m, NULL, r); } diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 664a74b54..f223f35c0 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -431,7 +431,7 @@ void fp_mul_2d(fp_int *a, int b, fp_int *c) /* generic PxQ multiplier */ #if defined(HAVE_INTEL_MULX) -INLINE static void fp_mul_comba_mulx(fp_int *A, fp_int *B, fp_int *C) +WC_INLINE static void fp_mul_comba_mulx(fp_int *A, fp_int *B, fp_int *C) { int ix, iy, iz, pa; @@ -1696,7 +1696,7 @@ void fp_montgomery_calc_normalization(fp_int *a, fp_int *b) #endif #ifdef HAVE_INTEL_MULX -static INLINE void innermul8_mulx(fp_digit *c_mulx, fp_digit *cy_mulx, fp_digit *tmpm, fp_digit mu) +static WC_INLINE void innermul8_mulx(fp_digit *c_mulx, fp_digit *cy_mulx, fp_digit *tmpm, fp_digit mu) { fp_digit cy = *cy_mulx ; INNERMUL8_MULX ; diff --git a/wolfcrypt/user-crypto/src/rsa.c b/wolfcrypt/user-crypto/src/rsa.c index 2d6ed3497..d71bc93b9 100644 --- a/wolfcrypt/user-crypto/src/rsa.c +++ b/wolfcrypt/user-crypto/src/rsa.c @@ -2617,7 +2617,7 @@ static IppsBigNumState* GetRsaInt(RsaKey* key, int idx) /* Release Tmp RSA resources */ -static INLINE void FreeTmpRsas(byte** tmps, void* heap) +static WC_INLINE void FreeTmpRsas(byte** tmps, void* heap) { int i; diff --git a/wolfssl/test.h b/wolfssl/test.h index b55c395b5..20feefa9c 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -137,7 +137,7 @@ #ifndef WOLFSSL_HAVE_MIN #define WOLFSSL_HAVE_MIN - static INLINE word32 min(word32 a, word32 b) + static WC_INLINE word32 min(word32 a, word32 b) { return a > b ? b : a; } @@ -308,7 +308,7 @@ typedef struct tcp_ready { } tcp_ready; -static INLINE void InitTcpReady(tcp_ready* ready) +static WC_INLINE void InitTcpReady(tcp_ready* ready) { ready->ready = 0; ready->port = 0; @@ -321,7 +321,7 @@ static INLINE void InitTcpReady(tcp_ready* ready) } -static INLINE void FreeTcpReady(tcp_ready* ready) +static WC_INLINE void FreeTcpReady(tcp_ready* ready) { #ifdef SINGLE_THREADED (void)ready; @@ -371,7 +371,7 @@ void join_thread(THREAD_TYPE); static const word16 wolfSSLPort = 11111; -static INLINE WC_NORETURN void err_sys(const char* msg) +static WC_INLINE WC_NORETURN void err_sys(const char* msg) { printf("wolfSSL error: %s\n", msg); @@ -395,7 +395,7 @@ static INLINE WC_NORETURN void err_sys(const char* msg) extern int myoptind; extern char* myoptarg; -static INLINE int mygetopt(int argc, char** argv, const char* optstring) +static WC_INLINE int mygetopt(int argc, char** argv, const char* optstring) { static char* next = NULL; @@ -461,7 +461,7 @@ static INLINE int mygetopt(int argc, char** argv, const char* optstring) #ifdef WOLFSSL_ENCRYPTED_KEYS -static INLINE int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) +static WC_INLINE int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) { (void)rw; (void)userdata; @@ -480,7 +480,7 @@ static INLINE int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) #if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS) -static INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr) +static WC_INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr) { char* altName; char* issuer; @@ -549,7 +549,7 @@ static INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr) #endif /* KEEP_PEER_CERT || SESSION_CERTS */ #if defined(SESSION_CERTS) && defined(SHOW_CERTS) -static INLINE void ShowX509Chain(WOLFSSL_X509_CHAIN* chain, int count, +static WC_INLINE void ShowX509Chain(WOLFSSL_X509_CHAIN* chain, int count, const char* hdr) { int i; @@ -572,7 +572,7 @@ static INLINE void ShowX509Chain(WOLFSSL_X509_CHAIN* chain, int count, } #endif -static INLINE void showPeer(WOLFSSL* ssl) +static WC_INLINE void showPeer(WOLFSSL* ssl) { WOLFSSL_CIPHER* cipher; #ifdef HAVE_ECC @@ -636,7 +636,7 @@ static INLINE void showPeer(WOLFSSL* ssl) } -static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, +static WC_INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, word16 port, int udp, int sctp) { int useLookup = 0; @@ -736,7 +736,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, } -static INLINE void tcp_socket(SOCKET_T* sockfd, int udp, int sctp) +static WC_INLINE void tcp_socket(SOCKET_T* sockfd, int udp, int sctp) { (void)sctp; @@ -782,7 +782,7 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp, int sctp) #endif /* USE_WINDOWS_API */ } -static INLINE void tcp_connect(SOCKET_T* sockfd, const char* ip, word16 port, +static WC_INLINE void tcp_connect(SOCKET_T* sockfd, const char* ip, word16 port, int udp, int sctp, WOLFSSL* ssl) { SOCKADDR_IN_T addr; @@ -799,7 +799,7 @@ static INLINE void tcp_connect(SOCKET_T* sockfd, const char* ip, word16 port, } -static INLINE void udp_connect(SOCKET_T* sockfd, void* addr, int addrSz) +static WC_INLINE void udp_connect(SOCKET_T* sockfd, void* addr, int addrSz) { if (connect(*sockfd, (const struct sockaddr*)addr, addrSz) != 0) err_sys("tcp connect failed"); @@ -816,7 +816,7 @@ enum { #if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && \ !defined(WOLFSSL_TIRTOS) -static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) +static WC_INLINE int tcp_select(SOCKET_T socketfd, int to_sec) { fd_set recvfds, errfds; SOCKET_T nfds = socketfd + 1; @@ -849,14 +849,14 @@ static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) return TEST_SELECT_FAIL; } #elif defined(WOLFSSL_TIRTOS) || defined(WOLFSSL_KEIL_TCP_NET) -static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) +static WC_INLINE int tcp_select(SOCKET_T socketfd, int to_sec) { return TEST_RECV_READY; } #endif /* !WOLFSSL_MDK_ARM */ -static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, +static WC_INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, int udp, int sctp) { SOCKADDR_IN_T addr; @@ -904,7 +904,7 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, #if 0 -static INLINE int udp_read_connect(SOCKET_T sockfd) +static WC_INLINE int udp_read_connect(SOCKET_T sockfd) { SOCKADDR_IN_T cliaddr; byte b[1500]; @@ -925,7 +925,7 @@ static INLINE int udp_read_connect(SOCKET_T sockfd) } #endif -static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, +static WC_INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, int useAnyAddr, word16 port, func_args* args) { SOCKADDR_IN_T addr; @@ -982,7 +982,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, *clientfd = *sockfd; } -static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, +static WC_INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, func_args* args, word16 port, int useAnyAddr, int udp, int sctp, int ready_file, int do_listen) { @@ -1052,7 +1052,7 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, } -static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) +static WC_INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) { #ifdef USE_WINDOWS_API unsigned long blocking = 1; @@ -1078,7 +1078,7 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) /* identity is OpenSSL testing default for openssl s_client, keep same */ static const char* kIdentityStr = "Client_identity"; -static INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, +static WC_INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, char* identity, unsigned int id_max_len, unsigned char* key, unsigned int key_max_len) { @@ -1115,7 +1115,7 @@ static INLINE unsigned int my_psk_client_cb(WOLFSSL* ssl, const char* hint, } -static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, +static WC_INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, unsigned char* key, unsigned int key_max_len) { (void)ssl; @@ -1161,7 +1161,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, #define WIN32_LEAN_AND_MEAN #include - static INLINE double current_time(int reset) + static WC_INLINE double current_time(int reset) { static int init = 0; static LARGE_INTEGER freq; @@ -1186,7 +1186,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, #if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && !defined(WOLFSSL_CHIBIOS) #include - static INLINE double current_time(int reset) + static WC_INLINE double current_time(int reset) { struct timeval tv; gettimeofday(&tv, 0); @@ -1201,7 +1201,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, #if defined(HAVE_OCSP) && defined(WOLFSSL_NONBLOCK_OCSP) -static INLINE int OCSPIOCb(void* ioCtx, const char* url, int urlSz, +static WC_INLINE int OCSPIOCb(void* ioCtx, const char* url, int urlSz, unsigned char* request, int requestSz, unsigned char** response) { #ifdef TEST_NONBLOCK_CERTS @@ -1229,7 +1229,7 @@ static INLINE int OCSPIOCb(void* ioCtx, const char* url, int urlSz, #endif } -static INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) +static WC_INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) { (void)ioCtx; (void)response; @@ -1241,7 +1241,7 @@ static INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) (defined(NO_FILESYSTEM) && defined(FORCE_BUFFER_TEST)) /* reads file size, allocates buffer, reads into buffer, returns buffer */ - static INLINE int load_file(const char* fname, byte** buf, size_t* bufLen) + static WC_INLINE int load_file(const char* fname, byte** buf, size_t* bufLen) { int ret; long int fileSz; @@ -1293,7 +1293,7 @@ static INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) WOLFSSL_CERT_CHAIN = 4, }; - static INLINE void load_buffer(WOLFSSL_CTX* ctx, const char* fname, int type) + static WC_INLINE void load_buffer(WOLFSSL_CTX* ctx, const char* fname, int type) { int format = WOLFSSL_FILETYPE_PEM; byte* buff = NULL; @@ -1334,7 +1334,7 @@ static INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) } #ifdef TEST_PK_PRIVKEY - static INLINE int load_key_file(const char* fname, byte** derBuf, word32* derLen) + static WC_INLINE int load_key_file(const char* fname, byte** derBuf, word32* derLen) { int ret; byte* buf = NULL; @@ -1366,7 +1366,7 @@ static INLINE void OCSPRespFreeCb(void* ioCtx, unsigned char* response) #endif /* !NO_FILESYSTEM || (NO_FILESYSTEM && FORCE_BUFFER_TEST) */ #endif /* !NO_CERTS */ -static INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store) +static WC_INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store) { char buffer[WOLFSSL_MAX_ERROR_SZ]; #ifdef OPENSSL_EXTRA @@ -1409,7 +1409,7 @@ static INLINE int myVerify(int preverify, WOLFSSL_X509_STORE_CTX* store) } -static INLINE int myDateCb(int preverify, WOLFSSL_X509_STORE_CTX* store) +static WC_INLINE int myDateCb(int preverify, WOLFSSL_X509_STORE_CTX* store) { char buffer[WOLFSSL_MAX_ERROR_SZ]; (void)preverify; @@ -1430,7 +1430,7 @@ static INLINE int myDateCb(int preverify, WOLFSSL_X509_STORE_CTX* store) #ifdef HAVE_EXT_CACHE -static INLINE WOLFSSL_SESSION* mySessGetCb(WOLFSSL* ssl, unsigned char* id, +static WC_INLINE WOLFSSL_SESSION* mySessGetCb(WOLFSSL* ssl, unsigned char* id, int id_len, int* copy) { (void)ssl; @@ -1442,7 +1442,7 @@ static INLINE WOLFSSL_SESSION* mySessGetCb(WOLFSSL* ssl, unsigned char* id, return NULL; } -static INLINE int mySessNewCb(WOLFSSL* ssl, WOLFSSL_SESSION* session) +static WC_INLINE int mySessNewCb(WOLFSSL* ssl, WOLFSSL_SESSION* session) { (void)ssl; (void)session; @@ -1451,7 +1451,7 @@ static INLINE int mySessNewCb(WOLFSSL* ssl, WOLFSSL_SESSION* session) return 0; } -static INLINE void mySessRemCb(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* session) +static WC_INLINE void mySessRemCb(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* session) { (void)ctx; (void)session; @@ -1464,7 +1464,7 @@ static INLINE void mySessRemCb(WOLFSSL_CTX* ctx, WOLFSSL_SESSION* session) #ifdef HAVE_CRL -static INLINE void CRL_CallBack(const char* url) +static WC_INLINE void CRL_CallBack(const char* url) { printf("CRL callback url = %s\n", url); } @@ -1472,7 +1472,7 @@ static INLINE void CRL_CallBack(const char* url) #endif #ifndef NO_DH -static INLINE void SetDH(WOLFSSL* ssl) +static WC_INLINE void SetDH(WOLFSSL* ssl) { /* dh1024 p */ static const unsigned char p[] = @@ -1499,7 +1499,7 @@ static INLINE void SetDH(WOLFSSL* ssl) wolfSSL_SetTmpDH(ssl, p, sizeof(p), g, sizeof(g)); } -static INLINE void SetDHCtx(WOLFSSL_CTX* ctx) +static WC_INLINE void SetDHCtx(WOLFSSL_CTX* ctx) { /* dh1024 p */ static const unsigned char p[] = @@ -1529,7 +1529,7 @@ static INLINE void SetDHCtx(WOLFSSL_CTX* ctx) #ifndef NO_CERTS -static INLINE void CaCb(unsigned char* der, int sz, int type) +static WC_INLINE void CaCb(unsigned char* der, int sz, int type) { (void)der; printf("Got CA cache add callback, derSz = %d, type = %d\n", sz, type); @@ -1544,7 +1544,7 @@ static INLINE void CaCb(unsigned char* der, int sz, int type) /* Maximum depth to search for WolfSSL root */ #define MAX_WOLF_ROOT_DEPTH 5 - static INLINE int ChangeToWolfRoot(void) + static WC_INLINE int ChangeToWolfRoot(void) { #if !defined(NO_FILESYSTEM) || defined(FORCE_BUFFER_TEST) int depth, res; @@ -1579,7 +1579,7 @@ static INLINE void CaCb(unsigned char* der, int sz, int type) typedef THREAD_RETURN WOLFSSL_THREAD (*thread_func)(void* args); #define STACK_CHECK_VAL 0x01 -static INLINE int StackSizeCheck(func_args* args, thread_func tf) +static WC_INLINE int StackSizeCheck(func_args* args, thread_func tf) { int ret, i, used; void* status; @@ -1648,7 +1648,7 @@ static INLINE int StackSizeCheck(func_args* args, thread_func tf) #error "can't use STACK_TRAP with STACK_SIZE, setrlimit will fail" #endif /* HAVE_STACK_SIZE */ -static INLINE void StackTrap(void) +static WC_INLINE void StackTrap(void) { struct rlimit rl; if (getrlimit(RLIMIT_STACK, &rl) != 0) @@ -1663,7 +1663,7 @@ static INLINE void StackTrap(void) #else /* STACK_TRAP */ -static INLINE void StackTrap(void) +static WC_INLINE void StackTrap(void) { } @@ -1686,7 +1686,7 @@ typedef struct AtomicDecCtx { } AtomicDecCtx; -static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, +static WC_INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, const unsigned char* macIn, unsigned int macInSz, int macContent, int macVerify, unsigned char* encOut, const unsigned char* encIn, unsigned int encSz, void* ctx) @@ -1754,7 +1754,7 @@ static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, } -static INLINE int myDecryptVerifyCb(WOLFSSL* ssl, +static WC_INLINE int myDecryptVerifyCb(WOLFSSL* ssl, unsigned char* decOut, const unsigned char* decIn, unsigned int decSz, int macContent, int macVerify, unsigned int* padSz, void* ctx) @@ -1852,7 +1852,7 @@ static INLINE int myDecryptVerifyCb(WOLFSSL* ssl, } -static INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl) +static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl) { AtomicEncCtx* encCtx; AtomicDecCtx* decCtx; @@ -1877,7 +1877,7 @@ static INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl) } -static INLINE void FreeAtomicUser(WOLFSSL* ssl) +static WC_INLINE void FreeAtomicUser(WOLFSSL* ssl) { AtomicEncCtx* encCtx = (AtomicEncCtx*)wolfSSL_GetMacEncryptCtx(ssl); AtomicDecCtx* decCtx = (AtomicDecCtx*)wolfSSL_GetDecryptVerifyCtx(ssl); @@ -1889,7 +1889,7 @@ static INLINE void FreeAtomicUser(WOLFSSL* ssl) #endif /* ATOMIC_USER */ #ifdef WOLFSSL_STATIC_MEMORY -static INLINE int wolfSSL_PrintStats(WOLFSSL_MEM_STATS* stats) +static WC_INLINE int wolfSSL_PrintStats(WOLFSSL_MEM_STATS* stats) { word16 i; @@ -1922,7 +1922,7 @@ typedef struct PkCbInfo { #ifdef HAVE_ECC -static INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz, +static WC_INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) { int ret; @@ -1962,7 +1962,7 @@ static INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz, } -static INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz, +static WC_INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz, const byte* hash, word32 hashSz, const byte* key, word32 keySz, int* result, void* ctx) { @@ -1985,7 +1985,7 @@ static INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz, return ret; } -static INLINE int myEccSharedSecret(WOLFSSL* ssl, ecc_key* otherKey, +static WC_INLINE int myEccSharedSecret(WOLFSSL* ssl, ecc_key* otherKey, unsigned char* pubKeyDer, unsigned int* pubKeySz, unsigned char* out, unsigned int* outlen, int side, void* ctx) @@ -2054,7 +2054,7 @@ static INLINE int myEccSharedSecret(WOLFSSL* ssl, ecc_key* otherKey, } #ifdef HAVE_ED25519 -static INLINE int myEd25519Sign(WOLFSSL* ssl, const byte* in, word32 inSz, +static WC_INLINE int myEd25519Sign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) { int ret; @@ -2088,7 +2088,7 @@ static INLINE int myEd25519Sign(WOLFSSL* ssl, const byte* in, word32 inSz, } -static INLINE int myEd25519Verify(WOLFSSL* ssl, const byte* sig, word32 sigSz, +static WC_INLINE int myEd25519Verify(WOLFSSL* ssl, const byte* sig, word32 sigSz, const byte* msg, word32 msgSz, const byte* key, word32 keySz, int* result, void* ctx) { @@ -2113,7 +2113,7 @@ static INLINE int myEd25519Verify(WOLFSSL* ssl, const byte* sig, word32 sigSz, #endif /* HAVE_ED25519 */ #ifdef HAVE_CURVE25519 -static INLINE int myX25519SharedSecret(WOLFSSL* ssl, curve25519_key* otherKey, +static WC_INLINE int myX25519SharedSecret(WOLFSSL* ssl, curve25519_key* otherKey, unsigned char* pubKeyDer, unsigned int* pubKeySz, unsigned char* out, unsigned int* outlen, int side, void* ctx) @@ -2177,7 +2177,7 @@ static INLINE int myX25519SharedSecret(WOLFSSL* ssl, curve25519_key* otherKey, #endif /* HAVE_ECC */ #ifndef NO_DH -static INLINE int myDhCallback(WOLFSSL* ssl, struct DhKey* key, +static WC_INLINE int myDhCallback(WOLFSSL* ssl, struct DhKey* key, const unsigned char* priv, unsigned int privSz, const unsigned char* pubKeyDer, unsigned int pubKeySz, unsigned char* out, unsigned int* outlen, @@ -2196,7 +2196,7 @@ static INLINE int myDhCallback(WOLFSSL* ssl, struct DhKey* key, #ifndef NO_RSA -static INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, +static WC_INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) { WC_RNG rng; @@ -2240,7 +2240,7 @@ static INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, } -static INLINE int myRsaVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, +static WC_INLINE int myRsaVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, byte** out, const byte* key, word32 keySz, void* ctx) { int ret; @@ -2262,7 +2262,7 @@ static INLINE int myRsaVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, return ret; } -static INLINE int myRsaSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, +static WC_INLINE int myRsaSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, byte** out, const byte* key, word32 keySz, void* ctx) { int ret; @@ -2295,7 +2295,7 @@ static INLINE int myRsaSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, } #ifdef WC_RSA_PSS -static INLINE int myRsaPssSign(WOLFSSL* ssl, const byte* in, word32 inSz, +static WC_INLINE int myRsaPssSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz, int hash, int mgf, const byte* key, word32 keySz, void* ctx) { @@ -2361,7 +2361,7 @@ static INLINE int myRsaPssSign(WOLFSSL* ssl, const byte* in, word32 inSz, } -static INLINE int myRsaPssVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, +static WC_INLINE int myRsaPssVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, byte** out, int hash, int mgf, const byte* key, word32 keySz, void* ctx) { int ret; @@ -2404,7 +2404,7 @@ static INLINE int myRsaPssVerify(WOLFSSL* ssl, byte* sig, word32 sigSz, return ret; } -static INLINE int myRsaPssSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, +static WC_INLINE int myRsaPssSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, byte** out, int hash, int mgf, const byte* key, word32 keySz, void* ctx) { int ret; @@ -2460,7 +2460,7 @@ static INLINE int myRsaPssSignCheck(WOLFSSL* ssl, byte* sig, word32 sigSz, #endif -static INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, +static WC_INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out, word32* outSz, const byte* key, word32 keySz, void* ctx) { @@ -2494,7 +2494,7 @@ static INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, return ret; } -static INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz, +static WC_INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz, byte** out, const byte* key, word32 keySz, void* ctx) { @@ -2538,7 +2538,7 @@ static INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz, #endif /* NO_RSA */ -static INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx) +static WC_INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx) { (void)ctx; @@ -2571,7 +2571,7 @@ static INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx) #endif /* NO_RSA */ } -static INLINE void SetupPkCallbackContexts(WOLFSSL* ssl, void* myCtx) +static WC_INLINE void SetupPkCallbackContexts(WOLFSSL* ssl, void* myCtx) { #ifdef HAVE_ECC wolfSSL_SetEccSignCtx(ssl, myCtx); @@ -2609,7 +2609,7 @@ static INLINE void SetupPkCallbackContexts(WOLFSSL* ssl, void* myCtx) || defined(_MSC_VER) /* HP/UX doesn't have strsep, needed by test/suites.c */ -static INLINE char* strsep(char **stringp, const char *delim) +static WC_INLINE char* strsep(char **stringp, const char *delim) { char* start; char* end; @@ -2633,7 +2633,7 @@ static INLINE char* strsep(char **stringp, const char *delim) /* Create unique filename, len is length of tempfn name, assuming len does not include null terminating character, num is number of characters in tempfn name to randomize */ -static INLINE const char* mymktemp(char *tempfn, int len, int num) +static WC_INLINE const char* mymktemp(char *tempfn, int len, int num) { int x, size; static const char alphanum[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -2682,7 +2682,7 @@ static INLINE const char* mymktemp(char *tempfn, int len, int num) static key_ctx myKey_ctx; static WC_RNG myKey_rng; - static INLINE int TicketInit(void) + static WC_INLINE int TicketInit(void) { int ret = wc_InitRng(&myKey_rng); if (ret != 0) return ret; @@ -2696,12 +2696,12 @@ static INLINE const char* mymktemp(char *tempfn, int len, int num) return 0; } - static INLINE void TicketCleanup(void) + static WC_INLINE void TicketCleanup(void) { wc_FreeRng(&myKey_rng); } - static INLINE int myTicketEncCb(WOLFSSL* ssl, + static WC_INLINE int myTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ], byte iv[WOLFSSL_TICKET_IV_SZ], byte mac[WOLFSSL_TICKET_MAC_SZ], @@ -2767,7 +2767,7 @@ static INLINE const char* mymktemp(char *tempfn, int len, int num) #endif /* HAVE_SESSION_TICKET && CHACHA20 && POLY1305 */ -static INLINE word16 GetRandomPort(void) +static WC_INLINE word16 GetRandomPort(void) { word16 port = 0; diff --git a/wolfssl/wolfcrypt/blake2-impl.h b/wolfssl/wolfcrypt/blake2-impl.h index c0632d6cb..8281842dc 100644 --- a/wolfssl/wolfcrypt/blake2-impl.h +++ b/wolfssl/wolfcrypt/blake2-impl.h @@ -38,7 +38,7 @@ #include -static INLINE word32 load32( const void *src ) +static WC_INLINE word32 load32( const void *src ) { #if defined(LITTLE_ENDIAN_ORDER) return *( word32 * )( src ); @@ -52,7 +52,7 @@ static INLINE word32 load32( const void *src ) #endif } -static INLINE word64 load64( const void *src ) +static WC_INLINE word64 load64( const void *src ) { #if defined(LITTLE_ENDIAN_ORDER) return *( word64 * )( src ); @@ -70,7 +70,7 @@ static INLINE word64 load64( const void *src ) #endif } -static INLINE void store32( void *dst, word32 w ) +static WC_INLINE void store32( void *dst, word32 w ) { #if defined(LITTLE_ENDIAN_ORDER) *( word32 * )( dst ) = w; @@ -83,7 +83,7 @@ static INLINE void store32( void *dst, word32 w ) #endif } -static INLINE void store64( void *dst, word64 w ) +static WC_INLINE void store64( void *dst, word64 w ) { #if defined(LITTLE_ENDIAN_ORDER) *( word64 * )( dst ) = w; @@ -100,7 +100,7 @@ static INLINE void store64( void *dst, word64 w ) #endif } -static INLINE word64 load48( const void *src ) +static WC_INLINE word64 load48( const void *src ) { const byte *p = ( const byte * )src; word64 w = *p++; @@ -112,7 +112,7 @@ static INLINE word64 load48( const void *src ) return w; } -static INLINE void store48( void *dst, word64 w ) +static WC_INLINE void store48( void *dst, word64 w ) { byte *p = ( byte * )dst; *p++ = ( byte )w; w >>= 8; @@ -123,28 +123,28 @@ static INLINE void store48( void *dst, word64 w ) *p++ = ( byte )w; } -static INLINE word32 rotl32( const word32 w, const unsigned c ) +static WC_INLINE word32 rotl32( const word32 w, const unsigned c ) { return ( w << c ) | ( w >> ( 32 - c ) ); } -static INLINE word64 rotl64( const word64 w, const unsigned c ) +static WC_INLINE word64 rotl64( const word64 w, const unsigned c ) { return ( w << c ) | ( w >> ( 64 - c ) ); } -static INLINE word32 rotr32( const word32 w, const unsigned c ) +static WC_INLINE word32 rotr32( const word32 w, const unsigned c ) { return ( w >> c ) | ( w << ( 32 - c ) ); } -static INLINE word64 rotr64( const word64 w, const unsigned c ) +static WC_INLINE word64 rotr64( const word64 w, const unsigned c ) { return ( w >> c ) | ( w << ( 64 - c ) ); } /* prevents compiler optimizing out memset() */ -static INLINE void secure_zero_memory( void *v, word64 n ) +static WC_INLINE void secure_zero_memory( void *v, word64 n ) { volatile byte *p = ( volatile byte * )v; diff --git a/wolfssl/wolfcrypt/blake2-int.h b/wolfssl/wolfcrypt/blake2-int.h index 0a01a2154..d94aa31f6 100644 --- a/wolfssl/wolfcrypt/blake2-int.h +++ b/wolfssl/wolfcrypt/blake2-int.h @@ -169,7 +169,7 @@ int blake2sp( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ); int blake2bp( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ); - static INLINE int blake2( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ) + static WC_INLINE int blake2( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ) { return blake2b( out, in, key, outlen, inlen, keylen ); } diff --git a/wolfssl/wolfcrypt/mem_track.h b/wolfssl/wolfcrypt/mem_track.h index 2f73573c9..afc4d5b1e 100644 --- a/wolfssl/wolfcrypt/mem_track.h +++ b/wolfssl/wolfcrypt/mem_track.h @@ -106,9 +106,9 @@ #endif #ifdef WOLFSSL_DEBUG_MEMORY - STATIC INLINE void* TrackMalloc(size_t sz, const char* func, unsigned int line) + STATIC WC_INLINE void* TrackMalloc(size_t sz, const char* func, unsigned int line) #else - STATIC INLINE void* TrackMalloc(size_t sz) + STATIC WC_INLINE void* TrackMalloc(size_t sz) #endif { memoryTrack* mt; @@ -140,9 +140,9 @@ #ifdef WOLFSSL_DEBUG_MEMORY - STATIC INLINE void TrackFree(void* ptr, const char* func, unsigned int line) + STATIC WC_INLINE void TrackFree(void* ptr, const char* func, unsigned int line) #else - STATIC INLINE void TrackFree(void* ptr) + STATIC WC_INLINE void TrackFree(void* ptr) #endif { memoryTrack* mt; @@ -168,9 +168,9 @@ #ifdef WOLFSSL_DEBUG_MEMORY - STATIC INLINE void* TrackRealloc(void* ptr, size_t sz, const char* func, unsigned int line) + STATIC WC_INLINE void* TrackRealloc(void* ptr, size_t sz, const char* func, unsigned int line) #else - STATIC INLINE void* TrackRealloc(void* ptr, size_t sz) + STATIC WC_INLINE void* TrackRealloc(void* ptr, size_t sz) #endif { #ifdef WOLFSSL_DEBUG_MEMORY @@ -203,7 +203,7 @@ } #ifdef WOLFSSL_TRACK_MEMORY - STATIC INLINE int InitMemoryTracker(void) + STATIC WC_INLINE int InitMemoryTracker(void) { int ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc); if (ret < 0) { @@ -222,7 +222,7 @@ return ret; } - STATIC INLINE void ShowMemoryTracker(void) + STATIC WC_INLINE void ShowMemoryTracker(void) { #ifdef DO_MEM_STATS printf("total Allocs = %9lu\n", diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index c060e1f9b..8591e51a5 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -128,28 +128,32 @@ #define WOLFSSL_MAX_16BIT 0xffffU /* use inlining if compiler allows */ - #ifndef INLINE + #ifndef WC_INLINE #ifndef NO_INLINE #ifdef _MSC_VER - #define INLINE __inline + #define WC_INLINE __inline #elif defined(__GNUC__) #ifdef WOLFSSL_VXWORKS - #define INLINE __inline__ + #define WC_INLINE __inline__ #else - #define INLINE inline + #define WC_INLINE inline #endif #elif defined(__IAR_SYSTEMS_ICC__) - #define INLINE inline + #define WC_INLINE inline #elif defined(THREADX) - #define INLINE _Inline + #define WC_INLINE _Inline #else - #define INLINE + #define WC_INLINE #endif #else - #define INLINE + #define WC_INLINE #endif #endif + #if defined(HAVE_FIPS) || defined(HAVE_SELFTEST) + #define INLINE WC_INLINE + #endif + /* set up rotate style */ #if (defined(_MSC_VER) || defined(__BCPLUSPLUS__)) && \