Merge pull request #6973 from douzzer/20231115-misc-fixits

20231115-misc-fixits
This commit is contained in:
JacobBarthelmeh
2023-11-15 15:27:25 -07:00
committed by GitHub
8 changed files with 86 additions and 31 deletions

View File

@@ -859,11 +859,11 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
#endif
#elif defined(WOLFSSL_KCAPI_AES)
/* Only CBC and GCM that are in wolfcrypt/src/port/kcapi/kcapi_aes.c */
/* Only CBC and GCM are in wolfcrypt/src/port/kcapi/kcapi_aes.c */
#if defined(WOLFSSL_AES_COUNTER) || defined(HAVE_AESCCM) || \
defined(WOLFSSL_CMAC) || defined(WOLFSSL_AES_OFB) || \
defined(WOLFSSL_AES_CFB) || defined(HAVE_AES_ECB) || \
defined(WOLFSSL_AES_DIRECT) || \
defined(WOLFSSL_AES_DIRECT) || defined(WOLFSSL_AES_XTS) || \
(defined(HAVE_AES_CBC) && defined(WOLFSSL_NO_KCAPI_AES_CBC))
#define NEED_AES_TABLES
@@ -5460,8 +5460,12 @@ int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
#else
while (blocks--) {
int ret;
#ifdef WOLFSSL_AESNI
ret = wc_AesDecrypt(aes, in, out);
#else
XMEMCPY(aes->tmp, in, AES_BLOCK_SIZE);
ret = wc_AesDecrypt(aes, (byte*)aes->tmp, out);
#endif
if (ret != 0)
return ret;
xorbuf(out, (byte*)aes->reg, AES_BLOCK_SIZE);

View File

@@ -2922,7 +2922,7 @@ time_t mynewt_time(time_t* timer)
#endif /* WOLFSSL_APACHE_MYNEWT */
#if defined(WOLFSSL_GMTIME)
struct tm* gmtime(const time_t* timer)
struct tm* gmtime_r(const time_t* timer, struct tm *ret)
{
#define YEAR0 1900
#define EPOCH_YEAR 1970
@@ -2936,8 +2936,6 @@ struct tm* gmtime(const time_t* timer)
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
static struct tm st_time;
struct tm* ret = &st_time;
time_t secs = *timer;
unsigned long dayclock, dayno;
int year = EPOCH_YEAR;
@@ -2971,6 +2969,12 @@ struct tm* gmtime(const time_t* timer)
return ret;
}
struct tm* gmtime(const time_t* timer) {
static struct tm st_time;
return gmtime_r(timer, &st_time);
}
#endif /* WOLFSSL_GMTIME */