src/ssl.c: remove frivolous (void)heap to clear -Wdeclaration-after-statement.

wolfcrypt/src/aes.c: add NEED_AES_TABLES gate around AesSetKey_C() implementations (fixes WOLFSSL_KCAPI_AES builds, probably among others).

wolfcrypt/src/sp_int.c: add missing casts to clear -Wconversions.
This commit is contained in:
Daniel Pouzzner
2023-11-28 23:25:31 -06:00
parent 12ee732fe2
commit 4642077146
3 changed files with 12 additions and 4 deletions

View File

@@ -30149,7 +30149,7 @@ static int set_curves_list(WOLFSSL* ssl, WOLFSSL_CTX *ctx, const char* names)
char name[MAX_CURVE_NAME_SZ]; char name[MAX_CURVE_NAME_SZ];
byte groups_len = 0; byte groups_len = 0;
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
void *heap = ssl? ssl->heap : ctx ? ctx->heap : NULL; (void)heap; void *heap = ssl? ssl->heap : ctx ? ctx->heap : NULL;
int *groups; int *groups;
#else #else
int groups[WOLFSSL_MAX_GROUP_COUNT]; int groups[WOLFSSL_MAX_GROUP_COUNT];

View File

@@ -3885,6 +3885,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
* and we need both HW and SW. */ * and we need both HW and SW. */
#ifdef NEED_SOFTWARE_AES_SETKEY #ifdef NEED_SOFTWARE_AES_SETKEY
#ifdef NEED_AES_TABLES
#ifndef WC_AES_BITSLICED #ifndef WC_AES_BITSLICED
/* Set the AES key and expand. /* Set the AES key and expand.
* *
@@ -4125,6 +4127,8 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
} }
#endif /* WC_AES_BITSLICED */ #endif /* WC_AES_BITSLICED */
#endif /* NEED_AES_TABLES */
/* Software AES - SetKey */ /* Software AES - SetKey */
static WARN_UNUSED_RESULT int wc_AesSetKeyLocal( static WARN_UNUSED_RESULT int wc_AesSetKeyLocal(
Aes* aes, const byte* userKey, word32 keylen, const byte* iv, int dir, Aes* aes, const byte* userKey, word32 keylen, const byte* iv, int dir,

View File

@@ -7687,7 +7687,7 @@ static void sp_clamp_ct(sp_int* a)
unsigned int used = a->used; unsigned int used = a->used;
unsigned int mask = (unsigned int)-1; unsigned int mask = (unsigned int)-1;
for (i = a->used-1; i >= 0; i--) { for (i = (int)a->used - 1; i >= 0; i--) {
used -= ((unsigned int)(a->dp[i] == 0)) & mask; used -= ((unsigned int)(a->dp[i] == 0)) & mask;
mask &= (unsigned int)0 - (a->dp[i] == 0); mask &= (unsigned int)0 - (a->dp[i] == 0);
} }
@@ -17072,7 +17072,9 @@ static int _sp_mont_red(sp_int* a, const sp_int* m, sp_int_digit mp, int ct)
} }
else { else {
for (i = 0; i < m->used * 2; i++) { for (i = 0; i < m->used * 2; i++) {
a->dp[i] &= (sp_int_digit)(sp_int_sdigit)ctMaskIntGTE(a->used-1, i); a->dp[i] &=
(sp_int_digit)
(sp_int_sdigit)ctMaskIntGTE((int)(a->used-1), (int)i);
} }
} }
@@ -17195,7 +17197,9 @@ static int _sp_mont_red(sp_int* a, const sp_int* m, sp_int_digit mp, int ct)
} }
else { else {
for (i = 0; i < m->used * 2; i++) { for (i = 0; i < m->used * 2; i++) {
a->dp[i] &= (sp_int_digit)(sp_int_sdigit)ctMaskIntGTE(a->used-1, i); a->dp[i] &=
(sp_int_digit)
(sp_int_sdigit)ctMaskIntGTE((int)(a->used-1), (int)i);
} }
} }