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 E658E43CF0 for ; Sun, 13 Jul 2025 19:57:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4958468E38A; Sun, 13 Jul 2025 22:57:10 +0300 (EEST) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id D32C968E179 for ; Sun, 13 Jul 2025 22:57:03 +0300 (EEST) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-234d3261631so28442155ad.1 for ; Sun, 13 Jul 2025 12:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752436621; x=1753041421; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=oJgzgrdfOtTYJRPdzc7d1MIGlTwc4b90584V7h/dgAE=; b=PXHfXxnrFrPYTTEvgubpn958okAXcZOBTnwFCIGrta5NjWeBT5DG7+QsXaBX0m5qW+ ZCBKNMGhMT1DfuXEdPjd9C2jr+Lg7nl6eN68EWUDBseNlfLv9A9xQA/9OH3fwxyTZwY4 FtT0HC2mRJg2gDyJBCL5ej6BJ+Z4ODRR1bxaioSnKGkDZkkX73Iii0I5UpQYPUQuMRPN pq8+HLZSJx2Zo5oVtMZZ+s410DMTPhTfwrIkILxJEb1wUJ3Twm1rnaaheepIGp9kYpby IftEP9Q8N+5uuflJZQ5sbt+eUbXrpQrHajml6YcelyTsKyYjphFce454Z0wXSU+qD3nK ZRJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752436621; x=1753041421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oJgzgrdfOtTYJRPdzc7d1MIGlTwc4b90584V7h/dgAE=; b=vZrFKRUKsVQLlRDTTj57rrIET6nKe3p8/PYKRGQimy6IkxY8NWEP1SdDiYY0LCiuSG tp5d2kcHHpkGUHgfZzv0kwC2NfA3qzOKr0Una14mKRxSot7Vw1uhE/0pCErudsDXf8Sk owIu1dn3i6/N5MxjEPH2n9ED0Sqn0m7V6MjlMY1rpqdLqMi07Nd+zC3/nMDE7UU76bd7 YtRILN77yfBlMIysQfvp1yBdSTOc6UrCIEDSXnvcQe58yR/S+bUBhD6jQ7c5FEC+JCcr eZ6n7yiT1CR/V+ZOiOTUGDsbDNg2CltbmQ+gtvFVd2Yx4V3fgPMTD2kFR5GZ81/NF71B U6eQ== X-Gm-Message-State: AOJu0YzknR1So61bq7BYpyZKym3xjMIITeE1uE+ppZLyXd7A0ttD2PWV uE9um1phv4DCLZkzhe6TIjnhoN+sWmOD2MqVZFyul6uNMRhUeM/R/q17fjJH9g== X-Gm-Gg: ASbGnct+I6XV4ZS/PSE+QA8Xqffut+A/bLxwNqU5xRC5CQKCoGAeR3f1v+gmhZLhyo7 Tn/fDBZpGYsYwZ1uGM4vmzTu1qwtS4mf467q1nV84ROEYwKeaNy/hYyaoU29q5L1MdPbQmFLfv2 0MUIaGseDHTg/Pqsn6lXzuTZ5mizaoLcs0cenotculf7RUqtpmvx98hYb4P+wPPz2cybj87UIIi de3vPyS4WoT37OVO+nJBGJ1gAew03o38chsoVXz+Xz8cshVibAHIzQGhhnaFQZlDSqU/mpDazZU jzeOcijepFPJsf2ozP1pQNqXSWZI15I3M+D0s7cK/p3oIZrcwEzpGu2wHdNBZ2wiZcAguyHJAmG vUiDb9THb7qLqMo3aZI8J X-Google-Smtp-Source: AGHT+IEusxSgKpf+CVXB7o3mI9SazjJMqO06mQEhSp5/cS143r/R1VzazF8mXMZUVOlcSbvtT/t0/g== X-Received: by 2002:a17:903:b0d:b0:236:6fbb:a5f3 with SMTP id d9443c01a7336-23dede92fdfmr139739505ad.40.1752436621240; Sun, 13 Jul 2025 12:57:01 -0700 (PDT) Received: from Gryph ([2800:2121:b000:82e:5cac:4861:462e:fb7e]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23de4286daesm80454185ad.20.2025.07.13.12.57.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jul 2025 12:57:00 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 13 Jul 2025 16:56:20 -0300 Message-ID: <20250713195620.8182-1-jamrial@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250713173749.GG29660@pb2> References: <20250713173749.GG29660@pb2> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] avformat/tls_schannel: add check for Windows 10 only types and defines 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 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: Old Mingw-w64 releases provided by some distros seemingly don't have them, so check for them and disable the dtls protocol if unavailable. Signed-off-by: James Almer --- configure | 4 ++++ libavformat/tls_schannel.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6df8fa4deb..fc082d5467 100755 --- a/configure +++ b/configure @@ -2498,6 +2498,7 @@ TYPES_LIST=" kCVImageBufferTransferFunction_ITU_R_2020 kCVImageBufferTransferFunction_SMPTE_ST_428_1 kVTQPModulationLevel_Default + SecPkgContext_KeyingMaterialInfo socklen_t struct_addrinfo struct_group_source_req @@ -6822,6 +6823,7 @@ check_type "windows.h d3d12video.h" "ID3D12VideoEncoder" test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_VIDEO feature = D3D12_FEATURE_VIDEO_ENCODER_CODEC" && \ test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS req" && enable d3d12_encoder_feature check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00 +check_type "windows.h security.h schnlsp.h" SecPkgContext_KeyingMaterialInfo -DSECURITY_WIN32 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat @@ -7271,6 +7273,8 @@ enabled schannel && schannel_extralibs="-lsecur32 -lncrypt -lcrypt32" || disable schannel +enabled schannel && check_cc dtls_protocol "windows.h security.h schnlsp.h" "int i = SP_PROT_DTLS1_X_CLIENT;" -DSECURITY_WIN32 + makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo enabled makeinfo \ && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \ diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c index da6a284376..c92870347f 100644 --- a/libavformat/tls_schannel.c +++ b/libavformat/tls_schannel.c @@ -20,6 +20,9 @@ /** Based on the CURL SChannel module */ +#include "config.h" +#include "config_components.h" + #include "libavutil/mem.h" #include "avformat.h" #include "internal.h" @@ -634,6 +637,7 @@ int ff_tls_set_external_socket(URLContext *h, URLContext *sock) int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t materials_sz) { +#if HAVE_SECPKGCONTEXT_KEYINGMATERIALINFO TLSContext *c = h->priv_data; SecPkgContext_KeyingMaterialInfo keying_info = { 0 }; @@ -672,6 +676,9 @@ int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t ma } return 0; +#else + return AVERROR(ENOSYS); +#endif } int ff_dtls_state(URLContext *h) @@ -773,7 +780,11 @@ static int tls_shutdown_client(URLContext *h) } FreeContextBuffer(outbuf.pvBuffer); } - } while(sspi_ret == SEC_I_MESSAGE_FRAGMENT || sspi_ret == SEC_I_CONTINUE_NEEDED); + } while( +#ifdef SEC_I_MESSAGE_FRAGMENT + sspi_ret == SEC_I_MESSAGE_FRAGMENT || +#endif + sspi_ret == SEC_I_CONTINUE_NEEDED); av_log(h, AV_LOG_DEBUG, "Close session result: 0x%lx\n", sspi_ret); @@ -928,7 +939,11 @@ static int tls_handshake_loop(URLContext *h, int initial) } /* continue handshake */ - if (sspi_ret == SEC_I_CONTINUE_NEEDED || sspi_ret == SEC_I_MESSAGE_FRAGMENT || sspi_ret == SEC_E_OK) { + if (sspi_ret == SEC_I_CONTINUE_NEEDED || +#ifdef SEC_I_MESSAGE_FRAGMENT + sspi_ret == SEC_I_MESSAGE_FRAGMENT || +#endif + sspi_ret == SEC_E_OK) { for (i = 0; i < 3; i++) { if (outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) { ret = ffurl_write(uc, outbuf[i].pvBuffer, outbuf[i].cbBuffer); @@ -953,11 +968,13 @@ static int tls_handshake_loop(URLContext *h, int initial) goto fail; } +#ifdef SEC_I_MESSAGE_FRAGMENT if (sspi_ret == SEC_I_MESSAGE_FRAGMENT) { av_log(h, AV_LOG_TRACE, "Writing fragmented output message part\n"); read_data = 0; continue; } +#endif if (inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) { if (c->enc_buf_offset > inbuf[1].cbBuffer) { @@ -1080,6 +1097,7 @@ static int tls_handshake(URLContext *h) if (ret < 0) goto fail; +#if CONFIG_DTLS_PROTOCOL if (s->is_dtls && s->mtu > 0) { ULONG mtu = s->mtu; sspi_ret = SetContextAttributes(&c->ctxt_handle, SECPKG_ATTR_DTLS_MTU, &mtu, sizeof(mtu)); @@ -1090,6 +1108,7 @@ static int tls_handshake(URLContext *h) } av_log(h, AV_LOG_VERBOSE, "Set DTLS MTU to %d\n", s->mtu); } +#endif c->connected = 1; s->state = DTLS_STATE_FINISHED; @@ -1136,8 +1155,10 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op schannel_cred.dwFlags = SCH_CRED_NO_SYSTEM_MAPPER | SCH_CRED_MANUAL_CRED_VALIDATION; +#if CONFIG_DTLS_PROTOCOL if (s->is_dtls) schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_SERVER; +#endif } else { if (s->verify) schannel_cred.dwFlags = SCH_CRED_AUTO_CRED_VALIDATION | @@ -1147,8 +1168,10 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op SCH_CRED_IGNORE_NO_REVOCATION_CHECK | SCH_CRED_IGNORE_REVOCATION_OFFLINE; +#if CONFIG_DTLS_PROTOCOL if (s->is_dtls) schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_CLIENT; +#endif } /* Get credential handle */ @@ -1183,6 +1206,7 @@ end: return ret; } +#if CONFIG_DTLS_PROTOCOL static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) { TLSContext *c = h->priv_data; @@ -1192,6 +1216,7 @@ static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **o return tls_open(h, uri, flags, options); } +#endif static int tls_read(URLContext *h, uint8_t *buf, int len) { @@ -1439,6 +1464,7 @@ static const AVOption options[] = { { NULL } }; +#if CONFIG_TLS_PROTOCOL static const AVClass tls_class = { .class_name = "tls", .item_name = av_default_item_name, @@ -1458,7 +1484,9 @@ const URLProtocol ff_tls_protocol = { .flags = URL_PROTOCOL_FLAG_NETWORK, .priv_data_class = &tls_class, }; +#endif +#if CONFIG_DTLS_PROTOCOL static const AVClass dtls_class = { .class_name = "dtls", .item_name = av_default_item_name, @@ -1479,3 +1507,4 @@ const URLProtocol ff_dtls_protocol = { .flags = URL_PROTOCOL_FLAG_NETWORK, .priv_data_class = &dtls_class, }; +#endif -- 2.50.1 _______________________________________________ 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".