From cfa99c567b42a0e26c0f12f2d658e6b383e03c96 Mon Sep 17 00:00:00 2001 From: Go Hosohara Date: Thu, 13 Sep 2018 13:15:01 +0900 Subject: [PATCH] merge PR #1820 Porting aid --- src/ssl.c | 7 +++++++ tests/api.c | 31 ++++++++++++------------------- tests/unit.h | 1 - 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 474318165..746a04543 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -5891,6 +5891,10 @@ int wolfSSL_CertManagerVerify(WOLFSSL_CERT_MANAGER* cm, const char* fname, if (file == XBADFILE) return WOLFSSL_BAD_FILE; if(XFSEEK(file, 0, XSEEK_END) != 0) return WOLFSSL_BAD_FILE; +<<<<<<< HEAD +======= + +>>>>>>> merge PR #1820 Porting aid sz = XFTELL(file); XREWIND(file); @@ -15280,7 +15284,10 @@ WOLFSSL_X509* wolfSSL_X509_load_certificate_file(const char* fname, int format) XFCLOSE(file); return NULL; } +<<<<<<< HEAD +======= +>>>>>>> merge PR #1820 Porting aid sz = XFTELL(file); XREWIND(file); diff --git a/tests/api.c b/tests/api.c index 3cd950c1f..a53b5e780 100644 --- a/tests/api.c +++ b/tests/api.c @@ -446,34 +446,30 @@ static int test_wolfCrypt_Init(void) /*----------------------------------------------------------------------------* | Platform dependent function test *----------------------------------------------------------------------------*/ - -static int test_fileAccess() + static int test_fileAccess() { - #if defined(WOLFSSL_TEST_PLATFORMDEPEND) && !defined(NO_FILESYSTEM) - +#if defined(WOLFSSL_TEST_PLATFORMDEPEND) && !defined(NO_FILESYSTEM) const char *fname[] = { - svrCertFile, svrKeyFile, caCertFile, eccCertFile, eccKeyFile, eccRsaCertFile, + svrCertFile, svrKeyFile, caCertFile, eccCertFile, eccKeyFile, eccRsaCertFile, cliCertFile, cliCertDerFile, cliKeyFile, ntruCertFile, ntruKeyFile, dhParamFile, cliEccKeyFile, cliEccCertFile, caEccCertFile, edCertFile, edKeyFile, - cliEdCertFile, cliEdKeyFile, caEdCertFile, + cliEdCertFile, cliEdKeyFile, caEdCertFile, NULL }; - - const char derfile[] = "./certs/server-cert.der"; + const char derfile[] = "./certs/server-cert.der"; XFILE f; size_t sz; byte *buff; int i; - printf(testingFmt, "test_fileAccessr()"); - - AssertTrue(XFOPEN("badfilename", "rb") == XBADFILE); + printf(testingFmt, "test_fileAccess()"); - for(i=0; fname[i] != NULL ; i++){ + AssertTrue(XFOPEN("badfilename", "rb") == XBADFILE); + for(i=0; fname[i] != NULL ; i++){ AssertTrue((f = XFOPEN(fname[i], "rb")) != XBADFILE); XFCLOSE(f); } - + AssertTrue((f = XFOPEN(derfile, "rb")) != XBADFILE); AssertTrue(XFSEEK(f, 0, XSEEK_END) == 0); sz = (size_t) XFTELL(f); @@ -482,10 +478,8 @@ static int test_fileAccess() AssertTrue((buff = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_FILE)) != NULL) ; AssertTrue(XFREAD(buff, 1, sz, f) == sz); XMEMCMP(server_cert_der_2048, buff, sz); - - printf(resultFmt, passed); + printf(resultFmt, passed); #endif - return WOLFSSL_SUCCESS; } @@ -21450,10 +21444,9 @@ static void test_wolfSSL_RSA_verify() void ApiTest(void) { - - printf("\n-----------------Porting tests------------------\n"); + printf("\n-----------------Porting tests------------------\n"); AssertTrue(test_fileAccess()); - + printf(" Begin API Tests\n"); AssertIntEQ(test_wolfSSL_Init(), WOLFSSL_SUCCESS); /* wolfcrypt initialization tests */ diff --git a/tests/unit.h b/tests/unit.h index ee13c756f..d62e0ee16 100644 --- a/tests/unit.h +++ b/tests/unit.h @@ -32,7 +32,6 @@ #define XABORT() abort() #endif - #ifndef WOLFSSL_PASSTHRU_ERR #define Fail(description, result) do { \ printf("\nERROR - %s line %d failed with:", __FILE__, __LINE__); \