Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate building WolfSSL with Open Watcom #364

Open
Tracked by #236 ...
davidrg opened this issue Oct 13, 2024 · 1 comment
Open
Tracked by #236 ...

Investigate building WolfSSL with Open Watcom #364

davidrg opened this issue Oct 13, 2024 · 1 comment

Comments

@davidrg
Copy link
Owner

davidrg commented Oct 13, 2024

WolfSSL is written in ANSI-C, supposed to be quite portable (embedded devices, etc), and has some level of OpenSSL compatibility so it may provide a pathway to TLS support on Vintage Windows and OS/2. It will likely also be necessary to support either WolfSSH (#236) or libssh2 (#395), the likely pathways to getting SSH support working again on Vintage Windows and supporting SSH on OS/2 for the first time.

I spent about half an hour having a go at building it with:

  • WolfSSL v5.7.2
  • Open Watcom v2 2024-10-03
  • The CMake GUI

And I got about 63% of the way through (linking wolfssl.dll) before running out of time. To get this far I had to:

  • In CMakeLists, comment out Line 204; Open Watcom does not support -Wall
  • In the CMake GUI, change these options:
    • Check WOLFSSL_32BIT, Uncheck WOLFSSL_X86_64_BUILD_ASM, WOLFSSL_ASM
      • OpenSSL can't handle the inline assembly at cpuid.c, line 42 and changing these settings is enough to not try and build that.
    • Check WOLFSSL_SINGLE_THREADED
      • This avoids the following error: C:\dev\wolfssl-5.7.2\wolfcrypt\src\wc_port.c(3466): Error! E1071: Type of parameter 1 does not agree with previous definition C:\dev\wolfssl-5.7.2\wolfcrypt\src\wc_port.c(3466): Note! N2003: source conversion type is 'unsigned int (__cdecl *)(void *__p1)' C:\dev\wolfssl-5.7.2\wolfcrypt\src\wc_port.c(3466): Note! N2004: target conversion type is 'void (__watcall *)(void *__p1)'
    • Check WOLFSSL_DTLS
      • There appears to be a code error at internal.c, line 11463 that can be avoided by enabling this option.

The link error its currently getting stuck on is: Undefined symbol InetPton_. This is supposed to come from ws2tcpip.h but the API only exists on Windows Vista or newer. To get any further, an implementation of inet_pton will need to be written that works on Vintage Windows and OS/2. The reference to InetPton comes from wolfio.h line 783 - XINET_PTON needs to be defined to point to the new inet_pton implementation.

This may be of help: https://datagirl.xyz/posts/wolfssl_curl_w2k.html
For Visual C++ 2003 at least, the main issues appear to be Variadic macros and InetPton

If WolfSSL can be ported to Open Watcom, it would be good to try and get that support upstreamed rather than having to maintain patches forever.

@davidrg davidrg mentioned this issue Oct 13, 2024
3 tasks
@davidrg davidrg changed the title Get WolfSSL building with OpenWatcom Investigate building WolfSSL with OpenWatcom Oct 13, 2024
@davidrg davidrg changed the title Investigate building WolfSSL with OpenWatcom Investigate building WolfSSL with Open Watcom Oct 25, 2024
@jmalak
Copy link
Contributor

jmalak commented Oct 31, 2024

Here is cpuid C in-line assembly function for Open Watcom

extern void cpuid( unsigned int *reg, unsigned int leaf, unsigned int sub );
#pragma aux cpuid =      \
    ".586"                \
    "cpuid"               \
    "mov  [esi+0],eax"    \
    "mov  [esi+4],ebx"    \
    "mov  [esi+8],ecx"    \
    "mov  [esi+12],edx"   \
    __parm [__esi] [__eax] [__ecx] __modify [__ebx __ecx __edx]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants