From ee30b2b4764d093692a16e93ce61db62423100d3 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 16 Nov 2018 15:51:38 -0700 Subject: [PATCH] better name for time_t size macro guard --- IDE/GCC-ARM/README.md | 2 +- tests/api.c | 6 +++--- wolfssl/wolfcrypt/wc_port.h | 13 ++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) 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/tests/api.c b/tests/api.c index 4d379d249..f9bc92997 100644 --- a/tests/api.c +++ b/tests/api.c @@ -18578,7 +18578,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; @@ -18613,7 +18613,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 */ @@ -18628,7 +18628,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/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 73cce5657..c612a24d9 100755 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -474,16 +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_LONG - #define TIME_T_NOT_LONG + #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)