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.

CC2564MODA: BLE : Request Encryption refresh

Part Number: CC2564MODA
Other Parts Discussed in Thread: TM4C123GH6PM

Hello TI Team,

I'm working on the BLE pairing process of my application (using Bluetopia stack) and for now, all is working great. Here is my connection / Pairing process :

  1. Mobile central connect to my device.
  2. When Mobile read/write a characteristic, we initiaite the bonding process (pairable mode : EnableSecureSimplePairing) and store the IRK (Like this we can indentify a device LE address as resolvable)
  3. When I reach the maximum number of IRK I can store, I delete the oldest one and replace it by the new one.

The problem is that the mobile device request the LTK even if i don't have have the bonded information on my side (That is kind of problematic in my application).

So I wanted to know if there is any way to warn the connected device that I want to refresh the encryption and restart the bonding process again ? Apparently Android and IOS can't delete bonded information of a device through application (or it's deprecated). 

I already tried to respond with a negative response to latLongTermKeyRequest event or to call GAP_LE_Request_Security but none of these are working. I'm kinf of blocked here....

Thanks in advance !

  • humm.. Once, you the device responds with a negative reply for LTK, the peers should re negotiate and re-bond.. Can, you take FW logs? Which Host MCU/processor are you using?

    Thanks
  • Hello Hari ! 

    Thanks for your quick reaction I apprecate =) 

    I'm working with a TM4C123GH6PM.

    I printed you the log in two different use case (we are still in the same configuration -> No bonded information on the device and Bonded information on the mobile side).


    First case :

    When I detect that we don't have bonded information but that the mobile request the LTK (latLongTermKeyRequest event), I return : 

    GAP_LE_Authentication_Response_Information.GAP_LE_Authentication_Type = larLongTermKey;
    GAP_LE_Authentication_Response_Information.Authentication_Data_Length = 0;
    GAP_LE_Authentication_Response(BluetoothStackID, Authentication_Event_Data->BD_ADDR, &GAP_LE_Authentication_Response_Information);

    L
    OG

    GAP_LE_Event_Callback : 2

    etLE_Connection_Complete with size 16.
    Status: 0x00.
    Role: Slave.
    Address Type: Random.
    Resolvable address : 0 / Index :0

    GATT Callback Data: Event_Data = NULL.
    GAP_LE_Event_Callback : 6
    GAPLE_Authentication : 0
    latKeyRequest:
    No Bonded information for connected device
    GAP_LE_Event_Callback : 3

    etLE_Disconnection_Complete with size 9.
    Disconneciton reason : 0x6
    GAP_LE_Advertising_Enable success.
    Conection update status : -1
    Ask for a connection interval max : 30

     

    Here the mobile get disconnected instantly.


    Second case

    When mobile request the LTK, I generate it and send it in any case (Bonded information or not) with the following code : 

    GAP_LE_Regenerate_Long_Term_Key(BluetoothStackID, (Encryption_Key_t *)(&DHK), (Encryption_Key_t *)(&ER), Authentication_Event_Data->Authentication_Event_Data.Long_Term_Key_Request.EDIV, &(Authentication_Event_Data->Authentication_Event_Data.Long_Term_Key_Request.Rand), &GeneratedLTK);
    
    /* Respond with the Re-Generated Long Term Key. */
    GAP_LE_Authentication_Response_Information.GAP_LE_Authentication_Type                                        = larLongTermKey;
    GAP_LE_Authentication_Response_Information.Authentication_Data_Length                                        = GAP_LE_LONG_TERM_KEY_INFORMATION_DATA_SIZE;
    GAP_LE_Authentication_Response_Information.Authentication_Data.Long_Term_Key_Information.Encryption_Key_Size = GAP_LE_MAXIMUM_ENCRYPTION_KEY_SIZE;
    GAP_LE_Authentication_Response_Information.Authentication_Data.Long_Term_Key_Information.Long_Term_Key       = GeneratedLTK;
    
    GAP_LE_Authentication_Response(BluetoothStackID, Authentication_Event_Data->BD_ADDR, &GAP_LE_Authentication_Response_Information);

    LOG

    GAP_LE_Event_Callback : 2

    etLE_Connection_Complete with size 16.
    Status: 0x00.
    Role: Slave.
    Address Type: Random.
    Resolvable address : 0 / Index :0

    GATT Callback Data: Event_Data = NULL.
    GAP_LE_Event_Callback : 6
    GAPLE_Authentication : 0
    latKeyRequest:
    GAP_LE_Regenerate_Long_Term_Key Success.
    GAP_LE_Event_Callback : 4

    etLE_Encryption_Change with size 8.
    Conection update status : 0
    Ask for a connection interval max : 30
    GAP_LE_Event_Callback : 8
    GAP_LE_Event_Callback : 9

    etLE_Connection_Parameter_Updated with size 14.
    Connection Interval: 30.
    Slave Latency: 0.
    Supervision Timeout: 5000.

    Here we are connected to the mobile device but still don't have the bonded information.

    Hope it will help...

    Thanks.

  • Taking FW logs, would help us to understand, why it is failing.. For taking FW logs, please check here:
    processors.wiki.ti.com/.../CC256x_Logger_User_Guide

    Thanks
  • Did, you manage to take the Fw logs? Or is the issue resolved?