forked from wolfSSL/wolfssl
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:
@ -14,7 +14,7 @@ extern "C" {
|
|||||||
#define INTIME_RTOS
|
#define INTIME_RTOS
|
||||||
|
|
||||||
#undef WOLF_EXAMPLES_STACK
|
#undef WOLF_EXAMPLES_STACK
|
||||||
#define WOLF_EXAMPLES_STACK 65536
|
#define WOLF_EXAMPLES_STACK (1<<17)
|
||||||
|
|
||||||
#undef WOLFSSL_GENERAL_ALIGNMENT
|
#undef WOLFSSL_GENERAL_ALIGNMENT
|
||||||
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||||
@ -27,7 +27,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* disable directory support */
|
/* disable directory support */
|
||||||
#undef NO_WOLFSSL_DIR
|
#undef NO_WOLFSSL_DIR
|
||||||
#define NO_WOLFSSL_DIR
|
//#define NO_WOLFSSL_DIR
|
||||||
|
|
||||||
/* disable writev */
|
/* disable writev */
|
||||||
#undef NO_WRITEV
|
#undef NO_WRITEV
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WOLFSSL_USER_SETTINGS;_USE_64BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -464,6 +464,37 @@ int wc_ReadDirFirst(ReadDirCtx* ctx, const char* path, char** name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} while (FindNextFileA(ctx->hFind, &ctx->FindFileData));
|
} 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)
|
#elif defined(WOLFSSL_ZEPHYR)
|
||||||
if (fs_opendir(&ctx->dir, path) != 0) {
|
if (fs_opendir(&ctx->dir, path) != 0) {
|
||||||
WOLFSSL_MSG("opendir path verify locations failed");
|
WOLFSSL_MSG("opendir path verify locations failed");
|
||||||
@ -600,6 +631,26 @@ int wc_ReadDirNext(ReadDirCtx* ctx, const char* path, char** name)
|
|||||||
return 0;
|
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)
|
#elif defined(WOLFSSL_ZEPHYR)
|
||||||
while ((fs_readdir(&ctx->dir, &ctx->entry)) != 0) {
|
while ((fs_readdir(&ctx->dir, &ctx->entry)) != 0) {
|
||||||
dnameLen = (int)XSTRLEN(ctx->entry.name);
|
dnameLen = (int)XSTRLEN(ctx->entry.name);
|
||||||
@ -695,6 +746,10 @@ void wc_ReadDirClose(ReadDirCtx* ctx)
|
|||||||
FindClose(ctx->hFind);
|
FindClose(ctx->hFind);
|
||||||
ctx->hFind = INVALID_HANDLE_VALUE;
|
ctx->hFind = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(INTIME_RTOS)
|
||||||
|
FindRtFileClose(&ctx->FindFileData);
|
||||||
|
|
||||||
#elif defined(WOLFSSL_ZEPHYR)
|
#elif defined(WOLFSSL_ZEPHYR)
|
||||||
if (ctx->dirp) {
|
if (ctx->dirp) {
|
||||||
fs_closedir(ctx->dirp);
|
fs_closedir(ctx->dirp);
|
||||||
|
@ -729,6 +729,8 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||||||
M2MB_DIR_T* dir;
|
M2MB_DIR_T* dir;
|
||||||
struct M2MB_DIRENT* entry;
|
struct M2MB_DIRENT* entry;
|
||||||
struct M2MB_STAT s;
|
struct M2MB_STAT s;
|
||||||
|
#elif defined(INTIME_RTOS)
|
||||||
|
FIND_FILE_DATA FindFileData;
|
||||||
#else
|
#else
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
|
Reference in New Issue
Block a user