Infineon / amazon-freertos

IoT operating system for microcontrollers. https://aws.amazon.com/freertos/
MIT License
10 stars 10 forks source link

How to resolve TLS_HANDSHAKE 0x7780 in XMC4800 IoT Connectivity Kit demo ? #8

Closed Darsh-Dev closed 4 years ago

Darsh-Dev commented 4 years ago

Hi, I am using XMC4800 IoT Connectivity Kit as mentioned here. I am using trust-m secure element to proceed and for that i have followed Option #2: Onboard Private Key Generation from this link.

After doing this above configurations i run the demo, but unfortunate i am getting error below error.

Wi-Fi module initialized. Connecting to AP... .1 7961 [Tmr Svc] Wi-Fi Connected to AP. Creating tasks that use network... 2 7973 [Tmr Svc] IP Address acquired 192.168.43.197 3 8203 [iot_thread] [INFO ][DEMO][8203] ---------STARTING DEMO--------- 4 8205 [iot_thread] [INFO ][INIT][8205] SDK successfully initialized. .5 13234 [iot_thread] [INFO ][DEMO][13234] Successfully initialized the demo. Network type for the demo: 1 6 13234 [iot_thread] [INFO ][MQTT][13234] MQTT library successfully initialized. 7 13234 [iot_thread] [INFO ][DEMO][13234] MQTT demo client identifier is LTE_Thing (length 9). .8 16064 [iot_thread] ERROR: Handshake failed with error code -30592 9 16066 [iot_thread] [ERROR][NET][16066] Failed to establish a new connection. Socket status: -1002. 10 16066 [iot_thread] [ERROR][MQTT][16066] Failed to establish new MQTT connection, error NETWORK ERROR. 11 16066 [iot_thread] [ERROR][DEMO][16066] MQTT CONNECT returned error NETWORK ERROR. 12 16066 [iot_thread] [INFO ][MQTT][16066] MQTT library cleanup done. 13 16066 [iot_thread] [ERROR][DEMO][16066] Error running the demo. 14 16075 [iot_thread] [INFO ][INIT][16075] SDK cleanup done. 15 16075 [iot_thread] [INFO ][DEMO][16075] -------DEMO FINISHED-------

I did enable MBEDTLS_DEBUG_C to level 4 and got attached log , this seems error from AWS server while TLS handshake process.

Infineon_Mbedtls_Log.txt .

So is there anything i m missing here ?

Thanks.

ayushev commented 4 years ago

hi @Darsh-Dev

it seems like a TLS server fatal alert. can you please enable mbedtls logs by enabling the MBEDTLS_DEBUG_C macro in the mbedtls config file and if it's required reducing the verbocity level here from 4 to 3 or even 2. A reason why logging crashes is that you didn't provide enough memory to the logging task

Darsh-Dev commented 4 years ago

Hi, I have not changed anything in the provided demo in the link other then provisioning related certification and my credentials changes as per this link. logging task's memory is also not tweaked , it is as it is in the demo.

I have also attached the logs by enabling MBEDTLS_DEBUG_C (to level 4) macro in above query.

Thanks

Darsh-Dev commented 4 years ago

Hi @ayushev,

I am porting optiga trust-m in custom hardware and i have taken reference of this kit for my development, but before trying on my custom hardware, i want to make sure that it works with the XMC4800 kit without any modifications.

Thanks

ayushev commented 4 years ago

@Darsh-Dev sorry, I saw at first only the logsnippet you have attached, not the file itself. Unfortunately the log doesn't show the details of the corruption. COuld you please try to reduce the Verbocity level from 4 to 3 or 2? The log should show more or less the whole handsare from the beggining till the end, dump of the data isn't required here.

Darsh-Dev commented 4 years ago

@ayushev

Resolved the issue. Looks like private key was generated two times and we were trying with older private key and its certs. Now, we are moving on our custom board and taking the XMC4800 code as reference.

Thanks for support.

ayushev commented 4 years ago

Hi @Darsh-Dev

just combining the answer to you, and had to remove everything. I duplicated the setup once again. Also wanted to mention that the private key might change, as the certificate isn't locked.

I'm glad that it works