locked
Problem in multithreaded applications for TLS 1.0 using winsock api RRS feed

  • Question

  • Hi Team,

    I am facing the below issue while using winsock api to create secure socket on WinCE2013.

    1. I have created dlls for winsock api and enabled the TLS 1.0 Below given is the code snippet.

    protocolsToUse.dwCount = 1;

    protocolsToUse.ProtocolList[0].dwFlags = 0;
    protocolsToUse.ProtocolList[0].dwProtocol = SSL_PROTOCOL_TLS1;
    protocolsToUse.ProtocolList[0].dwVersion = 0;

    if (WSAIoctl(s, SO_SSL_SET_PROTOCOLS,
    (LPVOID)&protocolsToUse, sizeof(protocolsToUse),
    NULL, 0, NULL, NULL, NULL) == SOCKET_ERROR)
    {
    goto SSLInit_Error;

    It works for TLS 1.0 but I am not able to see any option to use TLS 1.1 or TLS 1.2 in winsock headers.

    2. I am importing these dlls in c# application for .net cf 3.9. The c# application is mqtt multithreaded library. It works fine if I disable ssl option for winsock api. It throws socket error 10036 for TLS 1.0. There are two threads one sends the messages using winsock send function and other receives the messages using winsock recv function.

    3. If I put two seconds sleep in the receiving thread then it works fine for TLS 1.0 also and doesn't throw 10036 error. I have tested TLS 1.0 communication on wireshark and mqtt broker.

    4. If I am not using ssl init and using the sockets for normal mqtt communication then it works fine without any sleep in receiving thread.

    I have no idea why the same design behaving differently for ssl and non ssl sockets. 

    Thankyou

     

    Wednesday, August 12, 2020 8:37 AM

All replies

  • Hi,

    Thank you for posting here.

    According to the issue, it is more related to the winapi. I suggest you should ask it in Winapi-General forum for better help. And this thread will be moved to Off-Topic Posts.

    Best Regards,

    Jeanine Zhang


    "Visual c++" forum will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A !
    For more information, please refer to the sticky post.

    Thursday, August 13, 2020 1:49 AM