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

Fixes for Watcom compiler and new CI test #8391

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented Jan 29, 2025

Description

Thank you @jmalak for your help with this.

Testing

See new CI test

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@jmalak
Copy link

jmalak commented Jan 29, 2025

Below is Github Action definition file modified to automate any host and any target with Open Watcom toolchain by matrix.
Linux build on Linux host and Windows build on Windows host is active, it will be possible to use it for testing.
OS/2 build on Windows host (cross-compile) is commented out, because WolfSSL codebase was not checked for this target now.

name: Build Watcom C

# START OF COMMON SECTION
on:
  push:
    branches: [ 'master', 'main', 'release/**' ]
  pull_request:
    branches: [ '*' ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
# END OF COMMON SECTION

jobs:
  wolfssl_watcomc_windows:
    if: github.repository_owner == 'wolfssl'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - title:   'Windows OW 2.0'
            system:   'Windows' 
            image:    'windows-latest'
            owimage:  '2.0'
          - title:   'Linux OW 2.0'
            system:   'Linux'
            image:    'ubuntu-latest'
            owimage:  '2.0'
          #- title:   'OS/2 OW 2.0'
          #  system:   'OS2' 
          #  image:    'windows-latest'
          #  owimage:  '2.0'
    runs-on: ${{ matrix.platform.image }}
    name: ${{ matrix.platform.title }}
    steps:
      - name: Setup Open Watcom ${{ matrix.platform.owimage }}
        uses: open-watcom/setup-watcom@v0
        with:
          version: ${{ matrix.platform.owimage }}

      - name: Checkout wolfSSL
        uses: actions/checkout@v4
        with:
          path: wolfssl

      - name: Build wolfSSL
        working-directory: wolfssl
        shell: bash
        run: |
          cmake -B build -G "Watcom WMake" -D CMAKE_VERBOSE_MAKEFILE=TRUE -D CMAKE_SYSTEM_NAME=${{ matrix.platform.system }} -D CMAKE_SYSTEM_PROCESSOR=x86 -D WOLFSSL_ASM=no -D WOLFSSL_SINGLE_THREADED=yes -D BUILD_SHARED_LIBS=no -D WOLFSSL_EXAMPLES=no -D WOLFSSL_CRYPT_TESTS=no
          cmake --build build

@dgarske
Copy link
Contributor Author

dgarske commented Jan 29, 2025

Below is Github Action definition file modified to automate any host and any target with Open Watcom toolchain by matrix. Linux build on Linux host and Windows build on Windows host is active, it will be possible to use it for testing. OS/2 build on Windows host (cross-compile) is commented out, because WolfSSL codebase was not checked for this target now.

name: Build Watcom C

# START OF COMMON SECTION
on:
  push:
    branches: [ 'master', 'main', 'release/**' ]
  pull_request:
    branches: [ '*' ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
# END OF COMMON SECTION

jobs:
  wolfssl_watcomc_windows:
    if: github.repository_owner == 'wolfssl'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - title:   'Windows OW 2.0'
            system:   'Windows' 
            image:    'windows-latest'
            owimage:  '2.0'
          - title:   'Linux OW 2.0'
            system:   'Linux'
            image:    'ubuntu-latest'
            owimage:  '2.0'
          #- title:   'OS/2 OW 2.0'
          #  system:   'OS2' 
          #  image:    'windows-latest'
          #  owimage:  '2.0'
    runs-on: ${{ matrix.platform.image }}
    name: ${{ matrix.platform.title }}
    steps:
      - name: Setup Open Watcom ${{ matrix.platform.owimage }}
        uses: open-watcom/setup-watcom@v0
        with:
          version: ${{ matrix.platform.owimage }}

      - name: Checkout wolfSSL
        uses: actions/checkout@v4
        with:
          path: wolfssl

      - name: Build wolfSSL
        working-directory: wolfssl
        shell: bash
        run: |
          cmake -B build -G "Watcom WMake" -D CMAKE_VERBOSE_MAKEFILE=TRUE -D CMAKE_SYSTEM_NAME=${{ matrix.platform.system }} -D CMAKE_SYSTEM_PROCESSOR=x86 -D WOLFSSL_ASM=no -D WOLFSSL_SINGLE_THREADED=yes -D BUILD_SHARED_LIBS=no -D WOLFSSL_EXAMPLES=no -D WOLFSSL_CRYPT_TESTS=no
          cmake --build build

Wonderful! I'll give this a try. Thank you!

@dgarske dgarske removed their assignment Jan 30, 2025
Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve merge conflict

@jmalak
Copy link

jmalak commented Jan 30, 2025

Hi @dgarske,

I have prepared regular fixes for Open Watcom against current version of WolfSSL repository that All build of WolfSSL is going OK for Windows multi-threaded version (32-bit).
There are many fixes unrelated to Open Watcom but rather to C89 standard.
Is it acceptable to use C89 things for newer standards if no collision or must be guarded by WOLFSSL_C89?
What C standard should be used by default C99?
Please how I can submit it somewhere or I need create new PR?
I have no access to dgarske:cmake_watcom that I cannot submit it there.
Or I must create patch file and put it here.

Thanks

Jiri

@dgarske
Copy link
Contributor Author

dgarske commented Jan 30, 2025

Hi Jiri,

We'd love to get it working with the C89 compliance level, since we have customers using that even with Watcom C.

I am about to rebase this PR and force push to resolve a merge conflict. You are welcome to share a patch and I can add it. OR
You can open a new PR once this one is merged. Now that you are setup as an approved contributor it's easy to accept works you submit.

Thanks,
David Garske, wolfSSL

@jmalak
Copy link

jmalak commented Jan 30, 2025

OK I will separate fixes relate to C89, it is mainly initilization by non-constant values and sometimes definition of variables in code.
There is also issue related to mixing winsock.h and winsock2.h.
I don't know what you suppose somewhere are used header files which include winsock2.h that it looks like code should use only winsock2.h then blocking of winsock.h should be implemented.
Anyway I get full compile for Windows (multi-threaded) including all examples and test programs.
Is ti possiblu to run somehow these test programs to check results?

@dgarske
Copy link
Contributor Author

dgarske commented Jan 30, 2025

OK I will separate fixes relate to C89, it is mainly initilization by non-constant values and sometimes definition of variables in code. There is also issue related to mixing winsock.h and winsock2.h. I don't know what you suppose somewhere are used header files which include winsock2.h that it looks like code should use only winsock2.h then blocking of winsock.h should be implemented. Anyway I get full compile for Windows (multi-threaded) including all examples and test programs. Is ti possiblu to run somehow these test programs to check results?

In your PR I recommend trying to remove the -DWOLFSSL_CRYPT_TESTS=no to enable the wolfcrypttest and running that at a minimum.

@jmalak
Copy link

jmalak commented Jan 30, 2025

OK I will try.
I enclosed 3 patch files divided by areas

  • C89 fixes, mostly test sources
  • winsock.h issue fixes
  • all Open Watcom fixes

Open Watcom fixes requires C89 fixes and winsock too or some alternative solution
c89-fixes.patch
watcom-build.patch
winsock-fixes.patch

Build tested with Open Watcom 1.9 and 2.0

!! it is fixes only for Windows target !!
Linux will be next. That now will be best to stop CI-build for Linux.

There is some duplication code for thread support, but it is prepared for OS/2 build changes. Now it is same as for Microsoft compilers with small differences.

@jmalak
Copy link

jmalak commented Jan 31, 2025

Sorry, one mistake.
It is patch
api.c.patch
latest version of api.c file

* Correct cmake script to support Open Watcom toolchain (wolfSSL#8167)
* Fix thread start callback prototype for Open Watcom toolchain (wolfSSL#8175)
* Added GitHub CI action
@dgarske
Copy link
Contributor Author

dgarske commented Jan 31, 2025

@jmalak let me know if you have suggestions to fix:
https://github.com/wolfSSL/wolfssl/actions/runs/13063975498/job/36452955791?pr=8391

	wcc386 D:\a\wolfssl\wolfssl\wolfssl\wolfcrypt\src\hmac.c  -d+ -DBUILDING_WOLFSSL -DECC_SHAMIR -DECC_TIMING_RESISTANT -DGCM_TABLE_4BIT -DHAVE_AESGCM -DHAVE_CHACHA -DHAVE_CONFIG_H -DHAVE_DH_DEFAULT_PARAMS -DHAVE_ECC -DHAVE_ENCRYPT_THEN_MAC -DHAVE_EXTENDED_MASTER -DHAVE_FFDHE_2048 -DHAVE_HASHDRBG -DHAVE_HKDF -DHAVE_ONE_TIME_AUTH -DHAVE_POLY1305 -DHAVE_SNI -DHAVE_SUPPORTED_CURVES -DHAVE_THREAD_LS -DHAVE_TLS_EXTENSIONS -DNO_CHACHA_ASM -DNO_DES3 -DNO_DES3_TLS_SUITES -DNO_DSA -DNO_MD4 -DNO_PSK -DNO_RC4 -DSINGLE_THREADED -DTFM_ECC256 -DTFM_NO_ASM -DTFM_TIMING_RESISTANT -DWC_NO_ASYNC_THREADING -DWC_RSA_BLINDING -DWC_RSA_PSS -DWOLFSSL_HAVE_MIN -DWOLFSSL_HAVE_MAX -DNO_WRITEV -DWOLFSSL_IGNORE_FILE_WARN -DWOLFSSL_NO_ASM -DWOLFSSL_NO_SHAKE128 -DWOLFSSL_NO_SHAKE256 -DWOLFSSL_PSS_LONG_SALT -DWOLFSSL_SHA384 -DWOLFSSL_SHA512 -DWOLFSSL_SYS_CA_CERTS -DWOLFSSL_TLS13 -DWOLFSSL_USE_ALIGN -I"D:\a\wolfssl\wolfssl\wolfssl" -I"D:\a\wolfssl\wolfssl\wolfssl\build" -I"C:\Users\runneradmin\WATCOM\h" -I"C:\Users\runneradmin\WATCOM\h\nt" -w3 -bt=nt -dWIN32 -br -bm -wx -wcd=202 -d2 -foCMakeFiles\wolfssl.dir\wolfcrypt\src\hmac.c.obj
Open Watcom C x86 32-bit Optimizing Compiler
Version 2.0 beta Jan 29 2025 02:09:25 (32-bit)
Copyright (c) 2002-2025 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
D:\a\wolfssl\wolfssl\wolfssl\wolfssl\wolfcrypt\wc_port.h(981): Error! E1022: Missing or misspelled data type near 'WIN32_FIND_DATAA'
D:\a\wolfssl\wolfssl\wolfssl\wolfssl\wolfcrypt\wc_port.h(982): Error! E1022: Missing or misspelled data type near 'HANDLE'
D:\a\wolfssl\wolfssl\wolfssl\wolfcrypt\src\hmac.c: 1453 lines, included 46766, 0 warnings, 2 errors
Error: Unable to invoke "C:\Users\runneradmin\WATCOM\BINNT\wcc386.exe"
Error(E42): Last command making (CMakeFiles\wolfssl.dir\wolfcrypt\src\hmac.c.obj) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (CMakeFiles\wolfssl.dir\all) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (all) returned a bad status
Error(E02): Make execution terminated

@jmalak
Copy link

jmalak commented Jan 31, 2025

I am running CMake by command

cmake -B build -G "Watcom WMake" -D CMAKE_VERBOSE_MAKEFILE=TRUE -D CMAKE_SYSTEM_NAME=Windows -D CMAKE_SYSTEM_PROCESSOR=x86 -D WOLFSSL_ASM=no -DCMAKE_BUILD_TYPE=Release

I will check with your setup, it looks like some mistake if single-thread configuration is used, I didn't check I am building multi-threaded version only on Windows

@jmalak
Copy link

jmalak commented Jan 31, 2025

You should fix wc_port.h

to contains windows.h for both multi and single threaded build

/* THREADING/MUTEX SECTION */
#if defined(__WATCOMC__)
    #if !defined(SINGLE_THREADED)
        #if defined(WOLFSSL_PTHREADS)
            #include <pthread.h>
        #else
            #if defined(USE_WINDOWS_API)
                #define _WINSOCKAPI_
                #include <windows.h>
            #endif
            #include <process.h>
        #endif
    #else
        #if defined(USE_WINDOWS_API)
            #define _WINSOCKAPI_
            #include <windows.h>
        #endif
    #endif
#elif defined(SINGLE_THREADED) && defined(NO_FILESYSTEM)
    /* No system headers required for build. */

@jmalak
Copy link

jmalak commented Jan 31, 2025

I got following results on Windows now

------------------------------------------------------------------------------
 wolfSSL version 5.7.6
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
SHA      test passed!
SHA-256  test passed!
SHA-384  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
Hash     test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-KDF    test passed!
PRF         test passed!
TLSv1.3 KDF test passed!
GMAC     test passed!
Chacha   test passed!
POLY1[30](https://github.com/jmalak/wolfssl/actions/runs/13064840797/job/36455306981#step:7:31)5 test passed!
ChaCha20-Poly1305 AEAD test passed!
AES      test passed!
AES192   test passed!
AES256   test passed!
AES-CBC  test passed!
AES-GCM  test passed!
RSA      test passed!
DH       test passed!
PWDBASED test passed!
ECC      test passed!
logging  test passed!
time     test passed!
mutex    test passed!
memcb    test passed!
Test complete
Exiting main with return code: 0

and benchmarks

------------------------------------------------------------------------------
 wolfSSL version 5.7.6
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1048576, min 1.0 sec each)
RNG                         25 MiB took 1.010 seconds,   24.747 MiB/s
AES-1[28](https://github.com/jmalak/wolfssl/actions/runs/13064840797/job/36455306981#step:8:29)-CBC-enc             55 MiB took 1.096 seconds,   50.191 MiB/s
AES-128-CBC-dec             55 MiB took 1.058 seconds,   51.980 MiB/s
AES-192-CBC-enc             50 MiB took 1.043 seconds,   47.946 MiB/s
AES-192-CBC-dec             50 MiB took 1.019 seconds,   49.073 MiB/s
AES-256-CBC-enc             50 MiB took 1.103 seconds,   45.333 MiB/s
AES-256-CBC-dec             50 MiB took 1.065 seconds,   46.970 MiB/s
AES-128-GCM-enc             40 MiB took 1.077 seconds,   37.127 MiB/s
AES-128-GCM-dec             40 MiB took 1.077 seconds,   37.139 MiB/s
AES-192-GCM-enc             40 MiB took 1.112 seconds,   35.962 MiB/s
AES-192-GCM-dec             40 MiB took 1.113 seconds,   35.926 MiB/s
AES-256-GCM-enc             35 MiB took 1.016 seconds,   34.465 MiB/s
AES-256-GCM-dec             35 MiB took 1.024 seconds,   34.174 MiB/s
GMAC Table 4-bit           127 MiB took 1.000 seconds,  126.950 MiB/s
CHACHA                     110 MiB took 1.008 seconds,  109.153 MiB/s
CHA-POLY                    35 MiB took 1.004 seconds,   34.857 MiB/s
MD5                        380 MiB took 1.003 seconds,  378.879 MiB/s
POLY1305                    50 MiB took 1.000 seconds,   49.998 MiB/s
SHA                        160 MiB took 1.004 seconds,  159.407 MiB/s
SHA-256                     60 MiB took 1.066 seconds,   56.276 MiB/s
SHA-384                     25 MiB took 1.009 seconds,   24.783 MiB/s
SHA-512                     25 MiB took 1.008 seconds,   24.800 MiB/s
SHA-512/224                 25 MiB took 1.008 seconds,   24.808 MiB/s
SHA-512/256                 25 MiB took 1.007 seconds,   24.815 MiB/s
HMAC-MD5                   380 MiB took 1.005 seconds,  377.952 MiB/s
HMAC-SHA                   160 MiB took 1.004 seconds,  159.353 MiB/s
HMAC-SHA256                 60 MiB took 1.064 seconds,   56.384 MiB/s
HMAC-SHA384                 25 MiB took 1.007 seconds,   24.814 MiB/s
HMAC-SHA512                 25 MiB took 1.005 seconds,   24.864 MiB/s
PBKDF2                       7 KiB took 1.002 seconds,    6.921 KiB/s
RSA     2048   public      1700 ops took 1.035 sec, avg 0.609 ms, 1642.0[29](https://github.com/jmalak/wolfssl/actions/runs/13064840797/job/36455306981#step:8:30) ops/sec
RSA     2048  private       100 ops took 3.817 sec, avg 38.172 ms, 26.197 ops/sec
DH      2048  key gen       131 ops took 1.004 sec, avg 7.668 ms, 1[30](https://github.com/jmalak/wolfssl/actions/runs/13064840797/job/36455306981#step:8:31).415 ops/sec
DH      2048    agree       100 ops took 1.778 sec, avg 17.781 ms, 56.240 ops/sec
ECC   [      SECP256R1]   256  key gen       200 ops took 1.004 sec, avg 5.019 ms, 199.234 ops/sec
ECDHE [      SECP256R1]   256    agree       200 ops took 1.005 sec, avg 5.026 ms, 198.957 ops/sec
ECDSA [      SECP256R1]   256     sign       200 ops took 1.012 sec, avg 5.062 ms, 197.540 ops/sec
ECDSA [      SECP256R1]   256   verify       400 ops took 1.[32](https://github.com/jmalak/wolfssl/actions/runs/13064840797/job/36455306981#step:8:33)1 sec, avg 3.303 ms, 302.725 ops/sec
Benchmark complete

It is pure C code without assembler code.

@jmalak
Copy link

jmalak commented Jan 31, 2025

I am in trouble with Linux target.
It is little bit odd how _POSIX_THREADS macro is used in WolfSSL.
As C standard say this symbols is from compiler reserved name space, that it is control by implementation.
WolfSSL manipulate with this macro as user macro.
Now I have a problem with Open Watcom implementation which report multiple different definition of _POSIX_THREADS macro.

Why WolfSSL touch _POSIX_THREADS macro (it is not permitted by C standard) instead of create own macro with regards of _POSIX_THREADS macro value and without such collision.

@jmalak
Copy link

jmalak commented Jan 31, 2025

@dgarske
Now I finished test on Linux with boths single and multithreade version.
single-threaded

Run ./testwolfcrypt
------------------------------------------------------------------------------
 wolfSSL version 5.[7](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507428482#step:8:8).6
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
SHA      test passed!
SHA-256  test passed!
SHA-3[8](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507428482#step:8:9)4  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
Hash     test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-KDF    test passed!
PRF         test passed!
TLSv1.3 KDF test passed!
GMAC     test passed!
Chacha   test passed!
POLY1305 test passed!
ChaCha20-Poly1305 AEAD test passed!
AES      test passed!
AES1[9](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507428482#step:8:10)2   test passed!
AES256   test passed!
AES-CBC  test passed!
AES-GCM  test passed!
RSA      test passed!
DH       test passed!
PWDBASED test passed!
ECC      test passed!
logging  test passed!
time     test passed!
mutex    test passed!
memcb    test passed!
Test complete
Exiting main with return code: 0

multi-threaded version

Run ./testwolfcrypt
------------------------------------------------------------------------------
 wolfSSL version 5.[7](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507427487#step:8:8).6
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
SHA      test passed!
SHA-256  test passed!
SHA-3[8](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507427487#step:8:9)4  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
Hash     test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-KDF    test passed!
PRF         test passed!
TLSv1.3 KDF test passed!
GMAC     test passed!
Chacha   test passed!
POLY1305 test passed!
ChaCha20-Poly1305 AEAD test passed!
AES      test passed!
AES1[9](https://github.com/jmalak/wolfssl/actions/runs/13082043663/job/36507427487#step:8:10)2   test passed!
AES256   test passed!
AES-CBC  test passed!
AES-GCM  test passed!
RSA      test passed!
DH       test passed!
PWDBASED test passed!
ECC      test passed!
logging  test passed!
time     test passed!
mutex    test passed!
memcb    test passed!
Test complete
Exiting main with return code: 0

@jmalak
Copy link

jmalak commented Jan 31, 2025

And benchmark for single-threaded linux build

Run ./benchmark
------------------------------------------------------------------------------
 wolfSSL version 5.[7](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:8).6
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 104[8](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:9)576, min 1.0 sec each)
RNG                         30 MiB took 1.031 seconds,   2[9](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:10).103 MiB/s
AES-128-CBC-enc             55 MiB took 1.090 seconds,   50.476 MiB/s
AES-128-CBC-dec             55 MiB took 1.057 seconds,   52.014 MiB/s
AES-192-CBC-enc             50 MiB took 1.040 seconds,   48.058 MiB/s
AES-192-CBC-dec             50 MiB took 1.0[10](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:11) seconds,   49.488 MiB/s
AES-256-CBC-enc             50 MiB took 1.103 seconds,   45.348 MiB/s
AES-256-CBC-dec             50 MiB took 1.062 seconds,   47.082 MiB/s
AES-128-GCM-enc             40 MiB took 1.078 seconds,   37.123 MiB/s
AES-128-GCM-dec             40 MiB took 1.074 seconds,   37.257 MiB/s
AES-192-GCM-enc             40 MiB took 1.[11](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:12)5 seconds,   35.866 MiB/s
AES-192-GCM-dec             35 MiB took 1.045 seconds,   33.495 MiB/s
AES-256-GCM-enc             35 MiB took 1.018 seconds,   34.379 MiB/s
AES-256-GCM-dec             35 MiB took 1.019 seconds,   34.350 MiB/s
GMAC Table 4-bit           [12](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:13)7 MiB took 1.001 seconds,  126.839 MiB/s
CHACHA                     105 MiB took 1.036 seconds,  101.346 MiB/s
CHA-POLY                    35 MiB took 1.002 seconds,   34.914 MiB/s
MD5                        375 MiB took 1.006 seconds,  372.612 MiB/s
POLY[13](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:14)05                    55 MiB took 1.077 seconds,   51.078 MiB/s
SHA                        135 MiB took 1.015 seconds,  133.043 MiB/s
SHA-256                     70 MiB took 1.050 seconds,   66.679 MiB/s
SHA-384                     30 MiB took 1.070 seconds,   28.027 MiB/s
SHA-512                     30 MiB took 1.070 seconds,   28.045 MiB/s
SHA-512/224                 30 MiB took 1.074 seconds,   27.940 MiB/s
SHA-512/256                 30 MiB took 1.071 seconds,   28.010 MiB/s
HMAC-MD5                   375 MiB took 1.006 seconds,  372.884 MiB/s
HMAC-SHA                   135 MiB took 1.016 seconds,  132.897 MiB/s
HMAC-SHA256                 70 MiB took 1.026 seconds,   68.250 MiB/s
HMAC-SHA384                 30 MiB took 1.071 seconds,   28.022 MiB/s
HMAC-SHA512                 30 MiB took 1.074 seconds,   27.930 MiB/s
PBKDF2                       8 KiB took 1.002 seconds,    8.298 KiB/s
RSA     2048   public      1800 ops took 1.012 sec, avg 0.562 ms, 1779.276 ops/sec
RSA     2048  private       100 ops took 3.557 sec, avg 35.574 ms, 28.110 ops/sec
DH      2048  key gen       [14](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:15)3 ops took 1.007 sec, avg 7.040 ms, 142.053 ops/sec
DH      2048    agree       100 ops took 1.652 sec, avg 16.521 ms, 60.528 ops/sec
ECC   [      SECP256R1]   256  key gen       300 ops took 1.435 sec, avg 4.784 ms, 209.028 ops/sec
ECDHE [      SECP256R1]   256    agree       300 ops took 1.431 sec, avg 4.770 ms, 209.653 ops/sec
ECDSA [      SECP256R1]   256     sign       300 ops took 1.445 sec, avg 4.8[16](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509206378#step:10:17) ms, 207.647 ops/sec
ECDSA [      SECP256R1]   256   verify       400 ops took 1.257 sec, avg 3.144 ms, 318.110 ops/sec
Benchmark complete

and multi-threaded Linux build

Run ./benchmark
------------------------------------------------------------------------------
 wolfSSL version 5.[7](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:8).6
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 104[8](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:9)576, min 1.0 sec each)
RNG                         30 MiB took 1.064 seconds,   28.187 MiB/s
AES-128-CBC-enc             60 MiB took 1.068 seconds,   56.185 MiB/s
AES-128-CBC-dec             55 MiB took 1.065 seconds,   51.643 MiB/s
AES-1[9](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:10)2-CBC-enc             55 MiB took 1.041 seconds,   52.843 MiB/s
AES-192-CBC-dec             50 MiB took 1.016 seconds,   49.229 MiB/s
AES-256-CBC-enc             50 MiB took 1.001 seconds,   49.951 MiB/s
AES-256-CBC-dec             50 MiB took 1.070 seconds,   46.738 MiB/s
AES-128-GCM-enc             40 MiB took 1.003 seconds,   39.870 MiB/s
AES-128-GCM-dec             40 MiB took 1.002 seconds,   39.916 MiB/s
AES-192-GCM-enc             40 MiB took 1.055 seconds,   37.925 MiB/s
AES-192-GCM-dec             40 MiB took 1.067 seconds,   37.471 MiB/s
AES-256-GCM-enc             40 MiB took 1.084 seconds,   36.909 MiB/s
AES-256-GCM-dec             40 MiB took 1.084 seconds,   36.900 MiB/s
GMAC Table 4-bit           127 MiB took 1.002 seconds,  126.774 MiB/s
CHACHA                     1[10](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:11) MiB took 1.009 seconds,  109.042 MiB/s
CHA-POLY                    40 MiB took 1.147 seconds,   34.886 MiB/s
MD5                        380 MiB took 1.007 seconds,  377.516 MiB/s
POLY1305                    55 MiB took 1.076 seconds,   51.099 MiB/s
SHA                        160 MiB took 1.014 seconds,  157.738 MiB/s
SHA-256                     70 MiB took 1.060 seconds,   66.010 MiB/s
SHA-384                     30 MiB took 1.062 seconds,   28.239 MiB/s
SHA-512                     30 MiB took 1.062 seconds,   28.244 MiB/s
SHA-512/224                 30 MiB took 1.073 seconds,   27.970 MiB/s
SHA-512/256                 30 MiB took 1.061 seconds,   28.273 MiB/s
HMAC-MD5                   385 MiB took 1.008 seconds,  382.130 MiB/s
HMAC-SHA                   160 MiB took 1.0[11](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:12) seconds,  158.215 MiB/s
HMAC-SHA256                 70 MiB took 1.055 seconds,   66.362 MiB/s
HMAC-SHA384                 30 MiB took 1.062 seconds,   28.238 MiB/s
HMAC-SHA5[12](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:13)                 30 MiB took 1.064 seconds,   28.185 MiB/s
PBKDF2                       8 KiB took 1.003 seconds,    8.037 KiB/s
RSA     2048   public      2100 ops took 1.043 sec, avg 0.496 ms, 20[14](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:15).289 ops/sec
RSA     2048  private       100 ops took 3.092 sec, avg 30.918 ms, 32.344 ops/sec
DH      2048  key gen       162 ops took 1.005 sec, avg 6.207 ms, 161.1[15](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:16) ops/sec
DH      2048    agree       100 ops took 1.430 sec, avg 14.304 ms, 69.909 ops/sec
ECC   [      SECP256R1]   256  key gen       300 ops took 1.278 sec, avg 4.260 ms, 234.734 ops/sec
ECDHE [      SECP256R1]   256    agree       300 ops took 1.273 sec, avg 4.245 ms, 235.574 ops/sec
ECDSA [      SECP256R1]   256     sign       300 ops took 1.288 sec, avg 4.294 ms, 232.891 ops/sec
ECDSA [      SECP256R1]   256   verify       400 ops took 1.1[16](https://github.com/jmalak/wolfssl/actions/runs/13082688517/job/36509205858#step:10:17) sec, avg 2.789 ms, 358.561 ops/sec
Benchmark complete

@jmalak
Copy link

jmalak commented Feb 1, 2025

I enclosed last changes, I completely separate Open Watcom code for thread support because it was spread over WolfSSL on different places.
last-changes.patch

@jmalak
Copy link

jmalak commented Feb 1, 2025

Now remains OS/2 implementation, it take me more time because there will be necessary to create new OS/2 specific code (interface with OS).

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

Successfully merging this pull request may close these issues.

4 participants