On 7/13/2025 2:32 AM, Michael Niedermayer wrote:
On Fri, Jul 11, 2025 at 04:04:17PM +0000, Timo Rothenpieler wrote:
ffmpeg | branch: master | Timo Rothenpieler <t...@rothenpieler.org> | Tue Jun 
24 19:30:19 2025 +0200| [90fa9636efff84ec5a4b06815722c08188dca551] | committer: Timo 
Rothenpieler

avformat/tls_schannel: add DTLS support

http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90fa9636efff84ec5a4b06815722c08188dca551
---

  configure                  |   6 +-
  libavformat/tls_schannel.c | 890 +++++++++++++++++++++++++++++++++++++++++----
  libavformat/version.h      |   2 +-
  3 files changed, 833 insertions(+), 65 deletions(-)

breaks on mingw64

src/libavformat/tls_schannel.c: In function ‘ff_dtls_export_materials’:
src/libavformat/tls_schannel.c:606:5: error: unknown type name 
‘SecPkgContext_KeyingMaterialInfo’; did you mean 
‘SecPkgContext_NegotiationInfo’?
   606 |     SecPkgContext_KeyingMaterialInfo keying_info = { 0 };
       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |     SecPkgContext_NegotiationInfo
src/libavformat/tls_schannel.c:607:5: error: unknown type name 
‘SecPkgContext_KeyingMaterial’; did you mean ‘SecPkgContext_KeyInfoW’?
   607 |     SecPkgContext_KeyingMaterial keying_material = { 0 };
       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |     SecPkgContext_KeyInfoW
src/libavformat/tls_schannel.c:615:16: error: request for member ‘cbLabel’ in 
something not a structure or union
   615 |     keying_info.cbLabel = strlen(dst) + 1;
       |                ^
src/libavformat/tls_schannel.c:616:16: error: request for member ‘pszLabel’ in 
something not a structure or union
   616 |     keying_info.pszLabel = (LPSTR)dst;
       |                ^
src/libavformat/tls_schannel.c:617:16: error: request for member 
‘cbContextValue’ in something not a structure or union
   617 |     keying_info.cbContextValue = 0;
       |                ^
src/libavformat/tls_schannel.c:618:16: error: request for member 
‘pbContextValue’ in something not a structure or union
   618 |     keying_info.pbContextValue = NULL;
       |                ^
src/libavformat/tls_schannel.c:619:16: error: request for member 
‘cbKeyingMaterial’ in something not a structure or union
   619 |     keying_info.cbKeyingMaterial = materials_sz;
       |                ^
src/libavformat/tls_schannel.c:621:54: error: 
‘SECPKG_ATTR_KEYING_MATERIAL_INFO’ undeclared (first use in this function); did 
you mean ‘SECPKG_ATTR_NEGOTIATION_INFO’?
   621 |     sspi_ret = SetContextAttributes(&c->ctxt_handle, 
SECPKG_ATTR_KEYING_MATERIAL_INFO, &keying_info, sizeof(keying_info));
       |                                                      
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |                                                      
SECPKG_ATTR_NEGOTIATION_INFO
src/libavformat/tls_schannel.c:621:54: note: each undeclared identifier is 
reported only once for each function it appears in
src/libavformat/tls_schannel.c:627:56: error: ‘SECPKG_ATTR_KEYING_MATERIAL’ 
undeclared (first use in this function)
   627 |     sspi_ret = QueryContextAttributes(&c->ctxt_handle, 
SECPKG_ATTR_KEYING_MATERIAL, &keying_material);
       |                                                        
^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/libavformat/tls_schannel.c:633:48: error: request for member 
‘pbKeyingMaterial’ in something not a structure or union
   633 |     memcpy(dtls_srtp_materials, keying_material.pbKeyingMaterial, 
FFMIN(materials_sz, keying_material.cbKeyingMaterial));
       |                                                ^
In file included from src/libavutil/error.h:30,
                  from src/libavutil/common.h:43,
                  from src/libavutil/avutil.h:300,
                  from src/libavcodec/codec_par.h:26,
                  from src/libavformat/avformat.h:312,
                  from src/libavformat/tls_schannel.c:24:
src/libavformat/tls_schannel.c:633:102: error: request for member 
‘cbKeyingMaterial’ in something not a structure or union
   633 |     memcpy(dtls_srtp_materials, keying_material.pbKeyingMaterial, 
FFMIN(materials_sz, keying_material.cbKeyingMaterial));
       |                                                                        
                              ^
src/libavutil/macros.h:49:28: note: in definition of macro ‘FFMIN’
    49 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
       |                            ^
src/libavformat/tls_schannel.c:633:102: error: request for member 
‘cbKeyingMaterial’ in something not a structure or union
   633 |     memcpy(dtls_srtp_materials, keying_material.pbKeyingMaterial, 
FFMIN(materials_sz, keying_material.cbKeyingMaterial));
       |                                                                        
                              ^
src/libavutil/macros.h:49:34: note: in definition of macro ‘FFMIN’
    49 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
       |                                  ^
src/libavformat/tls_schannel.c:634:38: error: request for member 
‘pbKeyingMaterial’ in something not a structure or union
   634 |     FreeContextBuffer(keying_material.pbKeyingMaterial);
       |                                      ^
src/libavformat/tls_schannel.c:636:24: error: request for member 
‘cbKeyingMaterial’ in something not a structure or union
   636 |     if (keying_material.cbKeyingMaterial > materials_sz) {
       |                        ^
src/libavformat/tls_schannel.c:637:96: error: request for member 
‘cbKeyingMaterial’ in something not a structure or union
   637 |         av_log(h, AV_LOG_WARNING, "Keying material size mismatch: %ld > 
%zu\n", keying_material.cbKeyingMaterial, materials_sz);
       |                                                                        
                        ^
src/libavformat/tls_schannel.c: In function ‘tls_shutdown_client’:
src/libavformat/tls_schannel.c:710:29: error: ‘SEC_I_MESSAGE_FRAGMENT’ 
undeclared (first use in this function)
   710 |         } while(sspi_ret == SEC_I_MESSAGE_FRAGMENT || sspi_ret == 
SEC_I_CONTINUE_NEEDED);
       |                             ^~~~~~~~~~~~~~~~~~~~~~
src/libavformat/tls_schannel.c: In function ‘tls_handshake_loop’:
src/libavformat/tls_schannel.c:862:62: error: ‘SEC_I_MESSAGE_FRAGMENT’ 
undeclared (first use in this function)
   862 |         if (sspi_ret == SEC_I_CONTINUE_NEEDED || sspi_ret == 
SEC_I_MESSAGE_FRAGMENT || sspi_ret == SEC_E_OK) {
       |                                                              
^~~~~~~~~~~~~~~~~~~~~~
src/libavformat/tls_schannel.c: In function ‘tls_handshake’:
src/libavformat/tls_schannel.c:1016:58: error: ‘SECPKG_ATTR_DTLS_MTU’ 
undeclared (first use in this function); did you mean ‘SECPKG_ATTR_TARGET’?
  1016 |         sspi_ret = SetContextAttributes(&c->ctxt_handle, 
SECPKG_ATTR_DTLS_MTU, &mtu, sizeof(mtu));
       |                                                          
^~~~~~~~~~~~~~~~~~~~
       |                                                          
SECPKG_ATTR_TARGET
src/libavformat/tls_schannel.c: In function ‘tls_open’:
src/libavformat/tls_schannel.c:1072:51: error: ‘SP_PROT_DTLS1_X_SERVER’ 
undeclared (first use in this function); did you mean ‘SP_PROT_TLS1_SERVER’?
  1072 |             schannel_cred.grbitEnabledProtocols = 
SP_PROT_DTLS1_X_SERVER;
       |                                                   
^~~~~~~~~~~~~~~~~~~~~~
       |                                                   SP_PROT_TLS1_SERVER
src/libavformat/tls_schannel.c:1083:51: error: ‘SP_PROT_DTLS1_X_CLIENT’ 
undeclared (first use in this function); did you mean ‘SP_PROT_TLS1_CLIENT’?
  1083 |             schannel_cred.grbitEnabledProtocols = 
SP_PROT_DTLS1_X_CLIENT;
       |                                                   
^~~~~~~~~~~~~~~~~~~~~~
       |                                                   SP_PROT_TLS1_CLIENT
make: *** [/home/michael/ffmpeg-git/ffmpeg/ffbuild/common.mak:81: 
libavformat/tls_schannel.o] Error 1
make: *** Waiting for unfinished jobs....
STRIP   libavfilter/x86/colorspacedsp.o

Builds fine for me on latest mingw64.
These structs and defines are relatively new ones, not exactly sure how new.
But given they're just structs and defines, the function will just fail on a Windows version that doesn't know them.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to