forked from wolfSSL/wolfssl
Enhanced "ChangeToWolfRoot" to report error if the root was not found. Also fixed the depth limit.
This commit is contained in:
@@ -1172,16 +1172,17 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
|||||||
|
|
||||||
static INLINE int ChangeToWolfRoot(void)
|
static INLINE int ChangeToWolfRoot(void)
|
||||||
{
|
{
|
||||||
|
#if !defined(NO_FILESYSTEM)
|
||||||
int depth;
|
int depth;
|
||||||
XFILE file;
|
XFILE file;
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
XMEMSET(path, 0, MAX_PATH);
|
XMEMSET(path, 0, MAX_PATH);
|
||||||
|
|
||||||
for(depth = 0; depth < MAX_WOLF_ROOT_DEPTH; depth++) {
|
for(depth = 0; depth <= MAX_WOLF_ROOT_DEPTH; depth++) {
|
||||||
file = XFOPEN(ntruCert, "rb");
|
file = XFOPEN(ntruKey, "rb");
|
||||||
if (file != XBADFILE) {
|
if (file != XBADFILE) {
|
||||||
XFCLOSE(file);
|
XFCLOSE(file);
|
||||||
break;
|
return depth;
|
||||||
}
|
}
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
XSTRNCAT(path, "..\\", MAX_PATH);
|
XSTRNCAT(path, "..\\", MAX_PATH);
|
||||||
@@ -1194,7 +1195,12 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return depth;
|
|
||||||
|
err_sys("wolf root not found");
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) */
|
#endif /* !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_FS) && !defined(WOLFSSL_TIRTOS) */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user