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 EC0C04ECA3 for ; Sun, 13 Jul 2025 15:36:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1479D68DEE1; Sun, 13 Jul 2025 18:36:52 +0300 (EEST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id DF49968CF6A for ; Sun, 13 Jul 2025 18:36:45 +0300 (EEST) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-23636167b30so31246785ad.1 for ; Sun, 13 Jul 2025 08:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752421003; x=1753025803; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=z111sw4Sf6r8EnHrVsJ5rw1yupg9B6ZqowAauu3H8VI=; b=JbivP+eLlkTymy0ODGxjLCxPp6ZDNR3Xt3dbzzu/rfdh6OyYr+jT6ApGPKJ1WSt2ZC J9cOvDva7/20U6QI5B76TGFTRWq6N2swQkVycK3bL5LdncrQkB6+HpcFK5zKc3GW1h35 DMFZTvqNhBGgm0Mt3kPILxS9hxKkXCySjBCXCCyThsrF63qtuBPerdwTTTUXp+Hm4jhM OzKzaDd2cpMrSai3NPhZvlQsX2FLUSHC29WI298veNwkGqM0UsUchRz3pHTPjbpJzVS/ ySRAo4Mc95y2FTKCxN5XhFPVtSNPHWhgspBnSUzbnb788xnCHIsJAYOFoRtyHpc+J7/f aQEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752421003; x=1753025803; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z111sw4Sf6r8EnHrVsJ5rw1yupg9B6ZqowAauu3H8VI=; b=pwHp5YdOcYaTdoLBdziYTrLi56XmEq54D2wOsK0HB8hmdz4Cc+VzpoIcwLr57CQaP+ UzrQQjEtQq+x6HV0QxsrLrgfvzlovXgqaDcrazeszeYClmdFSrVEVjNlfmmeXIHPMnNB Uz3GLe7keVbNWZLy9Tag53fl9MQp7i6NWapVEWHENVuSYcRxogpHm65Aesef/ATF7Mb1 IQ0Q93vf/hNWE2kJw6P/cr/3v91y+jfCCBED3ptw/zhFo4qxIpW4yM5f8zJ5FTdPKq1v M5EQe99f0mPE9ak+qUnSfDoORYhM5RUnyz1434ZTgIlYM1PzYvUL/IgbUXDpXS1UkkNY EAEQ== X-Gm-Message-State: AOJu0Yz0NUvTNygJMiqG7uTKcu6Qx/yjmD5kckEotwpiGX93nR3QanIA QtFbXmcUWmix+Lu0IoVmxLa+Z1fcbqpoQy7QP4/tnSLnZSLpNuVpwu9h/ViRbg== X-Gm-Gg: ASbGncvR8XaPWZvx1yQ72vKuSdgQ9PFaGM7+o5jStTnq9pOeln/kQ2sMD2BRwj/FGmQ pgZrPHwfx2Y40aU7wzbcOC9u1mufLfrCZsHf4W/T3qLFbgcXCqJ19NqKuI3A9ex/SMvL1/irrvS dAYrM25wh+cIHS6awCdFvs5edKut34k+R17B3ythKc0hmm4BsKZhPCRU42RrGZberhySOwXZAB+ JTSoLMsC+axxu7SzRkaNuhf7fiA0PH1Yuo7a/xoTeUVwPCDFi0rwrB/u6S/CMDD+ZRJh7IuNZCx RZ/MA/ua9wAH4tQqltAr7FMxMhoZAdt9KxWyhCfz5JdlpSr5rwsfvjqa74JI8itdG0Fk0bI7IuN CfeP/TeuicBhJH4xccQ== X-Google-Smtp-Source: AGHT+IGC8W0Igu0cH0/vEJm64DlTmNS0zBNsq4G6tje7X4ss53McgwMIH5YSpfpKYhawREN/R9bJiQ== X-Received: by 2002:a17:902:e790:b0:234:d292:be72 with SMTP id d9443c01a7336-23dee0b4be3mr123471825ad.26.1752421003238; Sun, 13 Jul 2025 08:36:43 -0700 (PDT) Received: from Gryph ([2800:2121:b000:82e:590f:c469:d934:b00]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23de42ad9d9sm83007245ad.67.2025.07.13.08.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jul 2025 08:36:42 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 13 Jul 2025 12:36:32 -0300 Message-ID: <20250713153632.39655-1-jamrial@gmail.com> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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 supported distros seemingly don't have them, so check for them and disable the dtls protocol if unavailable. Signed-off-by: James Almer --- configure | 3 +++ libavformat/tls_schannel.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6df8fa4deb..0735527ed4 100755 --- a/configure +++ b/configure @@ -7271,6 +7271,9 @@ enabled schannel && schannel_extralibs="-lsecur32 -lncrypt -lcrypt32" || disable schannel +enabled schannel && check_type "windows.h security.h schnlsp.h" SecPkgContext_KeyingMaterialInfo "-DSECURITY_WIN32 -D_WIN32_WINNT=0x0A00" || + disable dtls_protocol + 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..28641c5f13 100644 --- a/libavformat/tls_schannel.c +++ b/libavformat/tls_schannel.c @@ -20,6 +20,13 @@ /** Based on the CURL SChannel module */ +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0A00 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0A00 +#endif + +#include "config_components.h" + #include "libavutil/mem.h" #include "avformat.h" #include "internal.h" @@ -634,6 +641,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 CONFIG_DTLS_PROTOCOL TLSContext *c = h->priv_data; SecPkgContext_KeyingMaterialInfo keying_info = { 0 }; @@ -672,6 +680,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 +784,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( +#if CONFIG_DTLS_PROTOCOL + 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 +943,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 || +#if CONFIG_DTLS_PROTOCOL + 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); @@ -1080,6 +1099,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 +1110,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 +1157,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 +1170,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 */ @@ -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".