Topic: noob: Cutom enviroment settings

Attempting to build WolfSSL using the wolfssl.sln  (VS2008, WEC6)

It is failing to find my time.h.  This would typically be found in my precompiled header.
I am wondering where to add this so it seen by the whole project.  (Rather than modify each file: wc_port.c, ssl.c,..)

I have found the settings.h file but I am unsure if this is the best place to put this for your build.

What mechanism do you have to find the outside/SDK code?

Thanks

Share

Re: noob: Cutom enviroment settings

Hi Frank42,

Since you are working with WEC6 could you try defining "_WIN32_WCE" in the project properties->C/C++->Preprocessor

This define should instead include <windows.h> if you look at our header <wolfssl-root>/wolfssl/wolfcrypt/wc_port.h and look at our checks for _WIN32_WCE.

Let us know if this resolves the issues you are seeing.

Warm Regards,

Kaleb

Re: noob: Cutom enviroment settings

The answer to my question: What mechanism do you have to find the outside/SDK code?

Per the user manual, customizing and porting section, user_settings.h
The preprocessor define "WOLFSSL_USER_SETTINGS" is needed to include the file.

Share

4 (edited by Frank42 2018-03-29 07:36:02)

Re: noob: Cutom enviroment settings

Other issues (and my fixes) I had:

wolfssl.lib
  Not found: windows_time()    #include <time>  time_t windows_time(time_t* x);
  Not found: rewind()   #define rewind(x) fseek(x,0,0)
  Not found: getenv()    #undef OPENSSL_EXTRA

client.exe (and the other extras)
  Missing windows APIs: SetCurrentDirectory(), FindFirstFileA(), FindNextFileA()   - mine is a UNICODE build

WINBASEAPI
BOOL
WINAPI
SetCurrentDirectoryA(__in LPCSTR lpPathName) {return 0;}  //a hack

WINBASEAPI
HANDLE
WINAPI
FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData) {
    struct _WIN32_FIND_DATAW findFileDataW;
    wchar_t fileNameW[MAX_PATH];

    swprintf(fileNameW, L"%s",lpFileName);  // or MultiByteToWideChar

    findFileDataW.dwFileAttributes = lpFindFileData->dwFileAttributes;
    findFileDataW.ftCreationTime = lpFindFileData->ftCreationTime;
    findFileDataW.ftLastAccessTime = lpFindFileData->ftLastAccessTime;
    findFileDataW.ftLastWriteTime = lpFindFileData->ftLastWriteTime;
    findFileDataW.nFileSizeHigh = lpFindFileData->nFileSizeHigh;
    findFileDataW.nFileSizeLow = lpFindFileData->nFileSizeLow;
    findFileDataW.dwOID = 0; // CE object identifier
    // reserved0 - used by file Attributes if reparse is supported
    // reserved1 - for future use
    swprintf(findFileDataW.cFileName,L"%s", lpFindFileData->cFileName);
    // alternatFileName - the old 8.3 filename format

    return FindFirstFileW(fileNameW, &findFileDataW);
}

WINBASEAPI
BOOL
WINAPI
FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData) {
    struct _WIN32_FIND_DATAW findFileDataW;

    findFileDataW.dwFileAttributes = lpFindFileData->dwFileAttributes;
    findFileDataW.ftCreationTime = lpFindFileData->ftCreationTime;
    findFileDataW.ftLastAccessTime = lpFindFileData->ftLastAccessTime;
    findFileDataW.ftLastWriteTime = lpFindFileData->ftLastWriteTime;
    findFileDataW.nFileSizeHigh = lpFindFileData->nFileSizeHigh;
    findFileDataW.nFileSizeLow = lpFindFileData->nFileSizeLow;
    findFileDataW.dwOID = 0; // CE object identifier
    // reserved0 - used by file Attributes if reparse is supported
    // reserved1 - for future use
    swprintf(findFileDataW.cFileName,L"%s", lpFindFileData->cFileName);
    // alternatFileName - the old 8.3 filename format

    return FindNextFileW(hFindFile, &findFileDataW);
}

Share

Re: noob: Cutom enviroment settings

Frank42,

Thank you for sharing your solutions on the forums. Are there any outstanding items remaining or is everything working at this point?

- Kaleb

Re: noob: Cutom enviroment settings

To get the example utilities working (server, client, echo,..) you will need to fix the path to the certificates in test.h.  Then copy the wolf /cert/ folder to the device.

Change the #def's for the certificate files:
#define caCertFile     "./certs/ca-cert.pem"
to something like:
#define caCertFile     "/Program Files/certs/ca-cert.pem"
(There is no concept of a relative path in WinCE.)

Share