[FFmpeg-devel] [PATCH 17/18] avformat/tls_openssl: use existing context handle

Timo Rothenpieler timo at rothenpieler.org
Wed Jul 2 19:56:45 EEST 2025


---
 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 5805513065..6c994b3b89 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -842,14 +842,14 @@ static av_cold int openssl_init_ca_key_cert(URLContext *h)
             ret = AVERROR(EIO);
             goto fail;
         }
-    } else if (p->tls_shared.cert_buf) {
-        cert = cert_from_pem_string(p->tls_shared.cert_buf);
+    } else if (c->cert_buf) {
+        cert = cert_from_pem_string(c->cert_buf);
         if (SSL_CTX_use_certificate(p->ctx, cert) != 1) {
             av_log(p, AV_LOG_ERROR, "SSL: Init SSL_CTX_use_certificate failed, %s\n", openssl_get_error(p));
             ret = AVERROR(EINVAL);
             return ret;
         }
-    } else if (p->tls_shared.is_dtls){
+    } else if (c->is_dtls){
         av_log(p, AV_LOG_ERROR, "TLS: Init cert failed, %s\n", openssl_get_error(p));
         ret = AVERROR(EINVAL);
         goto fail;
@@ -863,14 +863,14 @@ static av_cold int openssl_init_ca_key_cert(URLContext *h)
             ret = AVERROR(EIO);
             goto fail;
         }
-    } else if (p->tls_shared.key_buf) {
-        p->pkey = pkey = pkey_from_pem_string(p->tls_shared.key_buf, 1);
+    } else if (c->key_buf) {
+        p->pkey = pkey = pkey_from_pem_string(c->key_buf, 1);
         if (SSL_CTX_use_PrivateKey(p->ctx, pkey) != 1) {
             av_log(p, AV_LOG_ERROR, "TLS: Init SSL_CTX_use_PrivateKey failed, %s\n", openssl_get_error(p));
             ret = AVERROR(EINVAL);
             return ret;
         }
-    } else if (p->tls_shared.is_dtls){
+    } else if (c->is_dtls) {
         av_log(p, AV_LOG_ERROR, "TLS: Init pkey failed, %s\n", openssl_get_error(p));
         ret = AVERROR(EINVAL);
         goto fail;
-- 
2.49.0



More information about the ffmpeg-devel mailing list