From patchwork Tue Jun 11 14:16:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 13503 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4FD064475A7 for ; Tue, 11 Jun 2019 17:23:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 37E366809F2; Tue, 11 Jun 2019 17:23:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86D2B680459 for ; Tue, 11 Jun 2019 17:23:38 +0300 (EEST) Received: by mail-io1-f68.google.com with SMTP id r185so10022914iod.6 for ; Tue, 11 Jun 2019 07:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fGN1+CxX5Of2V44Os5tIRxIc9wIhM5V4y3Zjr2hZQd4=; b=u7MFmCYa2zw6x63CapHNBLuTNpXdOriISFQYPziL70Z/g+2TDh1QsjjOTzrMgv2kPC xJBsznuNQI81V5n3yv7TNnYOn0q1/ZngM7DrAoc0XdVVuuUdU9ogXtOl7ugFa3PvOx0k ia7wDTXekq2onoroDWtVXRfbFGHtlFQI2YOfLprwck2J0kZV44qhL0gXqHKm2eLnMRKz cTlhexoxycA8kzz4C9UUtlZkTxbGT6u1yrkMVXA8un+U0CAdvdmd6R7lHki1XHYsR8AW oiF9QwHQL/MmdrYXbpwPWf7q+bjuK075m1kg7q9az4+nAj9JPwlXSVN10/eJ6HMsNnrl 60jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fGN1+CxX5Of2V44Os5tIRxIc9wIhM5V4y3Zjr2hZQd4=; b=G8m9BhzgEaFrkl3YHneWmB6OBesAjP73W/Rkbw+BHS7HZiZGqX8dOf4G84raGLeOAu izgBhiaGuRDymFLNxErzh7z9mSkVwAkTKIv6xhtjorQqkxVPAP9aGdQy66cgv1OrspGq wycUf31hWR7Z3JfJU9SC8Q+agVhTCmpr5ZpMrmKOqSOXytJKjNlM4aRTwgwvPIxnla61 l7mzKXkCf0vgWzg0jM5l7d2bXxTqXi1LbpW4Dc43qLYT8pNR5FhbDfqE7Qpz5nwCPFtB bDet75ydGEpeknw8IlkWymvu/iXlun2la3OW0jrn0eNCupogP1zzVgNfcWxwW+JTZFQQ bInw== X-Gm-Message-State: APjAAAV7E9XiAxj1HWBQ2H2D35V0ZPIB7EedxcorLCxVMA3OfRos1CHg JJ3QpOOSOHNWwjylBf6LEZISojQ25Ds= X-Google-Smtp-Source: APXvYqyl5LEtA/QmzlV64xv0LQSX3DG3FIR8RUKby19lonAaiJ67VWl+19+qbHYGU4M4Vf5i97T+Mw== X-Received: by 2002:a05:6602:2104:: with SMTP id x4mr12197994iox.260.1560262595752; Tue, 11 Jun 2019 07:16:35 -0700 (PDT) Received: from Rodgers-MBP.localdomain ([71.201.155.37]) by smtp.gmail.com with ESMTPSA id w23sm5005046ioa.51.2019.06.11.07.16.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Jun 2019 07:16:34 -0700 (PDT) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jun 2019 09:16:21 -0500 Message-Id: <20190611141623.59440-4-rodger.combs@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190611141623.59440-1-rodger.combs@gmail.com> References: <20190611141623.59440-1-rodger.combs@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] lavf/tls_apple: link to SecIdentityCreate weakly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is a private API, so it might go away in a future macOS version. Linking to it weakly means that if it does, we won't crash during symbol lookup. --- libavformat/tls_apple.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/tls_apple.c b/libavformat/tls_apple.c index 37d63f3b27..23042eb8ee 100644 --- a/libavformat/tls_apple.c +++ b/libavformat/tls_apple.c @@ -38,7 +38,7 @@ #include // We use a private API call here; it's good enough for WebKit. -SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey); +SecIdentityRef __attribute__((weak)) SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey); #define ioErr -36 typedef struct TLSContext { @@ -165,6 +165,11 @@ static int load_identity(URLContext *h, SecIdentityRef *identity, CFArrayRef *ce if ((ret = import_pem(h, c->tls_shared.key_file, &keyArray)) < 0) goto end; + if (!SecIdentityCreate) { + ret = AVERROR_PATCHWELCOME; + goto end; + } + if (CFGetTypeID(CFArrayGetValueAtIndex(*certArray, 0)) != SecCertificateGetTypeID() || CFGetTypeID(CFArrayGetValueAtIndex(keyArray, 0)) != SecKeyGetTypeID()) { ret = AVERROR_INVALIDDATA;