INTIME: add support for directory file search
Directory support allows CRL use with undefining `NO_WOLFSSL_DIR` Also increase stack size to avoid page fault and add `_USE_64BIT_TIME_T` to example project to pass ASN test
This commit is contained in:
parent
14b7d70ae4
commit
c3e6195da5
@ -14,7 +14,7 @@ extern "C" {
|
||||
#define INTIME_RTOS
|
||||
|
||||
#undef WOLF_EXAMPLES_STACK
|
||||
#define WOLF_EXAMPLES_STACK 65536
|
||||
#define WOLF_EXAMPLES_STACK (1<<17)
|
||||
|
||||
#undef WOLFSSL_GENERAL_ALIGNMENT
|
||||
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||
@ -27,7 +27,7 @@ extern "C" {
|
||||
|
||||
/* disable directory support */
|
||||
#undef NO_WOLFSSL_DIR
|
||||
#define NO_WOLFSSL_DIR
|
||||
//#define NO_WOLFSSL_DIR
|
||||
|
||||
/* disable writev */
|
||||
#undef NO_WRITEV
|
||||
|
@ -66,7 +66,7 @@
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;_USE_64BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -464,6 +464,37 @@ int wc_ReadDirFirst(ReadDirCtx* ctx, const char* path, char** name)
|
||||
return 0;
|
||||
}
|
||||
} while (FindNextFileA(ctx->hFind, &ctx->FindFileData));
|
||||
|
||||
#elif defined(INTIME_RTOS)
|
||||
if (pathLen > MAX_FILENAME_SZ - 3)
|
||||
return BAD_PATH_ERROR;
|
||||
|
||||
XSTRNCPY(ctx->name, path, MAX_FILENAME_SZ - 3);
|
||||
XSTRNCPY(ctx->name + pathLen, "\\*", MAX_FILENAME_SZ - pathLen);
|
||||
|
||||
if (!FindFirstRtFile(ctx->name, &ctx->FindFileData, 0)) {
|
||||
WOLFSSL_MSG("FindFirstFile for path verify locations failed");
|
||||
return BAD_PATH_ERROR;
|
||||
}
|
||||
|
||||
do {
|
||||
if (!(ctx->FindFileData.dwFileAttributes & FILE_ATTR_DIRECTORY)) {
|
||||
dnameLen = (int)XSTRLEN(ctx->FindFileData.cFileName);
|
||||
|
||||
if (pathLen + dnameLen + 2 > MAX_FILENAME_SZ) {
|
||||
return BAD_PATH_ERROR;
|
||||
}
|
||||
XSTRNCPY(ctx->name, path, pathLen + 1);
|
||||
ctx->name[pathLen] = '\\';
|
||||
XSTRNCPY(ctx->name + pathLen + 1,
|
||||
ctx->FindFileData.cFileName,
|
||||
MAX_FILENAME_SZ - pathLen - 1);
|
||||
if (name)
|
||||
*name = ctx->name;
|
||||
return 0;
|
||||
}
|
||||
} while (FindNextRtFile(&ctx->FindFileData));
|
||||
|
||||
#elif defined(WOLFSSL_ZEPHYR)
|
||||
if (fs_opendir(&ctx->dir, path) != 0) {
|
||||
WOLFSSL_MSG("opendir path verify locations failed");
|
||||
@ -600,6 +631,26 @@ int wc_ReadDirNext(ReadDirCtx* ctx, const char* path, char** name)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(INTIME_RTOS)
|
||||
while (FindNextRtFile(&ctx->FindFileData)) {
|
||||
if (!(ctx->FindFileData.dwFileAttributes & FILE_ATTR_DIRECTORY)) {
|
||||
dnameLen = (int)XSTRLEN(ctx->FindFileData.cFileName);
|
||||
|
||||
if (pathLen + dnameLen + 2 > MAX_FILENAME_SZ) {
|
||||
return BAD_PATH_ERROR;
|
||||
}
|
||||
XSTRNCPY(ctx->name, path, pathLen + 1);
|
||||
ctx->name[pathLen] = '\\';
|
||||
XSTRNCPY(ctx->name + pathLen + 1,
|
||||
ctx->FindFileData.cFileName,
|
||||
MAX_FILENAME_SZ - pathLen - 1);
|
||||
if (name)
|
||||
*name = ctx->name;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(WOLFSSL_ZEPHYR)
|
||||
while ((fs_readdir(&ctx->dir, &ctx->entry)) != 0) {
|
||||
dnameLen = (int)XSTRLEN(ctx->entry.name);
|
||||
@ -695,6 +746,10 @@ void wc_ReadDirClose(ReadDirCtx* ctx)
|
||||
FindClose(ctx->hFind);
|
||||
ctx->hFind = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
#elif defined(INTIME_RTOS)
|
||||
FindRtFileClose(&ctx->FindFileData);
|
||||
|
||||
#elif defined(WOLFSSL_ZEPHYR)
|
||||
if (ctx->dirp) {
|
||||
fs_closedir(ctx->dirp);
|
||||
|
@ -729,6 +729,8 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
M2MB_DIR_T* dir;
|
||||
struct M2MB_DIRENT* entry;
|
||||
struct M2MB_STAT s;
|
||||
#elif defined(INTIME_RTOS)
|
||||
FIND_FILE_DATA FindFileData;
|
||||
#else
|
||||
struct dirent* entry;
|
||||
DIR* dir;
|
||||
|
Loading…
x
Reference in New Issue
Block a user