Merge pull request #1332 from kojo1/part5

fix shadow global
This commit is contained in:
dgarske
2018-01-21 16:48:12 -08:00
committed by GitHub

View File

@ -14460,15 +14460,15 @@ static void test_wolfSSL_X509_STORE_CTX_set_time(void)
{ {
#if defined(OPENSSL_EXTRA) #if defined(OPENSSL_EXTRA)
WOLFSSL_X509_STORE_CTX* ctx; WOLFSSL_X509_STORE_CTX* ctx;
time_t ctime; time_t c_time;
printf(testingFmt, "wolfSSL_X509_set_time()"); printf(testingFmt, "wolfSSL_X509_set_time()");
AssertNotNull(ctx = wolfSSL_X509_STORE_CTX_new()); AssertNotNull(ctx = wolfSSL_X509_STORE_CTX_new());
ctime = 365*24*60*60; c_time = 365*24*60*60;
wolfSSL_X509_STORE_CTX_set_time(ctx, 0, ctime); wolfSSL_X509_STORE_CTX_set_time(ctx, 0, c_time);
AssertTrue( AssertTrue(
(ctx->param->flags & WOLFSSL_USE_CHECK_TIME) == WOLFSSL_USE_CHECK_TIME); (ctx->param->flags & WOLFSSL_USE_CHECK_TIME) == WOLFSSL_USE_CHECK_TIME);
AssertTrue(ctx->param->check_time == ctime); AssertTrue(ctx->param->check_time == c_time);
wolfSSL_X509_STORE_CTX_free(ctx); wolfSSL_X509_STORE_CTX_free(ctx);
printf(resultFmt, passed); printf(resultFmt, passed);
@ -15227,7 +15227,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
const int year = 365*24*60*60; const int year = 365*24*60*60;
const int day = 24*60*60; const int day = 24*60*60;
const int hour = 60*60; const int hour = 60*60;
const int min = 60; const int mini = 60;
const byte asn_utc_time = ASN_UTC_TIME; const byte asn_utc_time = ASN_UTC_TIME;
#if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT) #if !defined(TIME_T_NOT_LONG) && !defined(NO_64BIT)
const byte asn_gen_time = ASN_GENERALIZED_TIME; const byte asn_gen_time = ASN_GENERALIZED_TIME;
@ -15244,9 +15244,9 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
DYNAMIC_TYPE_OPENSSL); DYNAMIC_TYPE_OPENSSL);
/* UTC notation test */ /* UTC notation test */
/* 2000/2/15 20:30:00 */ /* 2000/2/15 20:30:00 */
t = (time_t)30 * year + 45 * day + 20 * hour + 30 * min + 7 * day; t = (time_t)30 * year + 45 * day + 20 * hour + 30 * mini + 7 * day;
offset_day = 7; offset_day = 7;
offset_sec = 45 * min; offset_sec = 45 * mini;
/* offset_sec = -45 * min;*/ /* offset_sec = -45 * min;*/
asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec); asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec);
AssertTrue(asn_time->data[0] == asn_utc_time); AssertTrue(asn_time->data[0] == asn_utc_time);
@ -15254,7 +15254,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
AssertIntEQ(0, XMEMCMP(date_str, "000222211500Z", 13)); AssertIntEQ(0, XMEMCMP(date_str, "000222211500Z", 13));
/* negative offset */ /* negative offset */
offset_sec = -45 * min; offset_sec = -45 * mini;
asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec); asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec);
AssertTrue(asn_time->data[0] == asn_utc_time); AssertTrue(asn_time->data[0] == asn_utc_time);
XSTRNCPY(date_str,(const char*) &asn_time->data+2,13); XSTRNCPY(date_str,(const char*) &asn_time->data+2,13);
@ -15271,7 +15271,7 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
/* 2055/03/01 09:00:00 */ /* 2055/03/01 09:00:00 */
t = (time_t)85 * year + 59 * day + 9 * hour + 21 * day; t = (time_t)85 * year + 59 * day + 9 * hour + 21 * day;
offset_day = 12; offset_day = 12;
offset_sec = 10 * min; offset_sec = 10 * mini;
asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec); asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec);
AssertTrue(asn_time->data[0] == asn_gen_time); AssertTrue(asn_time->data[0] == asn_gen_time);
XSTRNCPY(date_str,(const char*) &asn_time->data+2, 15); XSTRNCPY(date_str,(const char*) &asn_time->data+2, 15);
@ -15284,9 +15284,9 @@ static void test_wolfSSL_ASN1_TIME_adj(void)
/* if WOLFSSL_ASN1_TIME struct is not allocated */ /* if WOLFSSL_ASN1_TIME struct is not allocated */
s = NULL; s = NULL;
t = (time_t)30 * year + 45 * day + 20 * hour + 30 * min + 15 + 7 * day; t = (time_t)30 * year + 45 * day + 20 * hour + 30 * mini + 15 + 7 * day;
offset_day = 7; offset_day = 7;
offset_sec = 45 * min; offset_sec = 45 * mini;
asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec); asn_time = wolfSSL_ASN1_TIME_adj(s, t, offset_day, offset_sec);
AssertTrue(asn_time->data[0] == asn_utc_time); AssertTrue(asn_time->data[0] == asn_utc_time);
XSTRNCPY(date_str,(const char*) &asn_time->data+2,13); XSTRNCPY(date_str,(const char*) &asn_time->data+2,13);
@ -16227,13 +16227,13 @@ static void test_wolfSSL_HMAC_CTX(void)
} }
#if defined(OPENSSL_EXTRA) && !defined(NO_RSA) #if defined(OPENSSL_EXTRA) && !defined(NO_RSA)
static void sslMsgCb(int write, int version, int type, const void* buf, static void sslMsgCb(int w, int version, int type, const void* buf,
size_t sz, SSL* ssl, void* arg) size_t sz, SSL* ssl, void* arg)
{ {
int i; int i;
unsigned char* pt = (unsigned char*)buf; unsigned char* pt = (unsigned char*)buf;
printf("%s %d bytes of version %d , type %d : ", (write)?"Writing":"Reading", printf("%s %d bytes of version %d , type %d : ", (w)?"Writing":"Reading",
(int)sz, version, type); (int)sz, version, type);
for (i = 0; i < (int)sz; i++) printf("%02X", pt[i]); for (i = 0; i < (int)sz; i++) printf("%02X", pt[i]);
printf("\n"); printf("\n");