mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-24 04:33:24 +00:00
security/cryptopp: enable SIMD by default on powerpc and powerpc64
Upstream can now check at runtime for SIMD availaibility. Merge upstream commits91173a287e
and21a40abc5c
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.
This commit is contained in:
parent
bf677a321b
commit
4181b0995f
@ -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 \
|
||||
|
111
security/cryptopp/files/patch-cpu.cpp
Normal file
111
security/cryptopp/files/patch-cpu.cpp
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user