Enhanced Windows CE Support in wolfSSL

We're pleased to announce improvements to wolfSSL's Windows CE support through PR #8709, which addresses critical compatibility issues when building with Visual Studio 2008 for Windows CE 6.0 and 7.0 platforms.

Download wolfSSL →

Background

Windows CE (Windows Embedded Compact) remains an important platform for many embedded and industrial applications, particularly in legacy systems requiring long-term support. Despite being an older platform, Windows CE continues to power devices in manufacturing, healthcare, retail, and industrial automation sectors where system stability and longevity are paramount.

Building cryptographic libraries for Windows CE presents unique challenges due to the platform's limited API surface compared to desktop Windows, different threading models, and compiler toolchain differences. PR #8709 addresses these platform-specific issues to ensure wolfSSL works seamlessly on Windows CE 6.0 and 7.0.

Technical Improvements

Threading Type Definitions
The most significant change adds proper threading type definitions for the _WIN32_WCE platform in wolfssl/wolfcrypt/types.h. Windows CE has a different threading model compared to standard Windows, requiring platform-specific definitions:

#elif defined(_WIN32_WCE)
    typedef unsigned      THREAD_RETURN;
    typedef size_t        THREAD_TYPE;
    typedef struct COND_TYPE {
        wolfSSL_Mutex mutex;
        HANDLE cond;
    } COND_TYPE;
    #define WOLFSSL_COND
    #define INVALID_THREAD_VAL ((THREAD_TYPE)(INVALID_HANDLE_VALUE))
    #define WOLFSSL_THREAD __stdcall
    #define WOLFSSL_THREAD_NO_JOIN __cdecl

These definitions ensure that wolfSSL's threading primitives correctly map to Windows CE's threading API, enabling proper multi-threaded operation. The COND_TYPE structure provides condition variable support using Windows CE's synchronization primitives, while the calling convention macros ensure proper function call semantics.

Error Handling Compatibility

Windows CE has a more limited error reporting API compared to desktop Windows. The fixes in src/wolfio.c exclude Windows CE from using certain Windows-specific error handling functions that aren't available on the platform:

#if defined(_WIN32) && !defined(__WATCOMC__) && !defined(_WIN32_WCE)
    size_t errstr_offset;
    char errstr[WOLFSSL_STRERROR_BUFFER_SIZE];
#endif

The FormatMessageA function and strcpy_s secure string function are not available in the Windows CE API. By excluding Windows CE from these code paths, the library avoids compilation errors while still providing appropriate error handling through alternative mechanisms.

Who Benefits

These changes are particularly important for:

  • Embedded systems developers maintaining Windows CE-based industrial equipment, medical devices, or point-of-sale systems
  • Legacy system maintainers who need to update cryptographic implementations for security compliance
  • Industrial automation engineers working with long-lifecycle equipment that relies on Windows CE

Building wolfSSL for Windows CE

To build wolfSSL for Windows CE with these fixes:

  1. Use Visual Studio 2008 with the Windows CE 6.0 or 7.0 SDK installed
  2. Configure your project to define _WIN32_WCE (typically set automatically by the Windows CE platform SDK)
  3. Build wolfSSL as you would for any Windows CE project

The library will automatically detect the Windows CE environment and use the appropriate platform-specific code paths.

Relationship to PR #8621

These fixes were originally intended to be part of PR #8621, which focused on .NET 3.5 compatibility improvements. Both PRs address compatibility with older Microsoft development environments and platforms, reflecting wolfSSL's commitment to supporting a wide range of deployment scenarios.

Conclusion

While Windows CE may be considered a legacy platform, it continues to serve critical roles in industries where system longevity and stability are essential. These improvements remove barriers to adopting or updating to current versions of wolfSSL, helping maintain security compliance and cryptographic best practices across the entire device lifecycle.

For questions about Windows CE support or other embedded platform compatibility, please contact us at facts@wolfSSL.com or call us at +1 425 245 8247.
Download wolfSSL Now