aws / aws-iot-device-sdk-embedded-C

SDK for connecting to AWS IoT from a device using embedded C.
MIT License
977 stars 628 forks source link

SSL_connect failed to perform TLS handshake #1904

Closed zhangshouyin closed 6 months ago

zhangshouyin commented 6 months ago

我使用同一套openssl-1.1.1c 库在PC上用GCC编译的可执行文件是正常握手的,但是用mips-linux-gnu-gcc编译的无法握手。

报错信息如下: [root@Zeratul:mnt]# ./mqtt_demo_mutual_auth [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [WARN] [DEMO] [mqtt_demo_mutual_auth.c:736] Connection to the broker failed. Retrying connection after 297 ms backoff. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [WARN] [DEMO] [mqtt_demo_mutual_auth.c:736] Connection to the broker failed. Retrying connection after 116 ms backoff. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [WARN] [DEMO] [mqtt_demo_mutual_auth.c:736] Connection to the broker failed. Retrying connection after 447 ms backoff. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [WARN] [DEMO] [mqtt_demo_mutual_auth.c:736] Connection to the broker failed. Retrying connection after 1519 ms backoff. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [WARN] [DEMO] [mqtt_demo_mutual_auth.c:736] Connection to the broker failed. Retrying connection after 2678 ms backoff. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:698] Establishing a TLS session to a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com:8883. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:280] SSL_connect failed to perform TLS handshake. [ERROR] [Transport_OpenSSL_Sockets] [openssl_posix.c:696] Failed to establish a TLS connection. [ERROR] [DEMO] [mqtt_demo_mutual_auth.c:729] Connection to the broker failed, all attempts exhausted. [ERROR] [DEMO] [mqtt_demo_mutual_auth.c:1693] Failed to connect to MQTT broker a23fsanx68b359-ats.iot.ap-northeast-1.amazonaws.com. [INFO] [DEMO] [mqtt_demo_mutual_auth.c:1736] Short delay before starting the next iteration....

在T3 平台上运行可执行程序TLS握手失败!OpenSSL和操作系统平台环境有关系吗? 我怀疑是不是编译选项参数设置不正确的问题?针对mips-linux-gnu-gcc如何设置呢?

ActoryOu commented 6 months ago

Hi @zhangshouyin, Thank you for reaching out. To better analyze the issue, I kindly request that you share the pcap file captured by Wireshark or any similar tools, along with any error codes or messages encountered. Additional information would be helpful in providing a more thorough analysis. If there is any concern providing pcap file, feel free to send me an email with attachment.

Thank you.

[Chinese Version] 歡迎來到FreeRTOS社群 目前您提供的資訊似乎不太足夠, 目前僅能得知TLS的握手失敗 如果可能的話, 請幫忙提供遊wireshark或類似工具抓取的pcap網路封包檔案, 您測試使用的平台, 以及openssl return的錯誤代碼 若對於公開提供pcap有顧慮, 歡迎寄信到我的信箱

感謝感謝

ActoryOu commented 6 months ago

One common configuration I might need your help to check is endianness. Could you help check if the endianness configuration in openssl is same as your platform?

Thank you.

[Chinese Version] 一個常見的設定是endianness(位元組順序), 可以的話請幫忙檢查openssl的設定是否與您測試的平台相符

感謝感謝

ActoryOu commented 6 months ago

Closing issue for now since long time no response. Feel free to reopen it if you have any new information to share.

Thank you.

zhangshouyin commented 6 months ago

你好@zhangshouyin, 感谢您伸出援手。为了更好地分析问题,我恳请您分享由 Wireshark 或任何类似工具捕获的 pcap 文件,以及遇到的任何错误代码或消息。附加信息将有助于提供更彻底的分析。如果对提供 pcap 文件有任何疑问,请随时向我发送带有附件的电子邮件。

谢谢。

[中文版] 欢迎来到FreeRTOS社区 目前您提供的信息似乎还不够,目前只能知道TLS的握手失败 如果可能的话,请帮忙提供游wireshark或类似工具摘录的pcap网路封包文件,您测试使用的平台,以及openssl返回的错误代码 若对于公开提供pcap有顾虑,欢迎发送邮件到我的信箱

谢谢谢谢

Hi @ActoryOu 感谢您伸出援手,这个问题已经解决。是我的在编译库的时候编译选项没有选对。 感谢您伸出援手