diff --git a/ports/libsodium/arm-neon.diff b/ports/libsodium/arm-neon.diff new file mode 100644 index 0000000000..fb5302e736 --- /dev/null +++ b/ports/libsodium/arm-neon.diff @@ -0,0 +1,119 @@ +diff --git a/configure.ac b/configure.ac +index df83ef5..be67d34 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -398,11 +398,6 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [ + have_armcrypto=no + AC_MSG_CHECKING(for ARM crypto instructions set) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +- #ifdef __clang__ +- # pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) +- #elif defined(__GNUC__) +- # pragma GCC target("+simd+crypto") +- #endif + #ifndef __ARM_FEATURE_CRYPTO + # define __ARM_FEATURE_CRYPTO 1 + #endif +@@ -411,6 +406,12 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [ + #endif + + #include ++ ++ #ifdef __clang__ ++ # pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) ++ #elif defined(__GNUC__) ++ # pragma GCC target("+simd+crypto") ++ #endif + ]], [[ + vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(0)); + +diff --git a/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.c b/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.c +index 825de8a..a01f60c 100644 +--- a/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.c ++++ b/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.c +@@ -17,12 +17,6 @@ + + #include "aegis128l_armcrypto.h" + +-#ifdef __clang__ +-#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) +-#elif defined(__GNUC__) +-#pragma GCC target("+simd+crypto") +-#endif +- + #ifndef __ARM_FEATURE_CRYPTO + #define __ARM_FEATURE_CRYPTO 1 + #endif +@@ -32,6 +26,12 @@ + + #include + ++#ifdef __clang__ ++#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) ++#elif defined(__GNUC__) ++#pragma GCC target("+simd+crypto") ++#endif ++ + #define AES_BLOCK_LENGTH 16 + + typedef uint8x16_t aes_block_t; +diff --git a/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.c b/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.c +index e1ebd57..058e207 100644 +--- a/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.c ++++ b/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.c +@@ -17,12 +17,6 @@ + + #include "aegis256_armcrypto.h" + +-#ifdef __clang__ +-#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) +-#elif defined(__GNUC__) +-#pragma GCC target("+simd+crypto") +-#endif +- + #ifndef __ARM_FEATURE_CRYPTO + #define __ARM_FEATURE_CRYPTO 1 + #endif +@@ -32,6 +26,12 @@ + + #include + ++#ifdef __clang__ ++#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) ++#elif defined(__GNUC__) ++#pragma GCC target("+simd+crypto") ++#endif ++ + #define AES_BLOCK_LENGTH 16 + + typedef uint8x16_t aes_block_t; +diff --git a/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c b/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c +index 0a5a128..aa76f5c 100644 +--- a/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c ++++ b/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c +@@ -19,12 +19,6 @@ + #define __vectorcall + #endif + +-#ifdef __clang__ +-#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) +-#elif defined(__GNUC__) +-#pragma GCC target("+simd+crypto") +-#endif +- + #ifndef __ARM_FEATURE_CRYPTO + #define __ARM_FEATURE_CRYPTO 1 + #endif +@@ -34,6 +28,12 @@ + + #include + ++#ifdef __clang__ ++#pragma clang attribute push(__attribute__((target("neon,crypto,aes"))), apply_to = function) ++#elif defined(__GNUC__) ++#pragma GCC target("+simd+crypto") ++#endif ++ + #define ABYTES crypto_aead_aes256gcm_ABYTES + #define NPUBBYTES crypto_aead_aes256gcm_NPUBBYTES + #define KEYBYTES crypto_aead_aes256gcm_KEYBYTES diff --git a/ports/libsodium/portfile.cmake b/ports/libsodium/portfile.cmake index c30c17163f..41fab984d9 100644 --- a/ports/libsodium/portfile.cmake +++ b/ports/libsodium/portfile.cmake @@ -4,6 +4,8 @@ vcpkg_from_github( REF ${VERSION} SHA512 6094d7bf191ea3be85f2ddab76b71f1b9c69c786493db5b84d3c5d5a0237003377ddf6a8687a962ea651fe4a9369cf5ee1676ba0bae82690f5f7ef31a698efa9 HEAD_REF master + PATCHES + arm-neon.diff # https://github.com/jedisct1/libsodium/commit/8f453f41f8834e0fe47610f2a3e03e696ddb3450 with fuzz 2 ) if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) diff --git a/ports/libsodium/vcpkg.json b/ports/libsodium/vcpkg.json index 64e45888c3..b5a25bdb59 100644 --- a/ports/libsodium/vcpkg.json +++ b/ports/libsodium/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libsodium", "version": "1.0.19", - "port-version": 1, + "port-version": 2, "description": "A modern and easy-to-use crypto library", "homepage": "https://libsodium.org/", "license": "ISC", diff --git a/versions/baseline.json b/versions/baseline.json index 70fd8e8c7b..ecf6c748cf 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4938,7 +4938,7 @@ }, "libsodium": { "baseline": "1.0.19", - "port-version": 1 + "port-version": 2 }, "libsonic": { "baseline": "0.2.0", diff --git a/versions/l-/libsodium.json b/versions/l-/libsodium.json index d3f7cddd71..3896b670bc 100644 --- a/versions/l-/libsodium.json +++ b/versions/l-/libsodium.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "24563a7817fe403090f82593e4be4c3bc8219510", + "version": "1.0.19", + "port-version": 2 + }, { "git-tree": "38de4073e90ae48d9d7bc68db71b850b5645f5ab", "version": "1.0.19",