diff --git a/security/botan2/Makefile b/security/botan2/Makefile index cf81a65601b..89d3b6305ce 100644 --- a/security/botan2/Makefile +++ b/security/botan2/Makefile @@ -3,7 +3,7 @@ COMMENT = crypto and TLS for C++11 VERSION = 2.19.5 DISTNAME = Botan-${VERSION} PKGNAME = botan2-${VERSION} -REVISION = 0 +REVISION = 1 SHARED_LIBS = botan-2 19.1 diff --git a/security/botan2/patches/patch-src_build-data_os_openbsd_txt b/security/botan2/patches/patch-src_build-data_os_openbsd_txt index 87bc1c854c9..12b79550add 100644 --- a/security/botan2/patches/patch-src_build-data_os_openbsd_txt +++ b/security/botan2/patches/patch-src_build-data_os_openbsd_txt @@ -1,6 +1,7 @@ Use OpenBSD numbering for shared library. -Enable elf_aux_info() support. +Provides auxiliary vector support for OpenBSD +69ad604ff8ba35860cfb22be3ed4e763ea07ba2c Index: src/build-data/os/openbsd.txt --- src/build-data/os/openbsd.txt.orig diff --git a/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_arm_cpp b/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_arm_cpp new file mode 100644 index 00000000000..47fec0d5f49 --- /dev/null +++ b/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_arm_cpp @@ -0,0 +1,28 @@ +Fix aarch64/armv7/ppc64 feature detection for systems with AT_HWCAP != 16 +c0697e73a19b46fb389aeb5fe14a92b2275b5301 + +Index: src/lib/utils/cpuid/cpuid_arm.cpp +--- src/lib/utils/cpuid/cpuid_arm.cpp.orig ++++ src/lib/utils/cpuid/cpuid_arm.cpp +@@ -153,7 +153,7 @@ uint64_t CPUID::CPUID_Data::detect_cpu_features(size_t + *cache_line_size = static_cast(dcache_line); + #endif + +- const unsigned long hwcap_neon = OS::get_auxval(ARM_hwcap_bit::ARCH_hwcap_neon); ++ const unsigned long hwcap_neon = OS::get_auxval(OS::auxval_hwcap()); + if(hwcap_neon & ARM_hwcap_bit::NEON_bit) + detected_features |= CPUID::CPUID_ARM_NEON_BIT; + +@@ -162,7 +162,11 @@ uint64_t CPUID::CPUID_Data::detect_cpu_features(size_t + It doesn't seem worth optimizing this out, since getauxval is + just reading a field in the ELF header. + */ +- const unsigned long hwcap_crypto = OS::get_auxval(ARM_hwcap_bit::ARCH_hwcap_crypto); ++#if defined(BOTAN_TARGET_ARCH_IS_ARM32) ++ const unsigned long hwcap_crypto = OS::get_auxval(OS::auxval_hwcap2()); ++#elif defined(BOTAN_TARGET_ARCH_IS_ARM64) ++ const unsigned long hwcap_crypto = OS::get_auxval(OS::auxval_hwcap()); ++#endif + if(hwcap_crypto & ARM_hwcap_bit::AES_bit) + detected_features |= CPUID::CPUID_ARM_AES_BIT; + if(hwcap_crypto & ARM_hwcap_bit::PMULL_bit) diff --git a/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_ppc_cpp b/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_ppc_cpp new file mode 100644 index 00000000000..e945f5de5c8 --- /dev/null +++ b/security/botan2/patches/patch-src_lib_utils_cpuid_cpuid_ppc_cpp @@ -0,0 +1,20 @@ +Fix aarch64/armv7/ppc64 feature detection for systems with AT_HWCAP != 16 +c0697e73a19b46fb389aeb5fe14a92b2275b5301 + +Index: src/lib/utils/cpuid/cpuid_ppc.cpp +--- src/lib/utils/cpuid/cpuid_ppc.cpp.orig ++++ src/lib/utils/cpuid/cpuid_ppc.cpp +@@ -66,11 +66,11 @@ uint64_t CPUID::CPUID_Data::detect_cpu_features(size_t + + uint64_t detected_features = 0; + +- const unsigned long hwcap_altivec = OS::get_auxval(PPC_hwcap_bit::ARCH_hwcap_altivec); ++ const unsigned long hwcap_altivec = OS::get_auxval(OS::auxval_hwcap()); + if(hwcap_altivec & PPC_hwcap_bit::ALTIVEC_bit) + detected_features |= CPUID::CPUID_ALTIVEC_BIT; + +- const unsigned long hwcap_crypto = OS::get_auxval(PPC_hwcap_bit::ARCH_hwcap_crypto); ++ const unsigned long hwcap_crypto = OS::get_auxval(OS::auxval_hwcap2()); + if(hwcap_crypto & PPC_hwcap_bit::CRYPTO_bit) + detected_features |= CPUID::CPUID_POWER_CRYPTO_BIT; + if(hwcap_crypto & PPC_hwcap_bit::DARN_bit) diff --git a/security/botan2/patches/patch-src_lib_utils_os_utils_cpp b/security/botan2/patches/patch-src_lib_utils_os_utils_cpp new file mode 100644 index 00000000000..1f61eaf950f --- /dev/null +++ b/security/botan2/patches/patch-src_lib_utils_os_utils_cpp @@ -0,0 +1,33 @@ +Fix aarch64/armv7/ppc64 feature detection for systems with AT_HWCAP != 16 +c0697e73a19b46fb389aeb5fe14a92b2275b5301 + +Index: src/lib/utils/os_utils.cpp +--- src/lib/utils/os_utils.cpp.orig ++++ src/lib/utils/os_utils.cpp +@@ -106,6 +106,26 @@ uint32_t OS::get_process_id() + #endif + } + ++unsigned long OS::auxval_hwcap() { ++#if defined(AT_HWCAP) ++ return AT_HWCAP; ++#else ++ // If the value is not defined in a header we can see, ++ // but auxval is supported, return the Linux/Android value ++ return (OS::has_auxval()) ? 16 : 0; ++#endif ++} ++ ++unsigned long OS::auxval_hwcap2() { ++#if defined(AT_HWCAP2) ++ return AT_HWCAP2; ++#else ++ // If the value is not defined in a header we can see, ++ // but auxval is supported, return the Linux/Android value ++ return (OS::has_auxval()) ? 26 : 0; ++#endif ++} ++ + unsigned long OS::get_auxval(unsigned long id) + { + #if defined(BOTAN_TARGET_OS_HAS_GETAUXVAL) diff --git a/security/botan2/patches/patch-src_lib_utils_os_utils_h b/security/botan2/patches/patch-src_lib_utils_os_utils_h new file mode 100644 index 00000000000..72d8264b34b --- /dev/null +++ b/security/botan2/patches/patch-src_lib_utils_os_utils_h @@ -0,0 +1,27 @@ +Fix aarch64/armv7/ppc64 feature detection for systems with AT_HWCAP != 16 +c0697e73a19b46fb389aeb5fe14a92b2275b5301 + +Index: src/lib/utils/os_utils.h +--- src/lib/utils/os_utils.h.orig ++++ src/lib/utils/os_utils.h +@@ -54,6 +54,20 @@ size_t BOTAN_TEST_API get_cpu_total(); + size_t BOTAN_TEST_API get_cpu_available(); + + /** ++* If get_auxval is supported, returns the relevant value for AT_HWCAP ++* ++* If get_auxval is not supported on this system, arbitrarily returns 0 ++*/ ++unsigned long auxval_hwcap(); ++ ++/** ++* If get_auxval is supported, returns the relevant value for AT_HWCAP2 ++* ++* If get_auxval is not supported on this system, arbitrarily returns 0 ++*/ ++unsigned long auxval_hwcap2(); ++ ++/** + * Return the ELF auxiliary vector cooresponding to the given ID. + * This only makes sense on Unix-like systems and is currently + * only supported on Linux, Android, and FreeBSD.