forked from wolfSSL/wolfssl
Fix to compile with c89
strncasecmp and snprintf are unavailable in C89 use // static analyzer suppressions
This commit is contained in:
committed by
Daniel Pouzzner
parent
f93b23b524
commit
aca199cb05
@@ -12388,7 +12388,11 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
|||||||
hour = ts->tm_hour;
|
hour = ts->tm_hour;
|
||||||
mini = ts->tm_min;
|
mini = ts->tm_min;
|
||||||
sec = ts->tm_sec;
|
sec = ts->tm_sec;
|
||||||
ret = XSNPRINTF((char*)buf, len,
|
#if defined(WOLF_C89)
|
||||||
|
ret = XSPRINTF((char*)buf,
|
||||||
|
#else
|
||||||
|
ret = XSNPRINTF((char*)buf, len,
|
||||||
|
#endif
|
||||||
"%02d%02d%02d%02d%02d%02dZ", year, mon, day,
|
"%02d%02d%02d%02d%02d%02dZ", year, mon, day,
|
||||||
hour, mini, sec);
|
hour, mini, sec);
|
||||||
}
|
}
|
||||||
@@ -12400,7 +12404,11 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
|||||||
hour = ts->tm_hour;
|
hour = ts->tm_hour;
|
||||||
mini = ts->tm_min;
|
mini = ts->tm_min;
|
||||||
sec = ts->tm_sec;
|
sec = ts->tm_sec;
|
||||||
ret = XSNPRINTF((char*)buf, len,
|
#if defined(WOLF_C89)
|
||||||
|
ret = XSPRINTF((char*)buf,
|
||||||
|
#else
|
||||||
|
ret = XSNPRINTF((char*)buf, len,
|
||||||
|
#endif
|
||||||
"%4d%02d%02d%02d%02d%02dZ", year, mon, day,
|
"%4d%02d%02d%02d%02d%02dZ", year, mon, day,
|
||||||
hour, mini, sec);
|
hour, mini, sec);
|
||||||
}
|
}
|
||||||
|
@@ -889,7 +889,7 @@ int mp_lshd (mp_int * a, int b)
|
|||||||
#if defined(FREESCALE_LTC_TFM)
|
#if defined(FREESCALE_LTC_TFM)
|
||||||
int wolfcrypt_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
int wolfcrypt_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||||
#else
|
#else
|
||||||
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) // NOLINT(misc-no-recursion)
|
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) /* //NOLINT(misc-no-recursion) */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int dr;
|
int dr;
|
||||||
@@ -1996,7 +1996,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y,
|
|||||||
* one of many reduction algorithms without modding the guts of
|
* one of many reduction algorithms without modding the guts of
|
||||||
* the code with if statements everywhere.
|
* the code with if statements everywhere.
|
||||||
*/
|
*/
|
||||||
int (*redux)(mp_int*,mp_int*,mp_digit) = NULL; // cppcheck-suppress nullPointerRedundantCheck // cppcheck 2.6.3 false positive
|
int (*redux)(mp_int*,mp_int*,mp_digit) = NULL;
|
||||||
|
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
M = (mp_int*) XMALLOC(sizeof(mp_int) * TAB_SIZE, NULL,
|
M = (mp_int*) XMALLOC(sizeof(mp_int) * TAB_SIZE, NULL,
|
||||||
@@ -4335,7 +4335,7 @@ int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
|
|||||||
(!defined(NO_RSA) && !defined(NO_RSA_BOUNDS_CHECK))
|
(!defined(NO_RSA) && !defined(NO_RSA_BOUNDS_CHECK))
|
||||||
|
|
||||||
/* single digit addition */
|
/* single digit addition */
|
||||||
int mp_add_d (mp_int* a, mp_digit b, mp_int* c) // NOLINT(misc-no-recursion)
|
int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) */
|
||||||
{
|
{
|
||||||
int res, ix, oldused;
|
int res, ix, oldused;
|
||||||
mp_digit *tmpa, *tmpc, mu;
|
mp_digit *tmpa, *tmpc, mu;
|
||||||
@@ -4433,7 +4433,7 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) // NOLINT(misc-no-recursion)
|
|||||||
|
|
||||||
|
|
||||||
/* single digit subtraction */
|
/* single digit subtraction */
|
||||||
int mp_sub_d (mp_int * a, mp_digit b, mp_int * c) // NOLINT(misc-no-recursion)
|
int mp_sub_d (mp_int * a, mp_digit b, mp_int * c) /* //NOLINT(misc-no-recursion) */
|
||||||
{
|
{
|
||||||
mp_digit *tmpa, *tmpc, mu;
|
mp_digit *tmpa, *tmpc, mu;
|
||||||
int res, ix, oldused;
|
int res, ix, oldused;
|
||||||
|
@@ -3586,7 +3586,7 @@ int fp_montgomery_reduce_ex(fp_int *a, fp_int *m, fp_digit mp, int ct)
|
|||||||
++_c;
|
++_c;
|
||||||
}
|
}
|
||||||
LOOP_END;
|
LOOP_END;
|
||||||
while (cy) { // NOLINT(bugprone-infinite-loop) /* PROPCARRY is an asm macro */
|
while (cy) { /* //NOLINT(bugprone-infinite-loop) */ /* PROPCARRY is an asm macro */
|
||||||
PROPCARRY;
|
PROPCARRY;
|
||||||
++_c;
|
++_c;
|
||||||
}
|
}
|
||||||
|
@@ -34995,7 +34995,11 @@ static int pkcs7signed_run_vectors(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (j = 0, k = 2; j < (int)sizeof(digest); j++, k += 2) {
|
for (j = 0, k = 2; j < (int)sizeof(digest); j++, k += 2) {
|
||||||
XSNPRINTF((char*)&transId[k], 3, "%02x", digest[j]);
|
#if defined(WOLF_C89)
|
||||||
|
XSPRINTF((char*)&transId[k], "%02x", digest[j]);
|
||||||
|
#else
|
||||||
|
XSNPRINTF((char*)&transId[k], 3, "%02x", digest[j]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -651,6 +651,8 @@ decouple library dependencies with standard string, memory and so on.
|
|||||||
#define XSTRCASECMP(s1,s2) stricmp((s1),(s2))
|
#define XSTRCASECMP(s1,s2) stricmp((s1),(s2))
|
||||||
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
||||||
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
||||||
|
#elif defined(WOLF_C89)
|
||||||
|
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
||||||
#else
|
#else
|
||||||
#define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2))
|
#define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2))
|
||||||
#endif
|
#endif
|
||||||
@@ -678,6 +680,8 @@ decouple library dependencies with standard string, memory and so on.
|
|||||||
#define XSTRNCASECMP(s1,s2,n) strnicmp((s1),(s2),(n))
|
#define XSTRNCASECMP(s1,s2,n) strnicmp((s1),(s2),(n))
|
||||||
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
||||||
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
|
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||||
|
#elif defined(WOLF_C89)
|
||||||
|
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||||
#else
|
#else
|
||||||
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
|
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
|
||||||
#endif
|
#endif
|
||||||
@@ -723,6 +727,8 @@ decouple library dependencies with standard string, memory and so on.
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#define XSNPRINTF _xsnprintf_
|
#define XSNPRINTF _xsnprintf_
|
||||||
|
#elif defined(WOLF_C89)
|
||||||
|
#define XSPRINTF sprintf
|
||||||
#else
|
#else
|
||||||
#define XSNPRINTF snprintf
|
#define XSNPRINTF snprintf
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user