diff --git a/IDE/GCC-ARM/README.md b/IDE/GCC-ARM/README.md index d110c1561..353a3c399 100644 --- a/IDE/GCC-ARM/README.md +++ b/IDE/GCC-ARM/README.md @@ -81,7 +81,7 @@ $ make $ make install ``` -If you are building for a 32-bit architecture, add `-DTIME_T_NOT_LONG` to the +If you are building for a 32-bit architecture, add `-DTIME_T_NOT_64BIT` to the list of CFLAGS. ## Example Build Output diff --git a/configure.ac b/configure.ac index 1912c2471..76fcfa807 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ AS_IF([ test -n "$CFLAG_VISIBILITY" ], [ # checks to fail. AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([time_t]) AC_CHECK_TYPES([__uint128_t]) AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r inet_ntoa memset socket]) AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h sys/ioctl.h sys/socket.h sys/time.h errno.h]) diff --git a/src/internal.c b/src/internal.c index 926f92d51..c19cd0fa8 100644 --- a/src/internal.c +++ b/src/internal.c @@ -4206,7 +4206,7 @@ int InitSSL_Suites(WOLFSSL* ssl) haveRSA = 1; #endif #ifndef NO_PSK - havePSK = ssl->options.havePSK; + havePSK = (byte)ssl->options.havePSK; #endif /* NO_PSK */ #ifdef HAVE_ANON haveAnon = ssl->options.haveAnon; diff --git a/tests/api.c b/tests/api.c index f9af412e4..33dfd45a8 100644 --- a/tests/api.c +++ b/tests/api.c @@ -916,7 +916,7 @@ static int test_cm_load_ca_file(const char* ca_cert_file) if (ret == 0) { /* test loading DER */ ret = wc_PemToDer(cert_buf, cert_sz, CA_TYPE, &pDer, NULL, NULL, NULL); - if (ret == 0) { + if (ret == 0 && pDer != NULL) { ret = test_cm_load_ca_buffer(pDer->buffer, pDer->length, WOLFSSL_FILETYPE_ASN1); @@ -18679,7 +18679,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) const int hour = 60*60; const int mini = 60; const byte asn_utc_time = ASN_UTC_TIME; -#if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT) +#if !defined(TIME_T_NOT_64BIT) && !defined(NO_64BIT) const byte asn_gen_time = ASN_GENERALIZED_TIME; #endif WOLFSSL_ASN1_TIME *asn_time, *s; @@ -18714,7 +18714,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) XMEMSET(date_str, 0, sizeof(date_str)); /* Generalized time will overflow time_t if not long */ -#if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT) +#if !defined(TIME_T_NOT_64BIT) && !defined(NO_64BIT) s = (WOLFSSL_ASN1_TIME*)XMALLOC(sizeof(WOLFSSL_ASN1_TIME), NULL, DYNAMIC_TYPE_OPENSSL); /* GeneralizedTime notation test */ @@ -18729,7 +18729,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void) XFREE(s,NULL,DYNAMIC_TYPE_OPENSSL); XMEMSET(date_str, 0, sizeof(date_str)); -#endif /* !TIME_T_NOT_LONG && !NO_64BIT */ +#endif /* !TIME_T_NOT_64BIT && !NO_64BIT */ /* if WOLFSSL_ASN1_TIME struct is not allocated */ s = NULL; diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 05a67adc4..013b2d7fd 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -10253,7 +10253,8 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp) fclose(file3); #endif /* USE_CERT_BUFFERS */ - #ifndef NO_FILESYSTEM + #if !defined(NO_FILESYSTEM) && !defined(USE_CERT_BUFFERS_1024) && \ + !defined(USE_CERT_BUFFERS_2048) && !defined(NO_ASN) ret = wc_SetAltNames(myCert, rsaCaCertFile); if (ret != 0) { ERROR_OUT(-6931, exit_rsa); diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 62db45c87..c612a24d9 100755 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -474,10 +474,23 @@ WOLFSSL_API int wolfCrypt_Cleanup(void); /* PowerPC time_t is int */ #ifdef __PPC__ - #define TIME_T_NOT_LONG + #define TIME_T_NOT_64BIT #endif #endif +#ifdef SIZEOF_TIME_T + /* check if size of time_t from autoconf is less than 8 bytes (64bits) */ + #if SIZEOF_TIME_T < 8 + #undef TIME_T_NOT_64BIT + #define TIME_T_NOT_64BIT + #endif +#endif +#ifdef TIME_T_NOT_LONG + /* one old reference to TIME_T_NOT_LONG in GCC-ARM example README + * this keeps support for the old macro name */ + #undef TIME_T_NOT_64BIT + #define TIME_T_NOT_64BIT +#endif /* Map default time functions */ #if !defined(XTIME) && !defined(TIME_OVERRIDES) && !defined(USER_TIME)