HTTPS request example failed (mbedtls_ssl_handshake returned -0x7680)

bxTennet71
Posts: 4
Joined: Thu Mar 26, 2020 10:45 pm

HTTPS request example failed (mbedtls_ssl_handshake returned -0x7680)

Postby bxTennet71 » Thu May 28, 2020 8:01 pm

Hello! I am trying to run HTTPS example. Unfortunately after providing wifi credentials and flashing in to ESP it fails.

Log:
  1. I (446250) example: Starting again!
  2. I (446690) esp-x509-crt-bundle: Certificate validated
  3. E (446690) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x7680
  4. E (446690) esp-tls: Failed to open new connection
  5. E (446700) example: Connection failed...
  6.  
  7. I (446700) example: Completed 39 requests
What is wrong?
I am using ESP-IDF v4.2-dev-1660-g7d7521367

ESP-Marius
Posts: 74
Joined: Wed Oct 23, 2019 1:49 am

Re: HTTPS request example failed (mbedtls_ssl_handshake returned -0x7680)

Postby ESP-Marius » Fri May 29, 2020 1:58 am

Hi,

There is a bug that would result in this error if you changed some of the mbedtls default values in menuconfig. Did you happen to change anything? The example still works when I tested it now (without changing anything).

The bug has already been fixed internally, so it should be included in the next sync to Github.

If you want to fix it locally before then you can try changing components/mbedtls/CMakeLists.txt, line 123 from:

Code: Select all

target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets})
to

Code: Select all

target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_targets})

bxTennet71
Posts: 4
Joined: Thu Mar 26, 2020 10:45 pm

Re: HTTPS request example failed (mbedtls_ssl_handshake returned -0x7680)

Postby bxTennet71 » Fri May 29, 2020 5:09 pm

Hi!

Thanks for response. I did not change anything after generating example (only Wifi creds.).

I changed that line in mbedtls's CMakeLists.txt as you advised and it results in this error:
  1. -- Found Git: /usr/bin/git (found version "2.26.2")
  2. -- The C compiler identification is GNU 8.2.0
  3. -- The CXX compiler identification is GNU 8.2.0
  4. -- The ASM compiler identification is GNU
  5. -- Found assembler: /home/bartosz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
  6. -- Check for working C compiler: /home/bartosz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
  7. -- Check for working C compiler: /home/bartosz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - works
  8. -- Detecting C compiler ABI info
  9. -- Detecting C compiler ABI info - done
  10. -- Detecting C compile features
  11. -- Detecting C compile features - done
  12. -- Check for working CXX compiler: /home/bartosz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
  13. -- Check for working CXX compiler: /home/bartosz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - works
  14. -- Detecting CXX compiler ABI info
  15. -- Detecting CXX compiler ABI info - done
  16. -- Detecting CXX compile features
  17. -- Detecting CXX compile features - done
  18. -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
  19. -- Building ESP-IDF components for target esp32
  20. -- Checking Python dependencies...
  21. Python requirements from /home/bartosz/esp-idf/requirements.txt are satisfied.
  22. -- Found PythonInterp: /home/bartosz/.espressif/python_env/idf4.2_py3.8_env/bin/python (found version "3.8.3")
  23. -- Found Perl: /usr/bin/perl (found version "5.30.2")
  24. -- App "https_request" version: 1
  25. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
  26. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
  27. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
  28. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
  29. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
  30. -- Adding linker script /home/bartosz/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
  31. -- Adding linker script /home/bartosz/code/https_request/build/esp-idf/esp32/esp32_out.ld
  32. -- Adding linker script /home/bartosz/esp-idf/components/esp32/ld/esp32.project.ld.in
  33. -- Adding linker script /home/bartosz/esp-idf/components/esp32/ld/esp32.peripherals.ld
  34. -- Components: app_trace app_update asio bootloader bootloader_support bt cbor coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_local_ctrl esp_netif esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos heap idf_test jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table perfmon protobuf-c protocol_examples_common protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
  35. -- Component paths: /home/bartosz/esp-idf/components/app_trace /home/bartosz/esp-idf/components/app_update /home/bartosz/esp-idf/components/asio /home/bartosz/esp-idf/components/bootloader /home/bartosz/esp-idf/components/bootloader_support /home/bartosz/esp-idf/components/bt /home/bartosz/esp-idf/components/cbor /home/bartosz/esp-idf/components/coap /home/bartosz/esp-idf/components/console /home/bartosz/esp-idf/components/cxx /home/bartosz/esp-idf/components/driver /home/bartosz/esp-idf/components/efuse /home/bartosz/esp-idf/components/esp-tls /home/bartosz/esp-idf/components/esp32 /home/bartosz/esp-idf/components/esp_adc_cal /home/bartosz/esp-idf/components/esp_common /home/bartosz/esp-idf/components/esp_eth /home/bartosz/esp-idf/components/esp_event /home/bartosz/esp-idf/components/esp_gdbstub /home/bartosz/esp-idf/components/esp_hid /home/bartosz/esp-idf/components/esp_http_client /home/bartosz/esp-idf/components/esp_http_server /home/bartosz/esp-idf/components/esp_https_ota /home/bartosz/esp-idf/components/esp_https_server /home/bartosz/esp-idf/components/esp_local_ctrl /home/bartosz/esp-idf/components/esp_netif /home/bartosz/esp-idf/components/esp_ringbuf /home/bartosz/esp-idf/components/esp_rom /home/bartosz/esp-idf/components/esp_serial_slave_link /home/bartosz/esp-idf/components/esp_system /home/bartosz/esp-idf/components/esp_timer /home/bartosz/esp-idf/components/esp_websocket_client /home/bartosz/esp-idf/components/esp_wifi /home/bartosz/esp-idf/components/espcoredump /home/bartosz/esp-idf/components/esptool_py /home/bartosz/esp-idf/components/expat /home/bartosz/esp-idf/components/fatfs /home/bartosz/esp-idf/components/freemodbus /home/bartosz/esp-idf/components/freertos /home/bartosz/esp-idf/components/heap /home/bartosz/esp-idf/components/idf_test /home/bartosz/esp-idf/components/jsmn /home/bartosz/esp-idf/components/json /home/bartosz/esp-idf/components/libsodium /home/bartosz/esp-idf/components/log /home/bartosz/esp-idf/components/lwip /home/bartosz/code/https_request/main /home/bartosz/esp-idf/components/mbedtls /home/bartosz/esp-idf/components/mdns /home/bartosz/esp-idf/components/mqtt /home/bartosz/esp-idf/components/newlib /home/bartosz/esp-idf/components/nghttp /home/bartosz/esp-idf/components/nvs_flash /home/bartosz/esp-idf/components/openssl /home/bartosz/esp-idf/components/partition_table /home/bartosz/esp-idf/components/perfmon /home/bartosz/esp-idf/components/protobuf-c /home/bartosz/esp-idf/examples/common_components/protocol_examples_common /home/bartosz/esp-idf/components/protocomm /home/bartosz/esp-idf/components/pthread /home/bartosz/esp-idf/components/sdmmc /home/bartosz/esp-idf/components/soc /home/bartosz/esp-idf/components/spi_flash /home/bartosz/esp-idf/components/spiffs /home/bartosz/esp-idf/components/tcp_transport /home/bartosz/esp-idf/components/tcpip_adapter /home/bartosz/esp-idf/components/tinyusb /home/bartosz/esp-idf/components/ulp /home/bartosz/esp-idf/components/unity /home/bartosz/esp-idf/components/vfs /home/bartosz/esp-idf/components/wear_levelling /home/bartosz/esp-idf/components/wifi_provisioning /home/bartosz/esp-idf/components/wpa_supplicant /home/bartosz/esp-idf/components/xtensa
  36. -- Configuring done
  37. ⚠️ CMake Error at /home/bartosz/esp-idf/components/mbedtls/mbedtls/library/CMakeLists.txt:149 (add_library):
  38.   Cannot find source file:
  39.  
  40.     /home/bartosz/esp-idf/components/mbedtls/port/esp_sha256.c
  41.  
  42.   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  43.   .hpp .hxx .in .txx
  44.  
  45.  
  46. -- Generating done
  47. ⚠️ CMake Generate step failed.  Build files cannot be regenerated correctly.
However my problem is solved by implementing HTTPS request from this examples:
https://github.com/espressif/esp-idf/bl ... _example.c

it is working without any problems :) .

Who is online

Users browsing this forum: Bing [Bot] and 227 guests