void application_start( ) { wiced_ip_address_t ip_address; wiced_result_t result; wiced_init( ); wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL); /* Configure the device */ /* wiced_configure_device( app_config ); */ /* Config bypassed in local makefile and wifi_config_dct.h */ WPRINT_APP_INFO( ( "Resolving IP address of HTTPS server\n" ) ); wiced_hostname_lookup("www.google.com", &ip_address, 10000); WPRINT_APP_INFO( ( "Server is at %u.%u.%u.%u\n", (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 24), (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 16), (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 8), (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 0) ) ); WPRINT_APP_INFO( ( "Getting '/'...\n" ) ); /* Initialize the root CA certificate */ wiced_tls_init_root_ca_certificates( google_root_ca_certificate ); result = wiced_https_get( &ip_address, SIMPLE_GET_REQUEST, buffer, BUFFER_LENGTH, "www.google.com" ); if ( result == WICED_SUCCESS ) { WPRINT_APP_INFO( ( "Server returned\n%s", buffer ) ); } else { WPRINT_APP_INFO( ( "Get failed: %u\n", result ) ); } wiced_deinit(); }
void platform_network_securedinit(Network* n, const char* ca_buf, size_t ca_size) { if (!n || !ca_buf || !ca_size) { platform_printf("%s: bad args\n", __func__); return; } wiced_result_t rc = wiced_tls_init_root_ca_certificates(ca_buf); if (rc != WICED_SUCCESS) { platform_printf("%s: root CA certificate failed to initialize: %u\n", __func__, rc); return; } n->tls_enabled = WICED_TRUE; }