This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129ENCPDT: Connecting to mqtt server using http_cli library using ethernet

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: CC3100, EK-TM4C1294XL

Hi All,

I am using ti rtos and httpcli library with tm4c129encpdt using Ethernet

I am trying to connect to mqtt server (AWS IoT) using httpcli library over port no 8883

My raw code is -

typedef struct TLSDataParams {
  HTTPCli_Struct aws_cli;
  HTTPCli_Params aws_params;
  HTTPCli_Field aws_fields;
  struct sockaddr_in aws_addr;
  
  TLS_Params aws_tlsPar;
  TLS_Handle aws_tls;
   
} TLSDataParams; //////// tls parameters at one place



    ////////////// creating and connecting to server
   tlsDataParams->aws_fields.name = HTTPStd_FIELD_NAME_HOST;
   tlsDataParams->aws_fields.value ="xxxxxxxxxxxxxxx";



	HTTPCli_construct(&tlsDataParams->aws_cli);
	HTTPCli_setRequestFields(&tlsDataParams->aws_cli, (const HTTPCli_Field *)&tlsDataParams->aws_fields);
	TLS_Params_init(&tlsDataParams->aws_tlsPar);

 	tlsDataParams->aws_tlsPar.ca =  pRootCALocation ;  // certs to be done later akhilesh
	tlsDataParams->aws_tlsPar.calen = root_ca_pem_len;//sizeof(tlsParams->pRootCALocation );
	tlsDataParams->aws_tlsPar.cert = tpDeviceCertLocation;
	tlsDataParams->aws_tlsPar.certlen = client_cert_pem_len;//sizeof(tlsParams->pDeviceCertLocation);
	tlsDataParams->aws_tlsPar.key = pDevicePrivateKeyLocation;
	tlsDataParams->aws_tlsPar.keylen = client_private_key_pem_len;//sizeof(tlsParams->pDevicePrivateKeyLocation);


	tlsDataParams->aws_tls = TLS_create(TLS_METHOD_CLIENT_TLSV1_2, &tlsDataParams->aws_tlsPar, NULL);
	if(!tlsDataParams->aws_tls){

		ret = FAILURE;
                goto QUIT;

	}
	
	strcat(pDestinationURL, ":");  strcat(tlsParams->pDestinationURL, portStr);
	
        status = HTTPCli_initSockAddr((struct sockaddr *)&tlsDataParams->aws_addr, pDestinationURL, 0);
	if(status < 0)
	{
		int error = HTTPCli_getSocketError(&tlsDataParams->aws_cli);
		ret = error;
        goto QUIT;
	}
	
	HTTPCli_Params_init(&tlsDataParams->aws_params);
	tlsDataParams->aws_params.tls = tlsDataParams->aws_tls;
//	logStr(" url is %s", __FUNCTION__,tlsParams->pDestinationURL);
	
	status = HTTPCli_connect(&tlsDataParams->aws_cli, (struct sockaddr *)&tlsDataParams->aws_addr, 0, &tlsDataParams->aws_params);
	
	if(status < 0)
	{
		int error = HTTPCli_getSocketError(&tlsDataParams->aws_cli);
		ret = error;
        goto QUIT;
	}  /////////////// till here. I am getting status = 0;

     ///////sedning data to server

        bytes = HTTPCli_sendRequestBody(&tlsDataParams.aws_cli, ( char *)pMsg, len); // pmsg and len are valid fields
      /// here I am getting the value of bytes = -188

      if (bytes < 0 ) {
		error = HTTPCli_getSocketError(&pNetwork->tlsDataParams.aws_cli);
             /// the value of error is 0 despite getting bytes = -188

        IOT_ERROR("send failed (error = %d)\n", error);
    }

My main concern is here at while sending. I hope the connection is successful as I am not getting any error and return value is 0. 

bytes = HTTPCli_sendRequestBody(&tlsDataParams.aws_cli, ( char *)pMsg, len); // pmsg and len are valid fields
/// here I am getting the value of bytes = -188

if (bytes < 0 ) {
error = HTTPCli_getSocketError(&pNetwork->tlsDataParams.aws_cli);
/// the value of error is 0 despite getting bytes = -188

IOT_ERROR("send failed (error = %d)\n", error);
}

While sending, bytes = -188 and error = 0.

Why is it so? Can anyone help me in this?

Thanks

Akhi

  • Hi,

      I don't see you call HTTPCli_sendRequest() in your code before you call HTTPCli_sendRequestBody. Reference this post and add the HTTPCli_sendRequest to your code and  see if it makes a difference. If not, I will forward your question to our NDK experts. https://e2e.ti.com/support/microcontrollers/other/f/908/p/812332/3007598?tisearch=e2e-sitesearch&keymatch=HTTPCli_sendRequestBody#3007598

  • Hi Charles,

    I did not use it even for FTPS. It's not a get/post request so I am not using it. While using the same library in ftps, I did it in the same way and everything is working fine. I am attaching the raw code.

    PFA. I am using implicit ftps using the same method. Everything is working fine. Both in cc3100 and ethernet. 

    Thankstestftp.7z

  • Hi,

      You have been using &tlsDataParams->aws_cli as the handle in your code but for line 69 you use &pNetwork->tlsDataParams.aws_cli

    error = HTTPCli_getSocketError(&pNetwork->tlsDataParams.aws_cli);

      I'm not sure if this is the reason for your issue. 

  • Hi Charles, no that's not the error. I forgot to remove that. I should be -

    error = HTTPCli_getSocketError(&tlsDataParams.aws_cli);

    I simplified the code by removing some structures. 

    Thanks

  • Hi Charles,Can you explain this? I have got this from AWS developer guide.

    How to add starfield root ca to the trust store? 

    PFA

  • Hi Akhi,

    When using the HTTPCli library on the TM4C129ENCPDT, you would add the root certificate used to verify the server's certificate in your TLS_Params structure as the ca field. In your provided code, what is the value of pRootCALocation? Is it another root CA provided by Amazon?

    What is the value of pMsg in your first request sent to the server? I'm wondering if you are running into issues due to using the HTTP library for MQTT communication, such as messages not being formatted correctly, or possibly not initiating a connection correctly.

    Also, are you using woflSSL? If not, what are you using for the TLS implementation?

    Thanks,
    Brandon

  • Hi Brandon,

    pRootCALocation is the root ca from amazon. 

    The similar issue I was facing in cc3100 also but I updated the root ca with the starfield root ca from here-

    https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/

    and now I am able to connect, publish, and subscribe using cc3100 with httpcli library.

    But in ethernet, while connecting, my device is getting reset now. I don't know what is the reason. Previously reset was not happening but since I am using a new root ca, reset is happening. 

    I enabled the wolfssl logs also. Please check- 

    wolfSSL Entering WOLFSSL_CTX_new
    wolfSSL Entering wolfSSL_Init
    wolfSSL Entering wolfSSL_CertManagerNew
    wolfSSL Leaving WOLFSSL_CTX_new, return 0
    wolfSSL Entering wolfSSL_CTX_load_verify_buffer
    Adding a CA
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
        Parsed new CA
        Freeing Parsed CA
        Freeing der CA
            OK Freeing der CA
    wolfSSL Leaving AddCA, return 0
    wolfSSL Entering wolfSSL_CTX_use_certificate_buffer
    Checking cert signature type
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Not ECDSA cert signature
    wolfSSL Entering wolfSSL_CTX_use_PrivateKey_buffer
    wolfSSL Entering GetMyVersion
    wolfSSL Entering SSL_new
    wolfSSL Leaving SSL_new, return 0
    wolfSSL Entering SSL_set_fd
    wolfSSL Leaving SSL_set_fd, return 1
    wolfSSL Entering wolfSSL_send()
    wolfSSL Entering SSL_write()
    handshake not complete, trying to finish
    wolfSSL Entering wolfSSL_negotiate
    wolfSSL Entering SSL_connect()
    growing output buffer
    
    Shrinking output buffer
    
    connect state: CLIENT_HELLO_SENT
    growing input buffer
    
    received record layer msg
    wolfSSL Entering DoHandShakeMsg()
    wolfSSL Entering DoHandShakeMsgType
    processing server hello
    wolfSSL Entering VerifyClientSuite
    wolfSSL Leaving DoHandShakeMsgType(), return 0
    wolfSSL Leaving DoHandShakeMsg(), return 0
    More messages in record
    received record layer msg
    wolfSSL Entering DoHandShakeMsg()
    wolfSSL Entering DoHandShakeMsgType
    processing certificate
    Loading peer's cert chain
        Put another cert into chain
        Put another cert into chain
        Put another cert into chain
        Put another cert into chain
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    About to verify certificate signature
    Adding CA from chain
    Adding a CA
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
        Parsed new CA
        Freeing Parsed CA
        Freeing der CA
            OK Freeing der CA
    wolfSSL Leaving AddCA, return 0
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    About to verify certificate signature
    Adding CA from chain
    Adding a CA
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
        Parsed new CA
        Freeing Parsed CA
        Freeing der CA
            OK Freeing der CA
    wolfSSL Leaving AddCA, return 0
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    About to verify certificate signature
    Adding CA from chain
    Adding a CA
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
        Parsed new CA
        Freeing Parsed CA
        Freeing der CA
            OK Freeing der CA
    wolfSSL Leaving AddCA, return 0
    Verifying Peer's cert
    wolfSSL Entering GetExplicitVersion
    wolfSSL Entering GetMyVersion
    Got Cert Header
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Algo ID
    Getting Cert Name
    Getting Cert Name
    Got Subject Name
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    Got Key
    Parsed Past Key
    wolfSSL Entering DecodeCertExtensions
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeSubjKeyId
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAltNames
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeExtKeyUsage
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeCrlDist
    wolfSSL Entering GetObjectId()
    Certificate Policy extension not supported yet.
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeAuthInfo
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetObjectId()
    wolfSSL Entering DecodeBasicCaConstraint
    wolfSSL Entering GetObjectId()
    wolfSSL Entering GetAlgoId
    wolfSSL Entering GetObjectId()
    About to verify certificate signature
    Verified Peer's cert
    wolfSSL Leaving DoHandShakeMsgType(), return 0
    wolfSSL Leaving DoHandShakeMsg(), return 0
    More messages in record
    received record layer msg
    wolfSSL Entering DoHandShakeMsg()
    wolfSSL Entering DoHandShakeMsgType
    processing server key exchange
    wolfSSL Leaving DoHandShakeMsgType(), return 0
    wolfSSL Leaving DoHandShakeMsg(), return 0
    More messages in record
    received record layer msg
    wolfSSL Entering DoHandShakeMsg()
    wolfSSL Entering DoHandShakeMsgType
    processing certificate request
    wolfSSL Leaving DoHandShakeMsgType(), return 0
    wolfSSL Leaving DoHandShakeMsg(), return 0
    More messages in record
    received record layer msg
    wolfSSL Entering DoHandShakeMsg()
    wolfSSL Entering DoHandShakeMsgType
    
    381396:Starting Main // device resets

    This time the reset happens while sending the data. 

    Let me know.

    Thanks

    Akhilesh

  • Hi,

    So, the resets began when starting to use a different root CA? It's possible that the new root CA is no longer valid. Why did you switch root CAs, and why can you not use the previous one that worked?

    Since they're used for verifying the server, I would think that as long as they are not expired, they are good to use.

    Best,
    Brandon

  • Hi Brandon,

    Actually, this is the correct root ca. Previously I was getting the error while sending but maybe the handshake was happening while sending like here. 

    This root ca is working correct with cc3100 using the same httpcli library.

    Thanks

  • Hi Akhi,

    The httpsget example in the Tiva SDK has an example startNTP() function. Could you try adding this function and call it before calling TLS_Params_init()? Please let me know. I'm sorry I can't test this myself as I don't have the right equipment at this time.

    Brandon

  • Hi Brandon, Already I am using https without any issues with httpcli library and wolfssl. This issue is coming in this case only.

    Thanks

  • Hi Akhi,

    Are you saying that you do not call startNTP() in your working https case?

    Can you provide more details on the error returned from HTTPCli_sendRequestBody? Where does it originate?

    Thanks,
    Brandon

  • Hi Brandon,

    Yes. I never used startNTP for the https.

    Previously, HTTPClient Request Body was returning-188 and it was due to wrong certificate, during handshake.

    Now that I am using the right root ca, i am getting reset that also during handshake. I have posted the wolfssl logs also

    When using cc3100, everything is working fine with the same libraries but ethernet uses wolfssl and cx3100 uses sl APIS.

    I am using ethernet

    Thanks

  • Okay -

    I will keep looking into this however I can, but I would suggest that you contact WolfSSL for support in debugging this further, since the issue seems to be occurring at the SSL level.

    Best,
    Brandon

  • Hi Brandon,

    I checked few more things and found out that AES is not working.

    wolfcrypt_test(&args) -> aes_test() -> wc_AesCbcEncrypt -> AesAlign16 -> ROM_AESDataProcess

    AES is not working.

    It goes into some hard loop when it calls ROM_AESDataProcess().

    Do you have any idea why ROM_AESDataProcess() resets the device?

    Thanks

  • Hi,

      I wonder if you enable the CCM0 module and configure the AES properly. Did you call SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0) before you use AESDataProcess()?

    Below is an example for AESDataProcess in the peripheral driver user's guide. You can also find example in <TivaWare_Installation>/eamples/boards/ek-tm4c1294xl/aes_example.c. 

    //
    // Random data for encryption/decryption.
    //
    uint32_t g_ui32AESPlainText[16] =
    {
    0xe2bec16b, 0x969f402e, 0x117e3de9, 0x2a179373,
    0x578a2dae, 0x9cac031e, 0xac6fb79e, 0x518eaf45,
    0x461cc830, 0x11e45ca3, 0x19c1fbe5, 0xef520a1a,
    0x45249ff6, 0x179b4fdf, 0x7b412bad, 0x10376ce6
    };
    //
    // Encryption key
    //
    uint32_t g_ui32AES128Key[4] =
    {
    0x16157e2b, 0xa6d2ae28, 0x8815f7ab, 0x3c4fcf09
    };
    //
    // Initial value for CBC mode.
    //
    uint32_t g_ui32AESIV[4] =
    {
    0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c
    };
    int
    main(void)
    {
    uint32_t pui32CipherText[16];
    //
    // Enable the CCM module.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
    //
    // Wait for the CCM module to be ready.
    //
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
    {
    }
    //
    // Reset the AES module before use.
    //
    AESReset(AES_BASE);
    //
    // Configure the AES module.
    //
    AESConfigSet(AES_BASE,
    AES_CFG_DIR_ENCRYPT |
    AES_CFG_MODE_CBC |
    AES_CFG_KEY_SIZE_128BIT);
    
    //
    // Set the initial value.
    //
    AESIVSet(AES_BASE, g_ui32AESIV);
    //
    // Set the encryption key.
    //
    AESKey1Set(AES_BASE, g_ui32AES128Key);
    //
    // Encrypt the data.
    //
    // The ciphertext should be:
    // {0xacab4976, 0x46b21981, 0x9b8ee9ce, 0x7d19e912,
    // 0x9bcb8650, 0xee197250, 0x3a11db95, 0xb2787691,
    // 0xb8d6be73, 0x3b74c1e3, 0x9ee61671, 0x16952222,
    // 0xa1caf13f, 0x09ac1f68, 0x30ca0e12, 0xa7e18675}
    //
    AESDataProcess(AES_BASE, g_ui32AESPlainText, pui32CipherText, 64);
    }

  • Hi Charles, 

    I am just using wolfssl functions. They might have done every setting. As https is already working with a minor difference -

    In https, I am using the only root ca, hence doing only server verification.

    In mqtt, I am using client private key, client certificate and root ca also, hence server as well as client verification. 

    I never faced the reset in the HTTPS handshake. 

    Is this something related to it? Because, in https, I don't get any reset.

    Can it be a memory issue? Though I can't see anything printing on console. My memory consumption of ram is about 98% after compiling the project which included 90KB of the heap and enough stack for all tasks. 

    Thanks,

    Akhi

  • Hi,

      As you pointed out you may have a memory issue. If you are 98% after compiling then I wonder if you have a overflow on stack or segmentation issue on the heap during runtime. I'm not a TI-RTOS expert but I think you can use the ROV to further debug the problem. You might want to single step you code when doing the AES and find out what caused the fault. 

  • Hi Charles,

    It's not memory related issue. I tested on some test project where I have 83% usage and there also I am getting reset and https is working fine as usual.

    I don't know what is happening.

    Thanks
    Akhi

  • What do you mean by reset? Do you really mean the entire device is reset or you are getting some hard faults? These two events are different? If it is a reset then can you tell what is the cause of the reset by reading RESC register. See below.

    If you are only getting faults then refer to the below app note and video training on how to debug the fault. 

    https://www.ti.com/lit/an/spma043/spma043.pdf?ts=1593778834871&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTM4C129XNCZAD

    I have no experience at all with wolfssl. I will suggest you also contact them for assistance.