Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
@ 2024-07-13 13:25 Mohit Gupta
  2024-07-14 16:26 ` Marth64
  0 siblings, 1 reply; 11+ messages in thread
From: Mohit Gupta @ 2024-07-13 13:25 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1197 bytes --]

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 <git@skybound.link>
---
  libavformat/tls_mbedtls.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

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 
skipped %d certificate(s)\n", ret);
          }
      }
  -- 2.45.2


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-13 13:25 [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file Mohit Gupta
@ 2024-07-14 16:26 ` Marth64
  2024-07-14 16:29   ` Marth64
  0 siblings, 1 reply; 11+ messages in thread
From: Marth64 @ 2024-07-14 16:26 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

LGTM after checking documentation of
mbedtls_x509_crt_parse_file()
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-14 16:26 ` Marth64
@ 2024-07-14 16:29   ` Marth64
  2024-07-16  0:56     ` Mohit Gupta
  0 siblings, 1 reply; 11+ messages in thread
From: Marth64 @ 2024-07-14 16:29 UTC (permalink / raw)
  To: Marth64; +Cc: FFmpeg development discussions and patches

> av_log(h, AV_LOG_DEBUG, "mbedtls_x509_crt_parse_file skipped %d
certificate(s)\n", ret);

Is it worth it making this a higher log level? Or is it too much noise?
Thinking if it’s important security information to share with the user.
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-14 16:29   ` Marth64
@ 2024-07-16  0:56     ` Mohit Gupta
  2024-07-16  1:25       ` Marth64
  0 siblings, 1 reply; 11+ messages in thread
From: Mohit Gupta @ 2024-07-16  0:56 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 608 bytes --]

Could do. What level were you thinking? WARN?

On 14/07/2024 17:29, Marth64 wrote:
>> av_log(h, AV_LOG_DEBUG, "mbedtls_x509_crt_parse_file skipped %d
> certificate(s)\n", ret);
>
> Is it worth it making this a higher log level? Or is it too much noise?
> Thinking if it’s important security information to share with the user.
> _______________________________________________
> 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".

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-16  0:56     ` Mohit Gupta
@ 2024-07-16  1:25       ` Marth64
  2024-07-16 19:20         ` Mohit Gupta
  0 siblings, 1 reply; 11+ messages in thread
From: Marth64 @ 2024-07-16  1:25 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> Could do. What level were you thinking? WARN?

How about,
```
av_log(h, AV_LOG_WARNING, "Failed to process %d certificate(s) from
the CA bundle, ignoring these certificates\n", ret);
```


Thank you,
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-16  1:25       ` Marth64
@ 2024-07-16 19:20         ` Mohit Gupta
  2024-07-17 22:24           ` Marth64
  0 siblings, 1 reply; 11+ messages in thread
From: Mohit Gupta @ 2024-07-16 19:20 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Sounds good. Sorry first time contributing, should I make another patch
with the change and send that through again with git send-email?

Thanks
Mohit

On Tue, Jul 16, 2024 at 2:26 AM Marth64 <marth64@proxyid.net> wrote:

> > Could do. What level were you thinking? WARN?
>
> How about,
> ```
> av_log(h, AV_LOG_WARNING, "Failed to process %d certificate(s) from
> the CA bundle, ignoring these certificates\n", ret);
> ```
>
>
> Thank you,
> _______________________________________________
> 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".
>
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-16 19:20         ` Mohit Gupta
@ 2024-07-17 22:24           ` Marth64
  2024-07-25  0:32             ` [FFmpeg-devel] [PATCH v2] " Mohit Gupta
  0 siblings, 1 reply; 11+ messages in thread
From: Marth64 @ 2024-07-17 22:24 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Disclaimer: I am a light contributor and do not have access
to actually merge this patch, only making suggestions based
on my learnings.

> Sounds good. Sorry first time contributing, should I make another patch
> with the change and send that through again with git send-email?
Yes, except when you do git format-patch, specify "-v2" at the end
and provide the message ID of your original email, so it processes as a reply.

This will prefix the patch subject with "V2" to let readers know you have
updated it.

Thank you!
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-17 22:24           ` Marth64
@ 2024-07-25  0:32             ` Mohit Gupta
  2024-08-01  4:50               ` Marth64
  0 siblings, 1 reply; 11+ messages in thread
From: Mohit Gupta @ 2024-07-25  0:32 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1237 bytes --]

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 <git@skybound.link>
---
  libavformat/tls_mbedtls.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 567b95b129..ccf5ee38ad 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_WARNING, "Failed to process %d 
certificate(s) from the CA bundle, ignoring these certificates\n", ret);
          }
      }
  -- 2.45.2


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-07-25  0:32             ` [FFmpeg-devel] [PATCH v2] " Mohit Gupta
@ 2024-08-01  4:50               ` Marth64
  2024-08-01 17:05                 ` Mohit Gupta
  0 siblings, 1 reply; 11+ messages in thread
From: Marth64 @ 2024-08-01  4:50 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi, good day,

I think something is wrong with this v2 patch, it is showing as corrupt in
the patchwork system.
See here:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/69b8a7a5-3826-4aef-88e1-2984d61a58bb@skybound.link/
By chance did you modify the .patch file directly?
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-08-01  4:50               ` Marth64
@ 2024-08-01 17:05                 ` Mohit Gupta
  2024-08-01 17:34                   ` [FFmpeg-devel] [PATCH v3] " Mohit Gupta
  0 siblings, 1 reply; 11+ messages in thread
From: Mohit Gupta @ 2024-08-01 17:05 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 841 bytes --]

Interesting, I did not personally. I sent it by generating an .eml file 
with git and then opening that in Thunderbird to send. I wonder if 
Thunderbird editor mangled it or something. Let me try sending directly 
via git as a -v3.

On 01/08/2024 05:50, Marth64 wrote:
> Hi, good day,
>
> I think something is wrong with this v2 patch, it is showing as corrupt in
> the patchwork system.
> See here:
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/69b8a7a5-3826-4aef-88e1-2984d61a58bb@skybound.link/
> By chance did you modify the .patch file directly?
> _______________________________________________
> 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".

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v3] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file
  2024-08-01 17:05                 ` Mohit Gupta
@ 2024-08-01 17:34                   ` Mohit Gupta
  0 siblings, 0 replies; 11+ messages in thread
From: Mohit Gupta @ 2024-08-01 17:34 UTC (permalink / raw)
  To: ffmpeg-devel

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 <git@skybound.link>
---
 libavformat/tls_mbedtls.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 567b95b129..ccf5ee38ad 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_WARNING, "Failed to process %d certificate(s) from the CA bundle, ignoring these certificates\n", ret);
         }
     }
 
-- 
2.45.2

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-08-01 17:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-13 13:25 [FFmpeg-devel] [PATCH] libavformat/tls_mbedtls: Changes the return code handling of mbedtls_x509_crt_parse_file Mohit Gupta
2024-07-14 16:26 ` Marth64
2024-07-14 16:29   ` Marth64
2024-07-16  0:56     ` Mohit Gupta
2024-07-16  1:25       ` Marth64
2024-07-16 19:20         ` Mohit Gupta
2024-07-17 22:24           ` Marth64
2024-07-25  0:32             ` [FFmpeg-devel] [PATCH v2] " Mohit Gupta
2024-08-01  4:50               ` Marth64
2024-08-01 17:05                 ` Mohit Gupta
2024-08-01 17:34                   ` [FFmpeg-devel] [PATCH v3] " Mohit Gupta

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git