From 241cf34620a00cb2ba2f726e7b39fc47a7b46b5c Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 11 Nov 2026 20:50:52 -0500 Subject: [PATCH] fix(sunshine): backport upstream OpenSSL and metainfo fixes --- pkgbuilds/sunshine/.SRCINFO | 8 +- ...233613-357bd98c-update-metainfo-urls.patch | 30 ++++++ ...914.233613-6005-openssl-crypto-tests.patch | 95 +++++++++++++++++++ ...ac66dfd-openssl-4.1-signature-length.patch | 20 ++++ pkgbuilds/sunshine/PKGBUILD | 27 +++++- 5 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 pkgbuilds/sunshine/2026.914.233613-357bd98c-update-metainfo-urls.patch create mode 100644 pkgbuilds/sunshine/2026.914.233613-6005-openssl-crypto-tests.patch create mode 100644 pkgbuilds/sunshine/2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch diff --git a/pkgbuilds/sunshine/.SRCINFO b/pkgbuilds/sunshine/.SRCINFO index 20c2999..3c265c4 100644 --- a/pkgbuilds/sunshine/.SRCINFO +++ b/pkgbuilds/sunshine/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = sunshine pkgdesc = Self-hosted game stream host for Moonlight pkgver = 2026.914.233613 - pkgrel = 1 + pkgrel = 2 url = https://app.lizardbyte.dev/Sunshine install = sunshine.install arch = x86_64 @@ -50,6 +50,12 @@ pkgbase = sunshine optdepends = cuda: Nvidia GPU encoding support optdepends = libva-mesa-driver: AMD GPU encoding support source = sunshine::git+https://github.com/LizardByte/Sunshine.git#commit=63d35f702ee9e362e43263742981836ec0710384 + source = 2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch + source = 2026.914.233613-6005-openssl-crypto-tests.patch + source = 2026.914.233613-357bd98c-update-metainfo-urls.patch sha256sums = SKIP + sha256sums = 0a31ccdf628f13fcdc30dac2283f565b3ab6df295b3c21c7a7514f2925549eb8 + sha256sums = b311d1aaab26503232bd3439ec2073cedb1d83db946ca1c8fe3e894a7729270d + sha256sums = 3208f0e7ec1a748e5f5e5a0994f62c5479aea6e94804983876313a0734efb98c pkgname = sunshine diff --git a/pkgbuilds/sunshine/2026.914.233613-357bd98c-update-metainfo-urls.patch b/pkgbuilds/sunshine/2026.914.233613-357bd98c-update-metainfo-urls.patch new file mode 100644 index 0000000..58de149 --- /dev/null +++ b/pkgbuilds/sunshine/2026.914.233613-357bd98c-update-metainfo-urls.patch @@ -0,0 +1,30 @@ +diff --git a/packaging/linux/dev.lizardbyte.app.Sunshine.metainfo.xml b/packaging/linux/dev.lizardbyte.app.Sunshine.metainfo.xml +--- a/packaging/linux/dev.lizardbyte.app.Sunshine.metainfo.xml ++++ b/packaging/linux/dev.lizardbyte.app.Sunshine.metainfo.xml +@@ -16,7 +16,7 @@ + + + @PROJECT_HOMEPAGE_URL@ +- https://github.com/LizardByte/Sunshine/issues ++ https://github.com/SunshineStream/Sunshine/issues + https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2troubleshooting.html + https://docs.lizardbyte.dev/projects/sunshine + https://app.lizardbyte.dev/#Donate +@@ -35,7 +35,7 @@ + + + +- https://github.com/LizardByte/Sunshine/releases/tag/v@PROJECT_VERSION@ ++ https://github.com/SunshineStream/Sunshine/releases/tag/v@PROJECT_VERSION@ + + See the changelog on GitHub + +@@ -47,7 +47,7 @@ + + + +- https://app.lizardbyte.dev/Sunshine/assets/img/screenshots/01-sunshine-welcome-page.png ++ https://sunshine.lizardbyte.dev/assets/sunshine-web-ui-light.jpg + Sunshine welcome page + + diff --git a/pkgbuilds/sunshine/2026.914.233613-6005-openssl-crypto-tests.patch b/pkgbuilds/sunshine/2026.914.233613-6005-openssl-crypto-tests.patch new file mode 100644 index 0000000..bab78e9 --- /dev/null +++ b/pkgbuilds/sunshine/2026.914.233613-6005-openssl-crypto-tests.patch @@ -0,0 +1,95 @@ +diff --git a/src/crypto.h b/src/crypto.h +--- a/src/crypto.h ++++ b/src/crypto.h +@@ -150,10 +150,10 @@ + creds_t gen_creds(const std::string_view &cn, std::uint32_t key_bits); + + /** +- * @brief Return the certificate signature bytes. +- * +- * @param x Certificate object or PEM text, depending on the overload. +- * @return Parsed or generated OpenSSL object or PEM data. ++ * @brief Return the certificate signature bytes using the available OpenSSL length API. ++ * ++ * @param x Certificate containing the signature. ++ * @return A view of the binary signature owned by the certificate. + */ + std::string_view signature(const x509_t &x); + +diff --git a/tests/unit/test_crypto.cpp b/tests/unit/test_crypto.cpp +--- a/tests/unit/test_crypto.cpp ++++ b/tests/unit/test_crypto.cpp +@@ -4,6 +4,10 @@ + */ + // test includes + #include "../tests_common.h" ++ ++// standard includes ++#include ++#include + + // lib includes + #include +@@ -31,16 +35,21 @@ + + const auto common_name_index = X509_NAME_get_index_by_NID(subject, NID_commonName, -1); + ASSERT_GE(common_name_index, 0); +- + const auto common_name_entry = X509_NAME_get_entry(subject, common_name_index); + ASSERT_NE(common_name_entry, nullptr); +- + const auto common_name_data = X509_NAME_ENTRY_get_data(common_name_entry); + ASSERT_NE(common_name_data, nullptr); + ++ unsigned char *common_name_utf8 = nullptr; ++ const auto free_common_name = util::fail_guard([&common_name_utf8] { ++ OPENSSL_free(common_name_utf8); ++ }); ++ const auto common_name_length = ASN1_STRING_to_UTF8(&common_name_utf8, common_name_data); ++ ASSERT_GE(common_name_length, 0); ++ ASSERT_NE(common_name_utf8, nullptr); + const std::string_view parsed_common_name { +- reinterpret_cast(ASN1_STRING_get0_data(common_name_data)), +- static_cast(ASN1_STRING_length(common_name_data)) ++ reinterpret_cast(common_name_utf8), ++ static_cast(common_name_length) + }; + ASSERT_EQ(parsed_common_name, common_name); + +@@ -49,6 +58,36 @@ + const auto signature = crypto::sign256(pkey, payload); + ASSERT_FALSE(signature.empty()); + ASSERT_TRUE(crypto::verify256(cert, payload, {reinterpret_cast(signature.data()), signature.size()})); ++} ++ ++TEST(CryptoTest, CertificateSignaturePreservesBinaryBytes) { ++ constexpr std::uint32_t key_bits = 2048; ++ const auto creds = crypto::gen_creds("Sunshine Signature Test", key_bits); ++ const auto cert = crypto::x509(creds.x509); ++ ASSERT_NE(cert.get(), nullptr); ++ ++ const auto der_size = i2d_X509(cert.get(), nullptr); ++ ASSERT_GT(der_size, 0); ++ std::vector der(static_cast(der_size)); ++ auto *write_cursor = der.data(); ++ ASSERT_EQ(i2d_X509(cert.get(), &write_cursor), der_size); ++ ++ // The final DER field contains the RSA signature. Include every byte value, ++ // including embedded NULs, to verify that extraction preserves binary data. ++ constexpr std::size_t signature_size = key_bits / 8; ++ ASSERT_GT(der.size(), signature_size); ++ for (std::size_t i = 0; i < signature_size; ++i) { ++ der[der.size() - signature_size + i] = static_cast(i); ++ } ++ ++ const auto *read_cursor = der.data(); ++ const crypto::x509_t binary_cert {d2i_X509(nullptr, &read_cursor, der_size)}; ++ ASSERT_NE(binary_cert.get(), nullptr); ++ const std::string_view expected_signature { ++ reinterpret_cast(der.data() + der.size() - signature_size), ++ signature_size ++ }; ++ EXPECT_EQ(crypto::signature(binary_cert), expected_signature); + } + + TEST(CryptoTest, CertificateChainRequiresExactPairedIdentity) { diff --git a/pkgbuilds/sunshine/2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch b/pkgbuilds/sunshine/2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch new file mode 100644 index 0000000..1a585ee --- /dev/null +++ b/pkgbuilds/sunshine/2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch @@ -0,0 +1,20 @@ +diff --git a/src/crypto.cpp b/src/crypto.cpp +--- a/src/crypto.cpp ++++ b/src/crypto.cpp +@@ -412,9 +412,15 @@ + const ASN1_BIT_STRING *asn1 = nullptr; + X509_get0_signature(&asn1, nullptr, x.get()); + ++#if OPENSSL_VERSION_NUMBER >= 0x40100000L ++ const auto length = ASN1_STRING_get_length(asn1); ++#else ++ const auto length = static_cast(ASN1_STRING_length(asn1)); ++#endif ++ + return { + reinterpret_cast(ASN1_STRING_get0_data(asn1)), +- static_cast(ASN1_STRING_length(asn1)) ++ length + }; + } + diff --git a/pkgbuilds/sunshine/PKGBUILD b/pkgbuilds/sunshine/PKGBUILD index 501e7be..2c5209d 100644 --- a/pkgbuilds/sunshine/PKGBUILD +++ b/pkgbuilds/sunshine/PKGBUILD @@ -10,7 +10,7 @@ pkgname='sunshine' pkgver=2026.914.233613 -pkgrel=1 +pkgrel=2 pkgdesc="Self-hosted game stream host for Moonlight" arch=('x86_64' 'aarch64') url=https://app.lizardbyte.dev/Sunshine @@ -84,8 +84,18 @@ optdepends=( provides=() conflicts=() -source=("$pkgname::git+https://github.com/LizardByte/Sunshine.git#commit=${_commit}") -sha256sums=('SKIP') +source=( + "$pkgname::git+https://github.com/LizardByte/Sunshine.git#commit=${_commit}" + '2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch' + '2026.914.233613-6005-openssl-crypto-tests.patch' + '2026.914.233613-357bd98c-update-metainfo-urls.patch' +) +sha256sums=( + 'SKIP' + '0a31ccdf628f13fcdc30dac2283f565b3ab6df295b3c21c7a7514f2925549eb8' + 'b311d1aaab26503232bd3439ec2073cedb1d83db946ca1c8fe3e894a7729270d' + '3208f0e7ec1a748e5f5e5a0994f62c5479aea6e94804983876313a0734efb98c' +) # Options Handling if [[ "${_use_cuda::1}" == "d" ]] && pacman -Qi cuda &> /dev/null; then @@ -120,6 +130,17 @@ fi prepare() { cd "$pkgname" git submodule update --recursive --init --depth 1 + + # Backport https://github.com/SunshineStream/Sunshine/commit/dac66dfdd200c5f1bb4b31b4e34227690ca8c565 + patch -Np1 -i "${srcdir}/2026.914.233613-dac66dfd-openssl-4.1-signature-length.patch" + + # Backport the regression test and supported subject-name API from: + # https://github.com/SunshineStream/Sunshine/pull/6005 + patch -Np1 -i "${srcdir}/2026.914.233613-6005-openssl-crypto-tests.patch" + + # Backport the metainfo changes from: + # https://github.com/SunshineStream/Sunshine/commit/357bd98cb1e203dbacbd831dbc6ddfac76d22ac0 + patch -Np1 -i "${srcdir}/2026.914.233613-357bd98c-update-metainfo-urls.patch" } build() {
See the changelog on GitHub