From patchwork Sat Jul 13 13:25:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohit Gupta X-Patchwork-Id: 50519 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1367762vqb; Sat, 13 Jul 2024 06:25:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpMX+gqf2Gnrp+Gr/MedTkqgBk4H5hfDmHvrZc7BGQM8LKEC/A4z0q4mV6hOkiTa6m1vQn2LEXii052NYKnBVjMCaC3jkPUJeN2A== X-Google-Smtp-Source: AGHT+IFJxaXicPDeqLiePzWDGZ0fuxD3V/gdrG+tFNdqVZEg7XkUnvXoyjHhvUSjkqeOqag8VNaN X-Received: by 2002:a05:6512:3b20:b0:52c:c9ce:be8d with SMTP id 2adb3069b0e04-52eb99d6de0mr9826961e87.57.1720877137365; Sat, 13 Jul 2024 06:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720877137; cv=none; d=google.com; s=arc-20160816; b=Y92Q0oY08Sl9xgQW4QIgoYgLiOVp5TXoxqWV5X4iXXTVu//Q0RLw34SHiryOZkEjUP CyVrkVyxnTPB9BgFOYsUDWnFTCGIuP0X3f8EKzDaBz/rr0NTEX811UzGSDwsJ0jf9XqY 7JYkc5GLseG/krbQXoYKAgM1LdCitMtYSLFnH4yVF+BTOJkAKTDoLcdtZjntJZkt2zH/ 14Y/UXUNAR1Ml+ZVIX1onp8SjIGsrIMVQWTvbzuXyLCOPxQXqlBTiCH8hgHkgJtozAEq w3KrnGQ8K2j8ChKZIP2tpYOu/TgKS/XHoT5J55F8Za2hhtoHA7tlPXtrQpXC57OUw7vJ tWiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:to:from:user-agent:mime-version:date:message-id :delivered-to; bh=nXKmTEVNsaf8xU/OYOW2VlgUR7N76fN6FgIa+K2GhsI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=RLPIbeimiBLCSMDB+K/of6y+RmYMyVBffjoazwYzaxYvxWWY14/jfyiMUJYDrX8SiK 8CKIC0bUSbjRn6JRU5HJAdZuG99jRAQX2uTBfUNTLzf++/mskouUddMmawC5rNatg1DC RB5vZLF7L5Qar6e61ntdr0Gre6Du/Puroo8tKVOuGi5VKYUCUsQJtzy84ZvglsK2lN4T ikgAnfs4bKUOVDyt1DVMe3ruU6iF/d25V/yo+mdmfg/UaPpBRLTxPVwtWzDI287dS6Sr zVMql6lglV5zsDgXDpy5qg4RIp/p3aavc/1nTVTbeo18uuZYG8RWiu8vjm7pXd6qQ92u ftnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=skybound.link Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52ed252d07bsi371125e87.166.2024.07.13.06.25.36; Sat, 13 Jul 2024 06:25:37 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=skybound.link Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8280D68DAC9; Sat, 13 Jul 2024 16:25:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39D3668D901 for ; Sat, 13 Jul 2024 16:25:25 +0300 (EEST) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4266fcb311cso19662435e9.1 for ; Sat, 13 Jul 2024 06:25:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720877124; x=1721481924; h=content-language:to:subject:from:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uGe0Qh+6nXddBxUwbdR4eL8KHncogM5SxCktwSVfCwE=; b=ePMiiRlcXpCtABkNB2131X/nNJUeIae06ZQytyK2RGheHVjaTsH5+J1hRThwjwSLIs xnjewYji2Mypahb1vdt7r+2gjRMX3XcsTxJSjJSFBoXLPueYeCPEmxGCnv+jRM1NsZI5 G3yqgiNwVa4pDHfzy8y03OmjNaH/FGBlss/I8YZOACN8X5hGED38RHjDMFV/9A/ZdBiU IMy14cuWQNWKFl/m9T+aRno3Sy2kR6G0c37b+dHmi9Zd2JkS+Wg5D2GOZ3h5OWbiMffw iCR/fv7U4Huqp32TDlkbxl2bF1pbuS0GAkHl+/2Jqbad57qNxS8jqTlHjvx5R/tJTkn1 b4nA== X-Gm-Message-State: AOJu0Yziym57KCOzksqR8JytxX3TwiFlnDDlrXjde4Ac+DYyfbRSmzyd kTZFBqUFqSukHFS5ZoL7DyeJpyjn6KoCjihSM3WeZwub040IUMUN3cTycRriiE4EP74VOWGR7qv MiVA= X-Received: by 2002:a05:600c:201:b0:427:9dad:17df with SMTP id 5b1f17b1804b1-4279dad1e64mr36310685e9.12.1720877123982; Sat, 13 Jul 2024 06:25:23 -0700 (PDT) Received: from ?IPV6:2a01:4b00:9e28:1e00:cfd9:92a0:185:2585? ([2a01:4b00:9e28:1e00:cfd9:92a0:185:2585]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5ef57aesm20115295e9.45.2024.07.13.06.25.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Jul 2024 06:25:23 -0700 (PDT) Message-ID: Date: Sat, 13 Jul 2024 14:25:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Mohit Gupta To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: FTLDB34duB6t mbedtls_x509_crt_parse_file returns an error with negative numbers, and positive numbers indicate the number of failed certificates to load from certificate specific issues, such as critical extensions. This would fix ticket #11079. Signed-off-by: Mohit Gupta --- libavformat/tls_mbedtls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) skipped %d certificate(s)\n", ret); } } -- 2.45.2 diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index 567b95b..97094e3 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -223,9 +223,11 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op // load trusted CA if (shr->ca_file) { - if ((ret = mbedtls_x509_crt_parse_file(&tls_ctx->ca_cert, shr->ca_file)) != 0) { + if ((ret = mbedtls_x509_crt_parse_file(&tls_ctx->ca_cert, shr->ca_file)) < 0) { av_log(h, AV_LOG_ERROR, "mbedtls_x509_crt_parse_file for CA cert returned %d\n", ret); goto fail; + } else if (ret > 0) { + av_log(h, AV_LOG_DEBUG, "mbedtls_x509_crt_parse_file