wolfSSL / osp

wolfSSL Open Source project ports
https://www.wolfssl.com
24 stars 36 forks source link

Process to patch Python 3.8.14 or 3.8.5 for wolfSSL on Windows #141

Open ar-visions opened 1 year ago

ar-visions commented 1 year ago

Since the Windows build doesn't run the autoconf and configure I am wondering what the process is to get Python patched for wolfssl on Windows. Is this possible with configuration passed into CMake?

I would like to help get this working if there is an avenue.

Working on a CMake/Python build system which bootstraps Python from source. Seems that using Wolf is preferable to downloading Strawberry Perl bins & OpenSSL src on Windows, in order to get Python built. CMake can build anything first so why not build Python in the most succinct way.. Would like to commit PR in this area if I get something going.

ar-visions commented 1 year ago

I have this CMakeSettings.json so far. I did a rough search to get the names, but I'm not so sure about CFlags I believe I found the equivalent compared to the args used in the configuration line in Python/build-wolfssl.sh

I'm a bit confused as to what Python needs to find afterwards. I assume I just add a prefix to its search but not aware of the files I need to have interfaced w Python

{
    "configurations": [
      {
        "name": "PythonCompatible",
        "generator": "Ninja",
        "cmakeCommandArgs": "",
        "buildCommandArgs": "",
        "ctestCommandArgs": "",
        "variables": [
          {
            "name": "WOLFSSL_OPENSSLALL",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_TLS13",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_TLSX",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_TLSV10",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_POSTAUTH",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_CERTEXT",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_CERTGEN",
            "value": "ON"
          },
          {
            "name": "WOLFSSL_SCRYPT",
            "value": "ON"
          },
          {
            "name": "CFLAGS",
            "value": "-DHAVE_EX_DATA;-DWOLFSSL_ERROR_CODE_OPENSSL;-DHAVE_SECRET_CALLBACK;-DWOLFSSL_PYTHON;-DWOLFSSL_ALT_NAMES;-DWOLFSSL_SIGNER_DER_CERT"
          }
        ]
      }
    ]
  }
ar-visions commented 1 year ago

WOLFSSL_TLSV10 not found effectively. just a note to add.

kareem-wolfssl commented 1 year ago

Hi @ar-visions,

For a Windows build, you're going to have a much easier time using something like MinGW where you can use our ./configure script, is this possible for your setup? Otherwise, your build flags look correct to me based on our Python build. Are you running into build issues with these flags? Note that our CMake support is incomplete, for example WOLFSSL_SCRYPT and WOLFSSL_TLSV10 are not supported via CMake, you will need to manually specify their CFLAGS. For help translating configure flags to CFLAGS, see configure.ac.

Python will need to find wolfSSL's library (.dll) and include files (.h). On Linux, this would be in /usr/local/ after running make install. I'm not sure if there's an equivalent on Windows, you may need to manually add to Python's search path, or move wolfSSL's library/header files.

Thanks, Kareem