Skip to content

Commit 08db159

Browse files
committed
Fixes for minor scan-build warnings
1 parent 9fdcd2e commit 08db159

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

examples/client/client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,9 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
29502950
#endif /* HAVE_RPK */
29512951
break;
29522952
case 268:
2953+
#ifndef NO_CERTS
29532954
fileFormat = WOLFSSL_FILETYPE_ASN1;
2955+
#endif
29542956
break;
29552957
case 269:
29562958
#if defined(WOLFSSL_SYS_CRYPTO_POLICY)

src/tls13.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10558,6 +10558,7 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
1055810558
case TLS_ASYNC_DO:
1055910559
{
1056010560
sig = input + args->idx;
10561+
(void)sig;
1056110562
#ifdef WOLFSSL_DUAL_ALG_CERTS
1056210563
if (ssl->sigSpec != NULL &&
1056310564
*ssl->sigSpec == WOLFSSL_CKS_SIGSPEC_BOTH) {

tests/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20118,7 +20118,7 @@ static int test_wolfSSL_PKCS7_certs(void)
2011820118
while (EXPECT_SUCCESS() && (sk_X509_INFO_num(info_sk) > 0)) {
2011920119
X509_INFO* info = NULL;
2012020120
ExpectNotNull(info = sk_X509_INFO_shift(info_sk));
20121-
if (info != NULL) {
20121+
if (EXPECT_SUCCESS() && info != NULL) {
2012220122
ExpectIntGT(sk_X509_push(sk, info->x509), 0);
2012320123
info->x509 = NULL;
2012420124
}

wolfcrypt/src/random.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,8 +4207,9 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
42074207
#ifdef FORCE_FAILURE_GETRANDOM
42084208
/* don't fallback to /dev/urandom */
42094209
return ret;
4210-
#else
4211-
/* reset error and fallback to using /dev/urandom */
4210+
#elif !defined(NO_FILESYSTEM)
4211+
/* reset error and fallback to using /dev/urandom if filesystem
4212+
* support is compiled in */
42124213
ret = 0;
42134214
#endif
42144215
}

wolfcrypt/src/sp_int.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8561,10 +8561,11 @@ int sp_rshb(const sp_int* a, int n, sp_int* r)
85618561
}
85628562
else {
85638563
/* Move the bits down starting at least significant digit. */
8564-
for (j = 0; i < a->used - 1; i++, j++)
8565-
r->dp[j] = (a->dp[i] >> n) | (a->dp[i+1] << (SP_WORD_SIZE - n));
8564+
for (j = 0; j < (sp_size_t)(a->used - 1 - i); j++)
8565+
r->dp[j] = (a->dp[j+i] >> n) |
8566+
(a->dp[j+i+1] << (SP_WORD_SIZE - n));
85668567
/* Most significant digit has no higher digit to pull from. */
8567-
r->dp[j] = a->dp[i] >> n;
8568+
r->dp[j] = a->dp[j+i] >> n;
85688569
/* Set the count of used digits. */
85698570
r->used = (sp_size_t)(j + (r->dp[j] > 0));
85708571
}

0 commit comments

Comments
 (0)