0 Replies Latest reply on Jul 16, 2015 3:27 PM by amit123solanki

    Possible bug in wiced_dct_write_security_section

    amit123solanki

      Our requirement is that we need to write the certificate into the DCT security section.


      We are using wiced_dct_write_security_section API, which is declared in wiced_dct.h header file. We are passing pointer to structure platform_dct_security_t to this API, which holds private key, certificate and cookey.

        Now the problem is, this API is only writing certificate in DCT memory. When looking at the code of this API, it takes argument data pointer and simply writes it down into the certificate section of DCT, instead of first taking offset up to certificate data in provided argument. Because of this it will always write Private key of the provided argument into DCT certificate memory. Snippet here:

       

      config.c file line 121:

      wiced_result_t wiced_dct_write_security_section( const platform_dct_security_t* security_dct )

      {

          int result = bootloader_api->write_certificate_dct( 0, (void*)security_dct, sizeof( *security_dct ) );

          return ( result == 0 ) ? WICED_SUCCESS : WICED_ERROR;

      }

      bootloader.c file line 210:

      static int write_certificate_dct( unsigned long data_start_offset, void* data_in_addr,  unsigned long num_bytes_to_write )
      {
          return platform_write_dct( OFFSET(platform_dct_data_t, security_credentials) + OFFSET(platform_dct_security_t, certificate)- sizeof(platform_dct_header_t) + data_start_offset, data_in_addr, num_bytes_to_write, -1, NULL );
      }