From patchwork Fri Jan 27 17:31:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 2337 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp349453vsb; Fri, 27 Jan 2017 09:32:46 -0800 (PST) X-Received: by 10.28.173.140 with SMTP id w134mr3895157wme.56.1485538366064; Fri, 27 Jan 2017 09:32:46 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s20si6668698wra.230.2017.01.27.09.32.45; Fri, 27 Jan 2017 09:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@blackhole.sk; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 39C2568A8F7; Fri, 27 Jan 2017 19:32:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-proxyout-31.websupport.sk (mail-proxyout-mua-31.websupport.sk [37.9.172.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B753368A7BB for ; Fri, 27 Jan 2017 19:32:34 +0200 (EET) Received: from mail-proxyout-31.websupport.sk (localhost [127.0.0.1]) by mua-smtp-cf.websupport.sk (Postfix) with ESMTP id 10F8FBDF99 for ; Fri, 27 Jan 2017 18:32:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackhole.sk; s=mail; t=1485538355; bh=30/2JoD0+98Rwr5mciYUu+9YPqMI7HP2lHlgrVy9CDw=; h=From:To:Cc:Subject:Date; b=n379hDj0T4PQQQKBrNvoQg2GqPGNK4f2Qty8Gn8J+Gx4sVaT5+SkAAUniAqir92b9 FgvTwkmTZmPEt+LO8QrPZGORQdmUjVDJosVbqh+6wHmJ7qNIcDZYWk8U6oBe7X30Es Qsz0hY8xHpafMW/Bho9CFaqZ27UHwgmgfk31r2VY= Received: from lb-proxy-24.websupport.sk (unknown [10.10.1.24]) by mail-proxyout-31.websupport.sk (Postfix) with ESMTP id 0391FBDF8F for ; Fri, 27 Jan 2017 18:32:35 +0100 (CET) Received: from lb-proxy-24 (localhost [127.0.0.1]) by smtp-cf.websupport.sk (Postfix) with ESMTP id 3v95TG6hn7z5qCk; Fri, 27 Jan 2017 18:32:34 +0100 (CET) Received: from localhost.localdomain (otava-0452.koleje.cuni.cz [78.128.181.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kabel@blackhole.sk) by lb-proxy-24.websupport.sk (Postfix) with ESMTPSA; Fri, 27 Jan 2017 18:32:34 +0100 (CET) From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Jan 2017 18:31:58 +0100 Message-Id: <20170127173158.2023-1-kabel@blackhole.sk> X-Mailer: git-send-email 2.10.2 X-ESET-AntiSpam: OK;2;calc;2017-01-27 18:32:34;1701271832340434;B182: X-Spam-Status: No, score=-1.0 required=100.0 tests=ALL_TRUSTED autolearn=disabled version=3.4.1: X-Virus-Scanned: ClamAV using ClamSMTP Subject: [FFmpeg-devel] [PATCH] lavf/tls_openssl: Support building with LibreSSL 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 Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Use the LIBRESSL_VERSION_NUMBER macro to determine if building with LibreSSL instead of OpenSSL. This is pretty straightforward, since it is enough to add this check to existing #if macros. Signed-off-by: Marek Behun --- libavformat/tls_openssl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 3d9768a..cf1a62e 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -43,7 +43,7 @@ typedef struct TLSContext { TLSShared tls_shared; SSL_CTX *ctx; SSL *ssl; -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER) BIO_METHOD* url_bio_method; #endif } TLSContext; @@ -68,7 +68,7 @@ static unsigned long openssl_thread_id(void) static int url_bio_create(BIO *b) { -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER) BIO_set_init(b, 1); BIO_set_data(b, NULL); BIO_set_flags(b, 0); @@ -85,7 +85,7 @@ static int url_bio_destroy(BIO *b) return 1; } -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER) #define GET_BIO_DATA(x) BIO_get_data(x); #else #define GET_BIO_DATA(x) (x)->ptr; @@ -133,7 +133,7 @@ static int url_bio_bputs(BIO *b, const char *str) return url_bio_bwrite(b, str, strlen(str)); } -#if OPENSSL_VERSION_NUMBER < 0x1010000fL +#if OPENSSL_VERSION_NUMBER < 0x1010000fL || defined(LIBRESSL_VERSION_NUMBER) static BIO_METHOD url_bio_method = { .type = BIO_TYPE_SOURCE_SINK, .name = "urlprotocol bio", @@ -212,7 +212,7 @@ static int tls_close(URLContext *h) SSL_CTX_free(c->ctx); if (c->tls_shared.tcp) ffurl_close(c->tls_shared.tcp); -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER) if (c->url_bio_method) BIO_meth_free(c->url_bio_method); #endif @@ -270,7 +270,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op ret = AVERROR(EIO); goto fail; } -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL && !defined(LIBRESSL_VERSION_NUMBER) p->url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "urlprotocol bio"); BIO_meth_set_write(p->url_bio_method, url_bio_bwrite); BIO_meth_set_read(p->url_bio_method, url_bio_bread);