initial buildroot for linux 5.15
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
From 372bdf0348fb86d671e73baab19daa34bd0cf73d Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Tue, 9 Nov 2021 19:01:20 +0100
|
||||
Subject: [PATCH] Revert "workaround a miscompilation issue in clang 12
|
||||
(XCode 13)"
|
||||
|
||||
This reverts commit 219329f8e777af54d785ae7259f8be32a714b751.
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Upstream status: https://github.com/randombit/botan/issues/2845]
|
||||
---
|
||||
src/lib/hash/sha3/sha3.cpp | 46 ++++++-----------------
|
||||
src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp | 46 ++++++-----------------
|
||||
2 files changed, 22 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/src/lib/hash/sha3/sha3.cpp b/src/lib/hash/sha3/sha3.cpp
|
||||
index 289e451ff..690c2b264 100644
|
||||
--- a/src/lib/hash/sha3/sha3.cpp
|
||||
+++ b/src/lib/hash/sha3/sha3.cpp
|
||||
@@ -11,47 +11,23 @@
|
||||
#include <botan/exceptn.h>
|
||||
#include <botan/cpuid.h>
|
||||
|
||||
-#include <tuple>
|
||||
-
|
||||
namespace Botan {
|
||||
|
||||
namespace {
|
||||
|
||||
-// This is a workaround for a suspected bug in clang 12 (and XCode 13)
|
||||
-// that caused a miscompile of the SHA3 implementation for optimization
|
||||
-// level -O2 and higher.
|
||||
-//
|
||||
-// For details, see: https://github.com/randombit/botan/issues/2802
|
||||
-#if defined(__clang__) && \
|
||||
- (( defined(__apple_build_version__) && __clang_major__ == 13) || \
|
||||
- (!defined(__apple_build_version__) && __clang_major__ == 12))
|
||||
-#define BOTAN_WORKAROUND_MAYBE_INLINE __attribute__((noinline))
|
||||
-#else
|
||||
-#define BOTAN_WORKAROUND_MAYBE_INLINE inline
|
||||
-#endif
|
||||
-
|
||||
-BOTAN_WORKAROUND_MAYBE_INLINE std::tuple<uint64_t, uint64_t, uint64_t, uint64_t, uint64_t>
|
||||
- xor_CNs(const uint64_t A[25])
|
||||
- {
|
||||
- return {
|
||||
- A[0] ^ A[5] ^ A[10] ^ A[15] ^ A[20],
|
||||
- A[1] ^ A[6] ^ A[11] ^ A[16] ^ A[21],
|
||||
- A[2] ^ A[7] ^ A[12] ^ A[17] ^ A[22],
|
||||
- A[3] ^ A[8] ^ A[13] ^ A[18] ^ A[23],
|
||||
- A[4] ^ A[9] ^ A[14] ^ A[19] ^ A[24]};
|
||||
- }
|
||||
-
|
||||
-#undef BOTAN_WORKAROUND_MAYBE_INLINE
|
||||
-
|
||||
inline void SHA3_round(uint64_t T[25], const uint64_t A[25], uint64_t RC)
|
||||
{
|
||||
- const auto Cs = xor_CNs(A);
|
||||
-
|
||||
- const uint64_t D0 = rotl<1>(std::get<0>(Cs)) ^ std::get<3>(Cs);
|
||||
- const uint64_t D1 = rotl<1>(std::get<1>(Cs)) ^ std::get<4>(Cs);
|
||||
- const uint64_t D2 = rotl<1>(std::get<2>(Cs)) ^ std::get<0>(Cs);
|
||||
- const uint64_t D3 = rotl<1>(std::get<3>(Cs)) ^ std::get<1>(Cs);
|
||||
- const uint64_t D4 = rotl<1>(std::get<4>(Cs)) ^ std::get<2>(Cs);
|
||||
+ const uint64_t C0 = A[0] ^ A[5] ^ A[10] ^ A[15] ^ A[20];
|
||||
+ const uint64_t C1 = A[1] ^ A[6] ^ A[11] ^ A[16] ^ A[21];
|
||||
+ const uint64_t C2 = A[2] ^ A[7] ^ A[12] ^ A[17] ^ A[22];
|
||||
+ const uint64_t C3 = A[3] ^ A[8] ^ A[13] ^ A[18] ^ A[23];
|
||||
+ const uint64_t C4 = A[4] ^ A[9] ^ A[14] ^ A[19] ^ A[24];
|
||||
+
|
||||
+ const uint64_t D0 = rotl<1>(C0) ^ C3;
|
||||
+ const uint64_t D1 = rotl<1>(C1) ^ C4;
|
||||
+ const uint64_t D2 = rotl<1>(C2) ^ C0;
|
||||
+ const uint64_t D3 = rotl<1>(C3) ^ C1;
|
||||
+ const uint64_t D4 = rotl<1>(C4) ^ C2;
|
||||
|
||||
const uint64_t B00 = A[ 0] ^ D1;
|
||||
const uint64_t B01 = rotl<44>(A[ 6] ^ D2);
|
||||
diff --git a/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp b/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp
|
||||
index c7f1914a3..a9650ad9d 100644
|
||||
--- a/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp
|
||||
+++ b/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp
|
||||
@@ -8,47 +8,23 @@
|
||||
#include <botan/sha3.h>
|
||||
#include <botan/rotate.h>
|
||||
|
||||
-#include <tuple>
|
||||
-
|
||||
namespace Botan {
|
||||
|
||||
namespace {
|
||||
|
||||
-// This is a workaround for a suspected bug in clang 12 (and XCode 13)
|
||||
-// that caused a miscompile of the SHA3 implementation for optimization
|
||||
-// level -O2 and higher.
|
||||
-//
|
||||
-// For details, see: https://github.com/randombit/botan/issues/2802
|
||||
-#if defined(__clang__) && \
|
||||
- (( defined(__apple_build_version__) && __clang_major__ == 13) || \
|
||||
- (!defined(__apple_build_version__) && __clang_major__ == 12))
|
||||
-#define BOTAN_WORKAROUND_MAYBE_INLINE __attribute__((noinline))
|
||||
-#else
|
||||
-#define BOTAN_WORKAROUND_MAYBE_INLINE inline
|
||||
-#endif
|
||||
-
|
||||
-BOTAN_WORKAROUND_MAYBE_INLINE std::tuple<uint64_t, uint64_t, uint64_t, uint64_t, uint64_t>
|
||||
- xor_CNs(const uint64_t A[25])
|
||||
- {
|
||||
- return {
|
||||
- A[0] ^ A[5] ^ A[10] ^ A[15] ^ A[20],
|
||||
- A[1] ^ A[6] ^ A[11] ^ A[16] ^ A[21],
|
||||
- A[2] ^ A[7] ^ A[12] ^ A[17] ^ A[22],
|
||||
- A[3] ^ A[8] ^ A[13] ^ A[18] ^ A[23],
|
||||
- A[4] ^ A[9] ^ A[14] ^ A[19] ^ A[24]};
|
||||
- }
|
||||
-
|
||||
-#undef BOTAN_WORKAROUND_MAYBE_INLINE
|
||||
-
|
||||
inline void SHA3_BMI2_round(uint64_t T[25], const uint64_t A[25], uint64_t RC)
|
||||
{
|
||||
- const auto Cs = xor_CNs(A);
|
||||
-
|
||||
- const uint64_t D0 = rotl<1>(std::get<0>(Cs)) ^ std::get<3>(Cs);
|
||||
- const uint64_t D1 = rotl<1>(std::get<1>(Cs)) ^ std::get<4>(Cs);
|
||||
- const uint64_t D2 = rotl<1>(std::get<2>(Cs)) ^ std::get<0>(Cs);
|
||||
- const uint64_t D3 = rotl<1>(std::get<3>(Cs)) ^ std::get<1>(Cs);
|
||||
- const uint64_t D4 = rotl<1>(std::get<4>(Cs)) ^ std::get<2>(Cs);
|
||||
+ const uint64_t C0 = A[0] ^ A[5] ^ A[10] ^ A[15] ^ A[20];
|
||||
+ const uint64_t C1 = A[1] ^ A[6] ^ A[11] ^ A[16] ^ A[21];
|
||||
+ const uint64_t C2 = A[2] ^ A[7] ^ A[12] ^ A[17] ^ A[22];
|
||||
+ const uint64_t C3 = A[3] ^ A[8] ^ A[13] ^ A[18] ^ A[23];
|
||||
+ const uint64_t C4 = A[4] ^ A[9] ^ A[14] ^ A[19] ^ A[24];
|
||||
+
|
||||
+ const uint64_t D0 = rotl<1>(C0) ^ C3;
|
||||
+ const uint64_t D1 = rotl<1>(C1) ^ C4;
|
||||
+ const uint64_t D2 = rotl<1>(C2) ^ C0;
|
||||
+ const uint64_t D3 = rotl<1>(C3) ^ C1;
|
||||
+ const uint64_t D4 = rotl<1>(C4) ^ C2;
|
||||
|
||||
const uint64_t B00 = A[ 0] ^ D1;
|
||||
const uint64_t B01 = rotl<44>(A[ 6] ^ D2);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
config BR2_PACKAGE_BOTAN_ARCH_SUPPORTS
|
||||
bool
|
||||
default y if BR2_aarch64 || BR2_aarch64_be
|
||||
default y if BR2_arm || BR2_armeb
|
||||
default y if BR2_i386 || BR2_x86_64
|
||||
default y if BR2_m68k
|
||||
default y if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
|
||||
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
|
||||
default y if BR2_riscv
|
||||
default y if BR2_sparc || BR2_sparc64
|
||||
default y if BR2_s390x
|
||||
default y if BR2_sh
|
||||
|
||||
config BR2_PACKAGE_BOTAN
|
||||
bool "botan"
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on BR2_PACKAGE_BOTAN_ARCH_SUPPORTS
|
||||
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::future
|
||||
select BR2_PACKAGE_BOOST_FILESYSTEM if BR2_PACKAGE_BOOST && BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
|
||||
select BR2_PACKAGE_BOOST_SYSTEM if BR2_PACKAGE_BOOST && BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
|
||||
select BR2_PACKAGE_LIBOPENSSL_ENABLE_RC4 if BR2_PACKAGE_LIBOPENSSL
|
||||
select BR2_PACKAGE_LIBOPENSSL_ENABLE_RMD160 if BR2_PACKAGE_LIBOPENSSL
|
||||
help
|
||||
Botan is a crypto library for C++
|
||||
|
||||
http://botan.randombit.net
|
||||
|
||||
comment "botan needs a toolchain w/ C++, threads, gcc >= 4.8"
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP \
|
||||
|| !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
|
||||
depends on BR2_PACKAGE_BOTAN_ARCH_SUPPORTS
|
||||
|
||||
comment "botan needs a toolchain not affected by GCC bug 64735"
|
||||
depends on BR2_PACKAGE_BOTAN_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
|
||||
@@ -0,0 +1,4 @@
|
||||
# From https://botan.randombit.net/releases/sha256sums.txt
|
||||
sha256 541a3b13f1b9d30f977c6c1ae4c7bfdfda763cda6e44de807369dce79f42307e Botan-2.18.2.tar.xz
|
||||
# Locally computed
|
||||
sha256 fb7f0322d36fba55ca17d77bc203a9f09a40daa8a249b75cf8887aba36cec9d0 license.txt
|
||||
@@ -0,0 +1,107 @@
|
||||
################################################################################
|
||||
#
|
||||
# botan
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BOTAN_VERSION = 2.18.2
|
||||
BOTAN_SOURCE = Botan-$(BOTAN_VERSION).tar.xz
|
||||
BOTAN_SITE = http://botan.randombit.net/releases
|
||||
BOTAN_LICENSE = BSD-2-Clause
|
||||
BOTAN_LICENSE_FILES = license.txt
|
||||
BOTAN_CPE_ID_VENDOR = botan_project
|
||||
|
||||
BOTAN_INSTALL_STAGING = YES
|
||||
|
||||
BOTAN_CONF_OPTS = \
|
||||
--cpu=$(BR2_ARCH) \
|
||||
--os=linux \
|
||||
--cc=gcc \
|
||||
--cc-bin="$(TARGET_CXX)" \
|
||||
--prefix=/usr \
|
||||
--without-documentation
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
|
||||
BOTAN_CONF_OPTS += --extra-libs=atomic
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_SHARED_LIBS),y)
|
||||
BOTAN_CONF_OPTS += \
|
||||
--disable-static-library \
|
||||
--enable-shared-library
|
||||
else ifeq ($(BR2_STATIC_LIBS),y)
|
||||
BOTAN_CONF_OPTS += \
|
||||
--disable-shared-library \
|
||||
--enable-static-library \
|
||||
--no-autoload
|
||||
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
|
||||
BOTAN_CONF_OPTS += \
|
||||
--enable-shared-library \
|
||||
--enable-static-library
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)
|
||||
BOTAN_CONF_OPTS += --with-stack-protector
|
||||
else
|
||||
BOTAN_CONF_OPTS += --without-stack-protector
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
|
||||
BOTAN_CONF_OPTS += --without-os-feature=getauxval
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BOOST_FILESYSTEM)$(BR2_PACKAGE_BOOST_SYSTEM),yy)
|
||||
BOTAN_DEPENDENCIES += boost
|
||||
BOTAN_CONF_OPTS += --with-boost
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BZIP2),y)
|
||||
BOTAN_DEPENDENCIES += bzip2
|
||||
BOTAN_CONF_OPTS += --with-bzip2
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
||||
BOTAN_DEPENDENCIES += openssl
|
||||
BOTAN_CONF_OPTS += --with-openssl
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_SQLITE),y)
|
||||
BOTAN_DEPENDENCIES += sqlite
|
||||
BOTAN_CONF_OPTS += --with-sqlite
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_XZ),y)
|
||||
BOTAN_DEPENDENCIES += xz
|
||||
BOTAN_CONF_OPTS += --with-lzma
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_ZLIB),y)
|
||||
BOTAN_DEPENDENCIES += zlib
|
||||
BOTAN_CONF_OPTS += --with-zlib
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
|
||||
BOTAN_CONF_OPTS += --disable-altivec
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_ARM_CPU_HAS_NEON),)
|
||||
BOTAN_CONF_OPTS += --disable-neon
|
||||
endif
|
||||
|
||||
define BOTAN_CONFIGURE_CMDS
|
||||
(cd $(@D); $(TARGET_MAKE_ENV) ./configure.py $(BOTAN_CONF_OPTS))
|
||||
endef
|
||||
|
||||
define BOTAN_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) AR="$(TARGET_AR)"
|
||||
endef
|
||||
|
||||
define BOTAN_INSTALL_STAGING_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" install
|
||||
endef
|
||||
|
||||
define BOTAN_INSTALL_TARGET_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" install
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user