Skip to content

Commit 4642077

Browse files
committed
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.
1 parent 12ee732 commit 4642077

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30149,7 +30149,7 @@ static int set_curves_list(WOLFSSL* ssl, WOLFSSL_CTX *ctx, const char* names)
3014930149
char name[MAX_CURVE_NAME_SZ];
3015030150
byte groups_len = 0;
3015130151
#ifdef WOLFSSL_SMALL_STACK
30152-
void *heap = ssl? ssl->heap : ctx ? ctx->heap : NULL; (void)heap;
30152+
void *heap = ssl? ssl->heap : ctx ? ctx->heap : NULL;
3015330153
int *groups;
3015430154
#else
3015530155
int groups[WOLFSSL_MAX_GROUP_COUNT];

wolfcrypt/src/aes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,6 +3885,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
38853885
* and we need both HW and SW. */
38863886
#ifdef NEED_SOFTWARE_AES_SETKEY
38873887

3888+
#ifdef NEED_AES_TABLES
3889+
38883890
#ifndef WC_AES_BITSLICED
38893891
/* Set the AES key and expand.
38903892
*
@@ -4125,6 +4127,8 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
41254127
}
41264128
#endif /* WC_AES_BITSLICED */
41274129

4130+
#endif /* NEED_AES_TABLES */
4131+
41284132
/* Software AES - SetKey */
41294133
static WARN_UNUSED_RESULT int wc_AesSetKeyLocal(
41304134
Aes* aes, const byte* userKey, word32 keylen, const byte* iv, int dir,

wolfcrypt/src/sp_int.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7687,7 +7687,7 @@ static void sp_clamp_ct(sp_int* a)
76877687
unsigned int used = a->used;
76887688
unsigned int mask = (unsigned int)-1;
76897689

7690-
for (i = a->used-1; i >= 0; i--) {
7690+
for (i = (int)a->used - 1; i >= 0; i--) {
76917691
used -= ((unsigned int)(a->dp[i] == 0)) & mask;
76927692
mask &= (unsigned int)0 - (a->dp[i] == 0);
76937693
}
@@ -17072,7 +17072,9 @@ static int _sp_mont_red(sp_int* a, const sp_int* m, sp_int_digit mp, int ct)
1707217072
}
1707317073
else {
1707417074
for (i = 0; i < m->used * 2; i++) {
17075-
a->dp[i] &= (sp_int_digit)(sp_int_sdigit)ctMaskIntGTE(a->used-1, i);
17075+
a->dp[i] &=
17076+
(sp_int_digit)
17077+
(sp_int_sdigit)ctMaskIntGTE((int)(a->used-1), (int)i);
1707617078
}
1707717079
}
1707817080

@@ -17195,7 +17197,9 @@ static int _sp_mont_red(sp_int* a, const sp_int* m, sp_int_digit mp, int ct)
1719517197
}
1719617198
else {
1719717199
for (i = 0; i < m->used * 2; i++) {
17198-
a->dp[i] &= (sp_int_digit)(sp_int_sdigit)ctMaskIntGTE(a->used-1, i);
17200+
a->dp[i] &=
17201+
(sp_int_digit)
17202+
(sp_int_sdigit)ctMaskIntGTE((int)(a->used-1), (int)i);
1719917203
}
1720017204
}
1720117205

0 commit comments

Comments
 (0)