mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Merge pull request #5097 from tmael/c89_fixes
Fix for c89, use WOLF_C89
This commit is contained in:
@ -12388,7 +12388,15 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
||||
hour = ts->tm_hour;
|
||||
mini = ts->tm_min;
|
||||
sec = ts->tm_sec;
|
||||
#if defined(WOLF_C89)
|
||||
if (len < 14) {
|
||||
WOLFSSL_MSG("buffer for GetFormattedTime is too short.");
|
||||
return BUFFER_E;
|
||||
}
|
||||
ret = XSPRINTF((char*)buf,
|
||||
#else
|
||||
ret = XSNPRINTF((char*)buf, len,
|
||||
#endif
|
||||
"%02d%02d%02d%02d%02d%02dZ", year, mon, day,
|
||||
hour, mini, sec);
|
||||
}
|
||||
@ -12400,7 +12408,15 @@ int GetFormattedTime(void* currTime, byte* buf, word32 len)
|
||||
hour = ts->tm_hour;
|
||||
mini = ts->tm_min;
|
||||
sec = ts->tm_sec;
|
||||
#if defined(WOLF_C89)
|
||||
if (len < 16) {
|
||||
WOLFSSL_MSG("buffer for GetFormattedTime is too short.");
|
||||
return BUFFER_E;
|
||||
}
|
||||
ret = XSPRINTF((char*)buf,
|
||||
#else
|
||||
ret = XSNPRINTF((char*)buf, len,
|
||||
#endif
|
||||
"%4d%02d%02d%02d%02d%02dZ", year, mon, day,
|
||||
hour, mini, sec);
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ int mp_lshd (mp_int * a, int b)
|
||||
#if defined(FREESCALE_LTC_TFM)
|
||||
int wolfcrypt_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
#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
|
||||
{
|
||||
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
|
||||
* 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
|
||||
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))
|
||||
|
||||
/* 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;
|
||||
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 */
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
++_c;
|
||||
}
|
||||
|
@ -34995,7 +34995,11 @@ static int pkcs7signed_run_vectors(
|
||||
#endif
|
||||
|
||||
for (j = 0, k = 2; j < (int)sizeof(digest); j++, k += 2) {
|
||||
#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))
|
||||
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
||||
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
||||
#elif defined(WOLF_C89)
|
||||
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
||||
#else
|
||||
#define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2))
|
||||
#endif
|
||||
@ -678,6 +680,8 @@ decouple library dependencies with standard string, memory and so on.
|
||||
#define XSTRNCASECMP(s1,s2,n) strnicmp((s1),(s2),(n))
|
||||
#elif defined(WOLFSSL_CMSIS_RTOSv2)
|
||||
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||
#elif defined(WOLF_C89)
|
||||
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
|
||||
#else
|
||||
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
|
||||
#endif
|
||||
@ -723,6 +727,8 @@ decouple library dependencies with standard string, memory and so on.
|
||||
return ret;
|
||||
}
|
||||
#define XSNPRINTF _xsnprintf_
|
||||
#elif defined(WOLF_C89)
|
||||
#define XSPRINTF sprintf
|
||||
#else
|
||||
#define XSNPRINTF snprintf
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user