Skip to content

Commit 1be3038

Browse files
authored
Merge pull request #8908 from douzzer/20250620-clang-tidy-and-cppcheck-fixes-and-workarounds
20250620-clang-tidy-and-cppcheck-fixes-and-workarounds
2 parents f30c54a + af78ed8 commit 1be3038

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

src/internal.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35719,6 +35719,9 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3571935719

3572035720
(void)ssl;
3572135721

35722+
if (args == NULL)
35723+
return;
35724+
3572235725
#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448)
3572335726
XFREE(args->exportBuf, ssl->heap, DYNAMIC_TYPE_DER);
3572435727
args->exportBuf = NULL;
@@ -35728,16 +35731,10 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3572835731
args->verifySig = NULL;
3572935732
#endif
3573035733

35731-
if (
35732-
#ifdef WOLFSSL_ASYNC_IO
35733-
args != NULL &&
35734-
#endif
35735-
args->input != NULL) {
35734+
if (args->input != NULL) {
3573635735
XFREE(args->input, ssl->heap, DYNAMIC_TYPE_IN_BUFFER);
3573735736
args->input = NULL;
3573835737
}
35739-
35740-
(void)args;
3574135738
}
3574235739

3574335740
/* handle generation of server_key_exchange (12) */

wolfcrypt/src/sp_int.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19271,18 +19271,15 @@ static int _sp_prime_trials(const sp_int* a, int trials, int* result)
1927119271
{
1927219272
int err = MP_OKAY;
1927319273
int i;
19274-
sp_int* n1;
19275-
sp_int* r;
19276-
DECL_SP_INT_ARRAY(t, a->used + 1, 2);
19274+
DECL_SP_INT(n1, a->used + 1);
19275+
DECL_SP_INT(r, a->used + 1);
1927719276
DECL_SP_INT(b, a->used * 2 + 1);
1927819277

19279-
ALLOC_SP_INT_ARRAY(t, a->used + 1, 2, err, NULL);
19278+
ALLOC_SP_INT(n1, a->used + 1, err, NULL);
19279+
ALLOC_SP_INT(r, a->used + 1, err, NULL);
1928019280
/* Allocate number that will hold modular exponentiation result. */
1928119281
ALLOC_SP_INT(b, a->used * 2 + 1, err, NULL);
1928219282
if (err == MP_OKAY) {
19283-
n1 = t[0];
19284-
r = t[1];
19285-
1928619283
_sp_init_size(n1, a->used + 1U);
1928719284
_sp_init_size(r, a->used + 1U);
1928819285
_sp_init_size(b, (sp_size_t)(a->used * 2U + 1U));
@@ -19305,7 +19302,8 @@ static int _sp_prime_trials(const sp_int* a, int trials, int* result)
1930519302

1930619303
/* Free allocated temporary. */
1930719304
FREE_SP_INT(b, NULL);
19308-
FREE_SP_INT_ARRAY(t, NULL);
19305+
FREE_SP_INT(r, NULL);
19306+
FREE_SP_INT(n1, NULL);
1930919307
return err;
1931019308
}
1931119309

wolfcrypt/src/wc_xmss_impl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ static void wc_xmss_bds_state_treehash_set_next_idx(BdsState* bds, int i,
25902590
static void wc_xmss_bds_state_treehash_complete(BdsState* bds, int i)
25912591
{
25922592
byte* sk = bds->treeHash + i * 4;
2593-
sk[3] |= 1 << 7;
2593+
sk[3] |= 1 << 7; /* // NOLINT(clang-analyzer-core.NullDereference) */
25942594
}
25952595

25962596
/* Get the tree hash data at specified index for the BDS state.

0 commit comments

Comments
 (0)