mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
merge PR #1820 Porting aid
This commit is contained in:
@ -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);
|
||||
|
||||
|
31
tests/api.c
31
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 */
|
||||
|
@ -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__); \
|
||||
|
Reference in New Issue
Block a user