Search code examples
camazon-web-servicesdemo

AWS IoT embedded C SDK - fleet provisiong demo times out when doing TLS handshake


I'm trying to use AWS IoT embedded C SDK.
After compiling, every demo works just fine, except for the fleet_provisioning demo.

SDK version used: 202108.00

logs:

[INFO] [PKCS11] [core_pkcs11_mbedtls.c:1403] PKCS #11 successfully initialized.
[INFO] [PKCS11] [core_pkcs11_mbedtls.c:2823] Creating a 0x3 type object.
[INFO] [PKCS11] [core_pkcs11_pal.c:63] Could not open corePKCS11_Claim_Certificate.dat for reading.
[INFO] [FLEET_PROVISIONING_DEMO] [pkcs11_operations.c:770] Writing certificate into label "Claim Cert".
[INFO] [PKCS11] [core_pkcs11_mbedtls.c:2823] Creating a 0x1 type object.
[INFO] [FLEET_PROVISIONING_DEMO] [fleet_provisioning_with_csr_demo.c:517] Establishing MQTT session with claim certificate...
[DEBUG] [FLEET_PROVISIONING_DEMO] [mqtt_operations.c:399] Establishing a TLS session to <AWS_IOT_ENDPOINT>:8883.
[ERROR] [Transport_MbedTLS_PKCS11] [mbedtls_pkcs11_posix.c:826] Failed to perform TLS handshake: mbedTLSError= SSL - The operation timed out : .

Online I've found only issues linked to authorization and policies.
I have double checked certificates, provisioning and attached policies. This part seems to work but on TLS handshake it returns a timeout.

in debug mode the mbedtlsError returned is -26624.


Solution

  • So after many days of struggle, with no answers.. oh, I'm so lonely here 😩️ Yeah probably no one will read this.

    Anyway I've increased the size of this definitions in configs file:

    #define NETWORK_BUFFER_SIZE 
    #define TRANSPORT_SEND_RECV_TIMEOUT_MS
    

    and the fleet_provisioning demo works perfectly.