From f9c2e3c7f0425642e35c56cfebe8166ca54a0656 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Tue, 26 Mar 2024 23:11:26 +0100 Subject: [PATCH] TEMP --- ...peg-linux-fix-asm-binutil-since-2.41.patch | 58 +++++++++++++++++++ depends/common/ffmpeg/CMakeLists.txt | 4 +- ...2-hack-fix-about-rsa_compute_root_tr.patch | 55 ++++++++++++++++++ 3 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 depends/common/ffmpeg/0004-ffmpeg-linux-fix-asm-binutil-since-2.41.patch create mode 100644 depends/common/gnutls/0002-hack-fix-about-rsa_compute_root_tr.patch diff --git a/depends/common/ffmpeg/0004-ffmpeg-linux-fix-asm-binutil-since-2.41.patch b/depends/common/ffmpeg/0004-ffmpeg-linux-fix-asm-binutil-since-2.41.patch new file mode 100644 index 00000000..a95fdd8f --- /dev/null +++ b/depends/common/ffmpeg/0004-ffmpeg-linux-fix-asm-binutil-since-2.41.patch @@ -0,0 +1,58 @@ +--- a/libavcodec/x86/mathops.h ++++ b/libavcodec/x86/mathops.h +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ __asm__ volatile(\ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + \ No newline at end of file diff --git a/depends/common/ffmpeg/CMakeLists.txt b/depends/common/ffmpeg/CMakeLists.txt index 84c21011..4949ffce 100644 --- a/depends/common/ffmpeg/CMakeLists.txt +++ b/depends/common/ffmpeg/CMakeLists.txt @@ -137,14 +137,14 @@ if(NOT WIN32) --enable-gnutls --enable-libzvbi ${STANDARD_CONF} - ${EXTRA_CONF} || + ${EXTRA_CONF})#[===[ || cmake -E echo "=========================================================" && cmake -E echo "FFMPEG configure error" && cmake -E echo "The associated config.log is output for troubleshooting." && cmake -E echo "--------------------------------- FFMPEG CONFIG LOG START" && cat ${CMAKE_BINARY_DIR}/ffmpeg-prefix/src/ffmpeg-build/ffbuild/config.log && cmake -E echo "----------------------------------- FFMPEG CONFIG LOG END" && - exit 1) + exit 1)]===] if(CORE_SYSTEM_NAME STREQUAL darwin_embedded) externalproject_add_step(ffmpeg diff --git a/depends/common/gnutls/0002-hack-fix-about-rsa_compute_root_tr.patch b/depends/common/gnutls/0002-hack-fix-about-rsa_compute_root_tr.patch new file mode 100644 index 00000000..ab5efa1d --- /dev/null +++ b/depends/common/gnutls/0002-hack-fix-about-rsa_compute_root_tr.patch @@ -0,0 +1,55 @@ +From a333f0d2dde8cfc6d784351be4ec062f12a21dd8 Mon Sep 17 00:00:00 2001 +From: Alwin Esch +Date: Tue, 26 Mar 2024 22:52:39 +0100 +Subject: [PATCH] hack-fix-about-rsa_compute_root_tr + +--- + lib/nettle/backport/rsa-sign-tr.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/lib/nettle/backport/rsa-sign-tr.c b/lib/nettle/backport/rsa-sign-tr.c +index 83a5d52..6b22dc4 100644 +--- a/lib/nettle/backport/rsa-sign-tr.c ++++ b/lib/nettle/backport/rsa-sign-tr.c +@@ -88,10 +88,10 @@ rsa_unblind (const struct rsa_public_key *pub, + * attacks which rely on faults on hardware, or even software MPI + * implementation. */ + int +-rsa_compute_root_tr(const struct rsa_public_key *pub, +- const struct rsa_private_key *key, +- void *random_ctx, nettle_random_func *random, +- mpz_t x, const mpz_t m) ++backport_rsa_compute_root_tr(const struct rsa_public_key *pub, ++ const struct rsa_private_key *key, ++ void *random_ctx, nettle_random_func *random, ++ mpz_t x, const mpz_t m) + { + int res; + mpz_t t, mb, xb, ri; +@@ -142,7 +142,7 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub, + + nn = mpz_size (pub->n); + +- res = rsa_compute_root_tr(pub, key, random_ctx, random, xz, ++ res = backport_rsa_compute_root_tr(pub, key, random_ctx, random, xz, + mpz_roinit_n(mz, m, nn)); + + if (res) +@@ -347,10 +347,10 @@ _rsa_sec_compute_root_tr(const struct rsa_public_key *pub, + * in buffer copying both in case of success or error. + */ + int +-rsa_compute_root_tr(const struct rsa_public_key *pub, +- const struct rsa_private_key *key, +- void *random_ctx, nettle_random_func *random, +- mpz_t x, const mpz_t m) ++backport_rsa_compute_root_tr(const struct rsa_public_key *pub, ++ const struct rsa_private_key *key, ++ void *random_ctx, nettle_random_func *random, ++ mpz_t x, const mpz_t m) + { + TMP_GMP_DECL (l, mp_limb_t); + mp_size_t nn = mpz_size(pub->n); +-- +2.40.1 +