From b8ef3f52bb5c3911ef91ea9396e1a52c41c89169 Mon Sep 17 00:00:00 2001 From: autoantwort <41973254+autoantwort@users.noreply.github.com> Date: Thu, 14 Sep 2023 01:04:07 +0200 Subject: [PATCH] [wolfssl] fix windows build (#33752) --- ports/wolfssl/fix-windows-build.patch | 49 +++++++++++++++++++++++++++ ports/wolfssl/portfile.cmake | 1 + ports/wolfssl/vcpkg.json | 1 + versions/baseline.json | 2 +- versions/w-/wolfssl.json | 5 +++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 ports/wolfssl/fix-windows-build.patch diff --git a/ports/wolfssl/fix-windows-build.patch b/ports/wolfssl/fix-windows-build.patch new file mode 100644 index 0000000000..5355c414cf --- /dev/null +++ b/ports/wolfssl/fix-windows-build.patch @@ -0,0 +1,49 @@ +diff --git a/wolfcrypt/src/chacha20_poly1305.c b/wolfcrypt/src/chacha20_poly1305.c +index e4ebd10165f..0c37de747af 100644 +--- a/wolfcrypt/src/chacha20_poly1305.c ++++ b/wolfcrypt/src/chacha20_poly1305.c +@@ -355,9 +355,9 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot( + int isEncrypt) + { + int ret; +- ssize_t dst_len = isEncrypt ? +- (ssize_t)src_len + POLY1305_DIGEST_SIZE : +- (ssize_t)src_len - POLY1305_DIGEST_SIZE; ++ long int dst_len = isEncrypt ? ++ (long int)src_len + POLY1305_DIGEST_SIZE : ++ (long int)src_len - POLY1305_DIGEST_SIZE; + const byte *src_i; + byte *dst_i; + size_t src_len_rem; +@@ -375,7 +375,7 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot( + goto out; + } + +- if ((ssize_t)dst_space < dst_len) { ++ if ((long int)dst_space < dst_len) { + ret = BUFFER_E; + goto out; + } +diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h +index 47e3b7363af..feeefe4a2ce 100644 +--- a/wolfssl/wolfcrypt/settings.h ++++ b/wolfssl/wolfcrypt/settings.h +@@ -1876,11 +1876,13 @@ extern void uITRON4_free(void *p) ; + #endif + #endif + +-#ifdef _MSC_VER +- #ifndef HAVE_SSIZE_T +- #include +- typedef SSIZE_T ssize_t; +- #endif ++#if defined(NO_WC_SSIZE_TYPE) || defined(ssize_t) ++ /* ssize_t comes from system headers or user_settings.h */ ++#elif defined(WC_SSIZE_TYPE) ++ typedef WC_SSIZE_TYPE ssize_t; ++#elif defined(_MSC_VER) ++ #include ++ typedef SSIZE_T ssize_t; + #endif + + /* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */ diff --git a/ports/wolfssl/portfile.cmake b/ports/wolfssl/portfile.cmake index fcbbc33f5e..67a6cb7f31 100644 --- a/ports/wolfssl/portfile.cmake +++ b/ports/wolfssl/portfile.cmake @@ -6,6 +6,7 @@ vcpkg_from_github( HEAD_REF master PATCHES warning-and-include.patch + fix-windows-build.patch # From https://github.com/wolfSSL/wolfssl/pull/6509 ) vcpkg_cmake_configure( diff --git a/ports/wolfssl/vcpkg.json b/ports/wolfssl/vcpkg.json index 4c2ac10b7c..08728dfae6 100644 --- a/ports/wolfssl/vcpkg.json +++ b/ports/wolfssl/vcpkg.json @@ -1,6 +1,7 @@ { "name": "wolfssl", "version": "5.6.3", + "port-version": 1, "description": "TLS and Cryptographic library for many platforms", "homepage": "https://wolfssl.com", "license": "GPL-2.0-or-later", diff --git a/versions/baseline.json b/versions/baseline.json index e23a38a7be..aeb077e53e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8822,7 +8822,7 @@ }, "wolfssl": { "baseline": "5.6.3", - "port-version": 0 + "port-version": 1 }, "wolftpm": { "baseline": "2.7.0", diff --git a/versions/w-/wolfssl.json b/versions/w-/wolfssl.json index 4c57d003e1..3d586e4d21 100644 --- a/versions/w-/wolfssl.json +++ b/versions/w-/wolfssl.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b1ed14c731f84f9a8f885e9bf40898c318bd4986", + "version": "5.6.3", + "port-version": 1 + }, { "git-tree": "e809eb7090657113c8f628ce22975c7f3bd3dbfd", "version": "5.6.3",