From patchwork Mon Aug 28 13:31:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 53265 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 99A9A27BBE9; Mon, 28 Aug 2023 14:33:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 14ADE27BBE2 for ; Mon, 28 Aug 2023 14:33:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qacMk-0001c1-Cx; Mon, 28 Aug 2023 09:33:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qacMS-0001Yd-7X for guix-patches@gnu.org; Mon, 28 Aug 2023 09:32:56 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qacMR-0007sj-VX for guix-patches@gnu.org; Mon, 28 Aug 2023 09:32:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qacMY-0005Od-Av for guix-patches@gnu.org; Mon, 28 Aug 2023 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64748] [PATCH v6 2/2] gnu: webrtc-for-telegram-desktop: Update to 0-389.0532942. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Aug 2023 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64748 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64748@debbugs.gnu.org Cc: Distopico Received: via spool by 64748-submit@debbugs.gnu.org id=B64748.169322955220695 (code B ref 64748); Mon, 28 Aug 2023 13:33:02 +0000 Received: (at 64748) by debbugs.gnu.org; 28 Aug 2023 13:32:32 +0000 Received: from localhost ([127.0.0.1]:47414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qacM3-0005Nh-PJ for submit@debbugs.gnu.org; Mon, 28 Aug 2023 09:32:32 -0400 Received: from mail.boiledscript.com ([144.168.59.46]:48608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qacM1-0005NY-6P for 64748@debbugs.gnu.org; Mon, 28 Aug 2023 09:32:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1693229500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vqdiwPTVfhRFq798Q+61qa5O5wsvbdEKSvol68edZJM=; b=j/2uUuPoOSpwvoxEJuZ4/pFma0xwvH5HSAFcTMylolm/pXnIv3laDLvJTEV14yS/6uU7mD Vv3xDDLmq+lQaMSfk95vhqHiYaAW36mF46zMipvzmaBLJiAWUnGdlylRWgGcYMQs1X6pGT SK689k/0jV0NYPfV+sg6nibPw+8tKwNuvCdoHIvb9BcuXmIuaRj5kUXQxAdYVLg9BOBde4 a2n+2wVaZWCsfQJx2V0XCo6WU88gzP+/tkfLhNp4kZGba481bjfL/Ux7F+MEqLYsUhtI+a VuOXDPsRWxqxbKdb3I5jSFJEjfg2ysvFq5bwjTUxnD8iHS4z5KCu99zIRgAWsQ== Authentication-Results: mail.boiledscript.com; auth=pass smtp.mailfrom=hako@ultrarare.space Date: Mon, 28 Aug 2023 21:31:29 +0800 Message-ID: <6bc3e221df4078fb77503f2106017c0c09528d40.1693229275.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Distopico * gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/telegram.scm (webrtc-for-telegram-desktop): Update to 0-389.0532942, which fixes `telegram-desktop` calls that are not working with OpenSSL 3. [source]: Add the patch. : Unbundle libsrtp. Keep libsrtp_config. [inputs]: Add libsrtp. --- gnu/local.mk | 1 + ...or-telegram-desktop-unbundle-libsrtp.patch | 137 ++++++++++++++++++ gnu/packages/telegram.scm | 16 +- 3 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch diff --git a/gnu/local.mk b/gnu/local.mk index 8f409b7ea8..684f9f3ec4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2094,6 +2094,7 @@ dist_patch_DATA = \ %D%/packages/patches/wdl-link-libs-and-fix-jnetlib.patch \ %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch \ %D%/packages/patches/webrtc-audio-processing-big-endian.patch \ + %D%/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch \ %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch \ %D%/packages/patches/wmctrl-64-fix.patch \ %D%/packages/patches/wmfire-update-for-new-gdk-versions.patch \ diff --git a/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch b/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch new file mode 100644 index 0000000000..486f0b1aa5 --- /dev/null +++ b/gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch @@ -0,0 +1,137 @@ +From 62672f3756ecf218252098211d78c13369ab6d28 Mon Sep 17 00:00:00 2001 +From: Nicholas Guriev +Date: Thu, 4 May 2023 16:21:09 +0300 +Subject: [PATCH] Unbundle libSRTP + +Avoid private symbols and link against system-wide libSRTP. The excluded code +in SrtpSession looks unreachable from the call integration in Telegram Desktop. +--- + CMakeLists.txt | 3 +++ + cmake/libsrtp.cmake | 13 +++++++++++++ + src/pc/external_hmac.cc | 1 - + src/pc/external_hmac.h | 9 ++++++--- + src/pc/srtp_session.cc | 16 ++++++++++++++-- + 5 files changed, 36 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index af7d24c21..66bec8fdf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2647,6 +2647,9 @@ if (TG_OWT_USE_PROTOBUF) + list(APPEND export_targets proto) + endif() + ++if (LIBSRTP_FOUND) ++ target_compile_definitions(tg_owt PRIVATE HAVE_LIBSRTP) ++endif() + if (NOT absl_FOUND) + list(APPEND export_targets libabsl) + endif() +diff --git a/cmake/libsrtp.cmake b/cmake/libsrtp.cmake +index 5124312d2..01f051606 100644 +--- a/cmake/libsrtp.cmake ++++ b/cmake/libsrtp.cmake +@@ -1,3 +1,16 @@ ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(LIBSRTP libsrtp2) ++ ++if (LIBSRTP_FOUND) ++ add_library(libsrtp INTERFACE EXCLUDE_FROM_ALL) ++ add_library(tg_owt::libsrtp ALIAS libsrtp) ++ ++ target_include_directories(libsrtp INTERFACE ${LIBSRTP_INCLUDE_DIRS} ${LIBSRTP_CFLAGS_OTHER}) ++ target_link_libraries(libsrtp INTERFACE ${LIBSRTP_LINK_LIBRARIES} ${LIBSRTP_LDFLAGS_OTHER}) ++ ++ return() ++endif() ++ + add_library(libsrtp OBJECT EXCLUDE_FROM_ALL) + init_target(libsrtp) + add_library(tg_owt::libsrtp ALIAS libsrtp) +diff --git a/src/pc/external_hmac.cc b/src/pc/external_hmac.cc +index 27b5d0e5a..222f5d9ae 100644 +--- a/src/pc/external_hmac.cc ++++ b/src/pc/external_hmac.cc +@@ -15,7 +15,6 @@ + + #include "rtc_base/logging.h" + #include "rtc_base/zero_memory.h" +-#include "third_party/libsrtp/include/srtp.h" + + // Begin test case 0 */ + static const uint8_t kExternalHmacTestCase0Key[20] = { +diff --git a/src/pc/external_hmac.h b/src/pc/external_hmac.h +index c5071fc19..8fdc2f1a7 100644 +--- a/src/pc/external_hmac.h ++++ b/src/pc/external_hmac.h +@@ -30,9 +30,12 @@ + + #include + +-#include "third_party/libsrtp/crypto/include/crypto_types.h" +-#include "third_party/libsrtp/include/srtp.h" +-#include "third_party/libsrtp/include/srtp_priv.h" ++#ifdef HAVE_LIBSRTP ++# include ++# include ++#else ++# include "srtp_priv.h" ++#endif + + #define EXTERNAL_HMAC_SHA1 SRTP_HMAC_SHA1 + 1 + #define HMAC_KEY_LENGTH 20 +diff --git a/src/pc/srtp_session.cc b/src/pc/srtp_session.cc +index 7d1aaf2d6..7b5a789b0 100644 +--- a/src/pc/srtp_session.cc ++++ b/src/pc/srtp_session.cc +@@ -30,8 +30,12 @@ + #include "rtc_base/thread_annotations.h" + #include "rtc_base/time_utils.h" + #include "system_wrappers/include/metrics.h" +-#include "third_party/libsrtp/include/srtp.h" +-#include "third_party/libsrtp/include/srtp_priv.h" ++ ++#ifdef HAVE_LIBSRTP ++# include ++#else ++# include "srtp_priv.h" ++#endif + + namespace cricket { + +@@ -290,6 +294,9 @@ bool SrtpSession::UnprotectRtcp(void* p, int in_len, int* out_len) { + bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) { + RTC_DCHECK(thread_checker_.IsCurrent()); + RTC_DCHECK(IsExternalAuthActive()); ++#ifdef HAVE_LIBSRTP ++ return false; ++#else + if (!IsExternalAuthActive()) { + return false; + } +@@ -313,6 +320,7 @@ bool SrtpSession::GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len) { + *key_len = external_hmac->key_length; + *tag_len = rtp_auth_tag_len_; + return true; ++#endif + } + + int SrtpSession::GetSrtpOverhead() const { +@@ -336,6 +344,9 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p, + int in_len, + int64_t* index) { + RTC_DCHECK(thread_checker_.IsCurrent()); ++#ifdef HAVE_LIBSRTP ++ return false; ++#else + srtp_hdr_t* hdr = reinterpret_cast(p); + srtp_stream_ctx_t* stream = srtp_get_stream(session_, hdr->ssrc); + if (!stream) { +@@ -346,6 +357,7 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p, + *index = static_cast(rtc::NetworkToHost64( + srtp_rdbx_get_packet_index(&stream->rtp_rdbx) << 16)); + return true; ++#endif + } + + bool SrtpSession::DoSetKey(int type, diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm index 88daea7d7d..a3d5dc273a 100644 --- a/gnu/packages/telegram.scm +++ b/gnu/packages/telegram.scm @@ -1,8 +1,9 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Raghav Gururajan -;;; Copyright © 2022 Hilton Chain +;;; Copyright © 2022, 2023 Hilton Chain ;;; Copyright © 2023 Saku Laesvuori ;;; Copyright © 2023 Lu Hui +;;; Copyright © 2023 Camilo Q.S. (Distopico) ;;; ;;; This file is part of GNU Guix. ;;; @@ -266,8 +267,8 @@ (define tgcalls-for-telegram-desktop "193m2gkvipijqbfd6a8mhg9nd63wlnshzgspk3pip57vk21l709z")))) (define-public webrtc-for-telegram-desktop - (let ((commit "5098730b9eb6173f0b52068fe2555b7c1015123a") - (revision "328")) + (let ((commit "0532942ac6176a66ef184fb728a4cbb02958fc0b") + (revision "389")) (hidden-package (package (name "webrtc-for-telegram-desktop") @@ -283,14 +284,18 @@ (define-public webrtc-for-telegram-desktop (file-name (git-file-name name version)) (sha256 - (base32 "1lk54zlrff59rj5k9dylsgz4sdds4728psrk8m3v9qn5y8d6z8qy")) + (base32 "0fary99yl1ddk5zjpfy0pyb5brd268j41plcnvv9qjyf0wj9hf2k")) + (patches + (search-patches + ;; https://github.com/desktop-app/tg_owt/pull/123 + "webrtc-for-telegram-desktop-unbundle-libsrtp.patch")) (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1))) (snippet #~(begin (let ((keep - '("libsrtp" "rnnoise" + '("libsrtp_config" "rnnoise" ;; Not available in Guix. "pffft"))) (with-directory-excursion "src/third_party" @@ -325,6 +330,7 @@ (define-public webrtc-for-telegram-desktop libdrm libglvnd libjpeg-turbo + libsrtp libvpx libxcomposite libxdamage