From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 95A0150285 for ; Thu, 10 Jul 2025 10:56:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D202268FB77; Thu, 10 Jul 2025 13:56:00 +0300 (EEST) Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id AB34968FA9B for ; Thu, 10 Jul 2025 13:55:54 +0300 (EEST) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-ae0c4945c76so125055866b.3 for ; Thu, 10 Jul 2025 03:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752144954; x=1752749754; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tWCHwMlG5jfWxGIljoSH2Hy4odqorOd8hyNhicVK2mw=; b=C5nZHbxH4KxyRn0iCD7b3P+Hf+Odph1aKjp3NY7p/Xlx8Q8zyWH+i6Pk9uhfjokoBQ aHefdJD5b8JSckP1wvWpk+ajK/T/zHT47END1QJ6Q28Km+9fgGlMA5HIq5hdHhwz9Dzi UfJ96iocX/LUAiECj5576bKMuWnUWouXDTHFETIHqmmD1xnHbFZBs+RQwPwDGb9abG5b qCyjR2qIvcqY29Otd9je7KGAIapEmJE2FkHb1kyKvIC9MWUJf4yAUdXLz8DM9OClnxXW w1Soroz4G3N3Qa4cKZIzLZKHmVWok+wFaewKfkzQ5WBDJ2kKDPYfGzjVPeLshpJVCDdN COMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752144954; x=1752749754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tWCHwMlG5jfWxGIljoSH2Hy4odqorOd8hyNhicVK2mw=; b=Z+oxGyd8ESKSRLDKiGIVzkr05aiYYoEuB6PDfHZazaQvQnh0wnVoOyjk4SfRStg8Q+ XksfXITHp0Nl361cNlPZO85Sj6A8N5hqjqEom53T26+2u91ThQQlOcRC5aWJHsorHX3U ZFO9wfdVXfXnvT/sK9O58Bl1gKz/eKODtf/RpXoDkmw/AhWyhlKgHSt24PxNtEDrqxxH nrRMAm7SAJVQxvKB/AqAEPdxacTi7t0wwMaSG6gilzENIoiXi6t1RiLruZgSDgPMUVfE GoyzcpRBVpoCOdNyXO/PnJtz4L1pqYs0yyBQ2OC1yr1BTo0Dh4UhH1wNGpDfBB6FjoAV 6AiA== X-Gm-Message-State: AOJu0YzUy3X+pVm8YNJvJGGFG3+Uqv6vQ5QriUKOW7iM3sKKMntl9nu0 FEgz2y956dSwgtx23cQtGFAC9ZD2e8+tNd1yMLTjo9Ah1JHNesFNIu4MqDAa9g== X-Gm-Gg: ASbGnctbVbcSSydlbLbbB8P2SNddruxDo+RzQy2fX4ms0P3FpIGobPkA1TCitNZoXGX ygfRKKzA//pkktWavDSC4TestLMTahaZ20APLKmiA56lG6Y+DExOfuuyQyjXtWLnVxPKNEKsLgD MBAGXGeIM6XG3OKaLamRAQowQ6hu0hMO04+424e44fm7EZQXatT80aqJAqrYfBPNhcjMWgN3Z50 veWcJpgZhVbMtU65UEeKVQDn7CJGEH8l1y/AsVEzDpeq0LqhMHeIR/HZJN7p187jmwBrK94PNdd 8oCf8owipzn4VU2wApeaxDVQpqbS7H+Rw22tTxTgNcSrtl91LK3BRur9mNARJY2aHmaUfI0cS76 Z08MxPeFnxXI87bmUxjvxcDy8nh6mATqGgWmRqNR0UIffCpmXGjpKnlIBlmlqEBTvEnQq2i80GA h/ X-Google-Smtp-Source: AGHT+IGfg1ztpTyATwGe7rvUAokC1uIQLlG/fvk5rx1Mm/XThaMI+XgJOkAlNEL4NqnJNRv6IYhobg== X-Received: by 2002:a17:906:c104:b0:add:ed0d:a581 with SMTP id a640c23a62f3a-ae6e6ea1f2emr255449766b.17.1752144953716; Thu, 10 Jul 2025 03:55:53 -0700 (PDT) Received: from [192.168.178.143] (p200301023701fa00fcc0f1dec54647e5.dip0.t-ipconnect.de. [2003:102:3701:fa00:fcc0:f1de:c546:47e5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae6e7e910fesm112497666b.1.2025.07.10.03.55.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jul 2025 03:55:53 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Jul 2025 12:55:52 +0200 X-Mailer: MailMate Free Mode (2.0r6222) Message-ID: <04CD92FB-463D-4FDE-9FD8-E159DBCBBE60@gmail.com> In-Reply-To: <20250708185349.62250-1-epirat07@gmail.com> References: <20250708180617.59679-1-epirat07@gmail.com> <20250708185349.62250-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v3 1/3] avformat/tls_openssl: add hostname for verification X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Marvin Scholz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 8 Jul 2025, at 20:53, Marvin Scholz wrote: > From: Daniel N Pettersson > > When verification is enabled (using -tls_verify 1) now > the hostname will be verified properly too, while before > only other aspects of the certificate were checked. > > Co-Authored-By: Marvin Scholz > --- > libavformat/tls_openssl.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c > index a0fa3285d5..7f10d80f9e 100644 > --- a/libavformat/tls_openssl.c > +++ b/libavformat/tls_openssl.c > @@ -906,8 +906,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op > } > ret = openssl_init_ca_key_cert(h); > if (ret < 0) goto fail; > - // Note, this doesn't check that the peer certificate actually matches > - // the requested hostname. > + > if (c->verify) > SSL_CTX_set_verify(p->ctx, SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); > p->ssl = SSL_new(p->ctx); > @@ -921,8 +920,15 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op > ret = init_bio_method(h); > if (ret < 0) > goto fail; > - if (!c->listen && !c->numerichost) > + if (!c->listen && !c->numerichost) { > + if (!SSL_set1_host(p->ssl, c->host)) { > + av_log(h, AV_LOG_ERROR, "Failed to set hostname for TLS/SSL verification: %s\n", > + openssl_get_error(p)); > + ret = AVERROR_EXTERNAL; > + goto fail; > + } > SSL_set_tlsext_host_name(p->ssl, c->host); > + } > ret = c->listen ? SSL_accept(p->ssl) : SSL_connect(p->ssl); > if (ret == 0) { > av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session\n"); > -- > 2.39.5 (Apple Git-154) Planning to push the set tomorrow, if there are no objections. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".