From owner-dev-commits-ports-all@freebsd.org Sun Apr 25 16:49:30 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F4145627CD7; Sun, 25 Apr 2021 16:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FSvBd6Zmwz3p3D; Sun, 25 Apr 2021 16:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D08B2178FD; Sun, 25 Apr 2021 16:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13PGnTW1070306; Sun, 25 Apr 2021 16:49:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13PGnTKZ070305; Sun, 25 Apr 2021 16:49:29 GMT (envelope-from git) Date: Sun, 25 Apr 2021 16:49:29 GMT Message-Id: <202104251649.13PGnTKZ070305@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Piotr Kubaj Subject: git: 4181b0995f99 - main - security/cryptopp: enable SIMD by default on powerpc and powerpc64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4181b0995f99dec92a283ec4b515bd9d2fea0985 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 16:49:30 -0000 The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=4181b0995f99dec92a283ec4b515bd9d2fea0985 commit 4181b0995f99dec92a283ec4b515bd9d2fea0985 Author: Piotr Kubaj AuthorDate: 2021-04-25 16:43:31 +0000 Commit: Piotr Kubaj CommitDate: 2021-04-25 16:43:31 +0000 security/cryptopp: enable SIMD by default on powerpc and powerpc64 Upstream can now check at runtime for SIMD availaibility. Merge upstream commits https://github.com/weidai11/cryptopp/commit/91173a287e668f7ce7e5086789b8db2300a159b1 and https://github.com/weidai11/cryptopp/commit/21a40abc5ceeb0ccf6577a444f1b4c19fa6379c6 to implement it. Local patch is used because upstream patch doesn't apply. Remove -maltivec and -mvsx, upstream now properly sets those flags on their own. --- security/cryptopp/Makefile | 5 +- security/cryptopp/files/patch-cpu.cpp | 111 ++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/security/cryptopp/Makefile b/security/cryptopp/Makefile index f0e40036ee36..489dc524d2b7 100644 --- a/security/cryptopp/Makefile +++ b/security/cryptopp/Makefile @@ -2,6 +2,7 @@ PORTNAME= cryptopp PORTVERSION= 8.5.0 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= http://www.cryptopp.com/ DISTNAME= cryptopp${PORTVERSION:S/.//g} @@ -35,6 +36,8 @@ OPTIONS_DEFINE_powerpc= SIMD OPTIONS_DEFINE_powerpc64= SIMD OPTIONS_DEFINE_powerpc64le= SIMD OPTIONS_DEFAULT= TOOLS +OPTIONS_DEFAULT_powerpc= SIMD +OPTIONS_DEFAULT_powerpc64= SIMD OPTIONS_DEFAULT_powerpc64le= SIMD OPTIONS_SUB= yes @@ -66,7 +69,7 @@ CXXFLAGS+= -DCRYPTOPP_DISABLE_SSSE3 CXXFLAGS+= -DCRYPTOPP_DISABLE_SSE4 . endif . elif ${ARCH} == powerpc || ${ARCH:Mpowerpc64*} -CXXFLAGS+= -DCRYPTOPP_ALTIVEC_AVAILABLE -maltivec -mcrypto -mvsx +CXXFLAGS+= -DCRYPTOPP_ALTIVEC_AVAILABLE . endif .else CXXFLAGS+= -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_DISABLE_SSE2 \ diff --git a/security/cryptopp/files/patch-cpu.cpp b/security/cryptopp/files/patch-cpu.cpp new file mode 100644 index 000000000000..a8e71a174d54 --- /dev/null +++ b/security/cryptopp/files/patch-cpu.cpp @@ -0,0 +1,111 @@ +--- cpu.cpp.orig 2021-03-08 03:42:24 UTC ++++ cpu.cpp +@@ -1172,6 +1172,11 @@ inline bool CPU_QueryAltivec() + unsigned int unused, arch; + GetAppleMachineInfo(unused, unused, arch); + return arch == AppleMachineInfo::PowerMac; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE_HAS_ALTIVEC) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE_HAS_ALTIVEC; + #endif + return false; + } +@@ -1185,6 +1190,12 @@ inline bool CPU_QueryPower7() + #elif defined(_AIX) + if (__power_7_andup() != 0) + return true; ++ ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE_ARCH_2_06) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE_ARCH_2_06; + #endif + return false; + } +@@ -1198,6 +1209,11 @@ inline bool CPU_QueryPower8() + #elif defined(_AIX) + if (__power_8_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_ARCH_2_07) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_ARCH_2_07; + #endif + return false; + } +@@ -1211,6 +1227,11 @@ inline bool CPU_QueryPower9() + #elif defined(_AIX) + if (__power_9_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_ARCH_3_00) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE_ARCH2_3_00; + #endif + return false; + } +@@ -1225,6 +1246,11 @@ inline bool CPU_QueryAES() + #elif defined(_AIX) + if (__power_8_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_HAS_VEC_CRYPTO) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO; + #endif + return false; + } +@@ -1239,6 +1265,11 @@ inline bool CPU_QueryPMULL() + #elif defined(_AIX) + if (__power_8_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_HAS_VEC_CRYPTO) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO; + #endif + return false; + } +@@ -1253,6 +1284,11 @@ inline bool CPU_QuerySHA256() + #elif defined(_AIX) + if (__power_8_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_HAS_VEC_CRYPTO) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO; + #endif + return false; + } +@@ -1266,6 +1302,11 @@ inline bool CPU_QuerySHA512() + #elif defined(_AIX) + if (__power_8_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_HAS_VEC_CRYPTO) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO; + #endif + return false; + } +@@ -1280,6 +1321,11 @@ inline bool CPU_QueryDARN() + #elif defined(_AIX) + if (__power_9_andup() != 0) + return true; ++#elif defined(__FreeBSD__) && defined(PPC_FEATURE2_ARCH_3_00) ++ unsigned long cpufeatures; ++ if (elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)) ++ return false; ++ else return cpufeatures & PPC_FEATURE2_ARCH_3_00; + #endif + return false; + }