Skip to content

Commit f376c8d

Browse files
authored
Merge pull request wolfSSL#9388 from lealem47/scan_build
Various fixes for nightly tests
2 parents 3416a0f + 15ecc2e commit f376c8d

File tree

8 files changed

+25
-10
lines changed

8 files changed

+25
-10
lines changed

IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ extern "C" {
1818
#undef SINGLE_THREADED
1919
#define SINGLE_THREADED
2020

21+
#undef WOLFSSL_NO_SOCK
22+
#define WOLFSSL_NO_SOCK
23+
2124
#undef WOLFSSL_SMALL_STACK
2225
//#define WOLFSSL_SMALL_STACK
2326

configure.ac

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ AC_ARG_ENABLE([linuxkm-defaults],
139139
)
140140

141141

142-
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h])
142+
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h sys/random.h])
143143
AC_CHECK_LIB([network],[socket])
144144
AC_C_BIGENDIAN
145145
AC_C___ATOMIC
@@ -150,7 +150,7 @@ AC_CHECK_HEADER(assert.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ASSERT_H"],[
150150
# they're declared by the expected headers, and if not, supersede the
151151
# unusable positive from AC_CHECK_FUNCS().
152152
AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r gmtime_s inet_ntoa memset socket strftime atexit isascii getpid getrandom])
153-
AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, gmtime_s, inet_ntoa, memset, socket, strftime, atexit, isascii, getpid], [], [
153+
AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, gmtime_s, inet_ntoa, memset, socket, strftime, atexit, isascii, getpid, getrandom], [], [
154154
if test "$(eval echo \$"$(eval 'echo ac_cv_func_${as_decl_name}')")" = "yes"
155155
then
156156
AC_MSG_NOTICE([ note: earlier check for $(eval 'echo ${as_decl_name}') superseded.])
@@ -186,6 +186,9 @@ fi
186186
#ifdef HAVE_CTYPE_H
187187
#include <ctype.h>
188188
#endif
189+
#ifdef HAVE_SYS_RANDOM_H
190+
#include <sys/random.h>
191+
#endif
189192
]])
190193

191194
AC_PROG_INSTALL

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: 5 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
}
@@ -4255,6 +4256,8 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
42554256
}
42564257
close(os->fd);
42574258
#else
4259+
(void)output;
4260+
(void)sz;
42584261
ret = NOT_COMPILED_IN;
42594262
#endif /* NO_FILESYSTEM */
42604263

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
}

wolfcrypt/test/test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,11 +3064,13 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
30643064
printf("Math: %s\n", wc_GetMathInfo());
30653065
#endif
30663066

3067+
if (ret == 0) {
30673068
#ifdef HAVE_STACK_SIZE
3068-
StackSizeCheck(&args, wolfcrypt_test);
3069+
StackSizeCheck(&args, wolfcrypt_test);
30693070
#else
3070-
wolfcrypt_test(&args);
3071+
wolfcrypt_test(&args);
30713072
#endif
3073+
}
30723074

30733075
if ((ret = wolfCrypt_Cleanup()) != 0) {
30743076
printf("wolfCrypt_Cleanup failed %d\n", (int)ret);

0 commit comments

Comments
 (0)