You can chat about native SDK questions and issues here.

User avatar
By dannybackx
#95531 Hey,
I have a simple app which runs into memory issues (with esp8266) so I'm changing from mbedtls to WolfSSL, the one from .
I consistently run on this type of error with a cut down sample :
Code: Select allE (10118) esp-tls-wolfssl: wolfSSL_connect returned -0x1
E (10134) esp-tls-wolfssl: esp_wolfssl_handshake: This is to check whether handshake failed due to invalid certificate
E (10145) esp-tls-wolfssl: Failed to verify peer certificate , returned 24!
E (10153) esp-tls: Failed to open new connection
E (10158) TRANS_SSL: Failed to open a new connection

My app code basically looks like this :
Code: Select allbool CloudMessaging::sendMessage(const char *msg) {
  // Configure, if necessary
  if (! http_client) {
    bzero(&httpc, sizeof(httpc));
    httpc.event_handler = HttpEvent;
    httpc.auth_type = HTTP_AUTH_TYPE_BASIC;
    httpc.method = HTTP_METHOD_POST;

    httpc.cert_pem = fcm_root_cert_pem_start;
    ESP_LOGD(tag, "%s: cert_pem set", __FUNCTION__);

    if (httpc.url)
      free((void *)httpc.url);
    httpc.url = 0;
    asprintf((char **)&httpc.url, "%s/send", fcm_url_legacy);                   // Legacy HTTP API

    ESP_LOGD(tag, "%s(%s)", __FUNCTION__, httpc.url);
    http_client = esp_http_client_init(&httpc);
    esp_http_client_set_header(http_client, "Content-type", "application/json");
    char *tmp_auth_key;
    asprintf(&tmp_auth_key, "key=%s", auth_key);                                // Legacy HTTP API

    esp_http_client_set_header(http_client, "Authorization", tmp_auth_key);
    free((void *)tmp_auth_key);         // is copied in esp_http_client

  ESP_LOGD(tag, "%s msg %s", __FUNCTION__, msg);

  // Send
  esp_http_client_set_post_field(http_client, msg, strlen(msg));
  esp_err_t err = esp_http_client_perform(http_client);

  if (err != ESP_OK) {
    http_client = 0;
    return false;

Any ideas ?
Thanks for helping.