5 Replies Latest reply on May 15, 2018 3:02 AM by jerome_2594171

    wiced_generic_start_tls_with_ciphers() freeze and reboot

    jerome_2594171

      Hello,

       

      When I'm trying to connect to the Azure IOT hub server with AMQP functions, the program freezes and then restarts (not all the time) when it's calling the following function:

      ( After reboot, the program no longer has this problem. And it happens again on a new connection on the same device ).

       

      WICED SKD : 5.1.0

       

       

      wiced_result_t wiced_generic_start_tls_with_ciphers( wiced_tls_context_t* tls_context, void* referee, wiced_tls_endpoint_type_t type, wiced_tls_certificate_verification_t verification, const cipher_suite_t* cipher_list[], tls_transport_protocol_t transport_protocol )

      {

      }

       

      and more precisely in the loop below :

       

          do

          {

              uint64_t curr_time;

              if (type == WICED_TLS_AS_SERVER)

              {

      result = ssl_handshake_server_async( &tls_context->context );

      if ( result != TLS_SUCCESS )

      {

      WPRINT_SECURITY_INFO(( "Error with TLS server handshake\n" ));

      goto exit_with_inited_context;

      }

              }

              else

              {

      result = ssl_handshake_client_async( &tls_context->context );

      if ( result != TLS_SUCCESS )

      {

      WPRINT_SECURITY_INFO(( "Error with TLS client handshake %u\n", (unsigned int)result ));

      goto exit_with_inited_context;

      }

              }

              /* break out if stuck */

              curr_time = tls_host_get_time_ms();

              if ( curr_time - start_time > MAX_HANDSHAKE_WAIT )

              {

      WPRINT_SECURITY_INFO(( "Timeout in SSL handshake\n" ));

      result = TLS_HANDSHAKE_TIMEOUT;

      goto exit_with_inited_context;

              }

              /* if no state change then wait on client */

              if ( prev_state == tls_context->context.state )

              {

      host_rtos_delay_milliseconds( 10 );

              }

              else /* otherwise process next state with no delay */

              {

      prev_state = tls_context->context.state;

              }

          } while ( tls_context->context.state != SSL_HANDSHAKE_OVER );

          return WICED_SUCCESS;

       

       

      I have an impression that during the different tests of the enumerator below (TLS STATES), the test blocks on number 3:

      typedef enum

      {

          SSL_HELLO_REQUEST,

          SSL_CLIENT_HELLO,

          SSL_SERVER_HELLO,

          SSL_SERVER_CERTIFICATE,

          SSL_SERVER_KEY_EXCHANGE,

          SSL_CERTIFICATE_REQUEST,

          SSL_SERVER_HELLO_DONE,

          SSL_CLIENT_CERTIFICATE,

          SSL_CLIENT_KEY_EXCHANGE,

          SSL_CERTIFICATE_VERIFY,

          SSL_CLIENT_CHANGE_CIPHER_SPEC,

          SSL_CLIENT_FINISHED,

          SSL_SERVER_CHANGE_CIPHER_SPEC,

          SSL_SERVER_FINISHED,

          SSL_FLUSH_BUFFERS,

          SSL_HANDSHAKE_OVER

      } tls_states_t;

       

      Can you explain the reason for this and help me to solve the problem ?