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.

SIMPLELINK-CC2640R2-SDK: v4.10: Simple Peripheral re-enable advertising code?

Part Number: SIMPLELINK-CC2640R2-SDK

Hi,

What is the purpose re-enabling the advertising at GAPROLE_WAITING? When you comment it out it still advertises. I have posted this before for SDK 3.40. You make these code changes but don't test properly if its effective or not. I am porting firmware to SDKv4.10. Since this code has no purpose I have to delete it and revert to same implementation as SDKv3.30 

    case GAPROLE_WAITING:


      {
        uint8_t advertReEnable = TRUE;


        Util_stopClock(&periodicClock);
        attRsp_freeAttRsp(bleNotConnected);

        // Clear remaining lines
        Display_clearLines(dispHandle, 3, 5);
        
        GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &advertReEnable);
        Display_print0(dispHandle, 2, 0, "Advertising");
      }
      break;

-kel

  • Hey Markel,

    It's actual a fix for the invalid connection request PDU vulnerability that was reported as a part of SweynTooth. You can find more details at ti.com/PSIRT.

  • Hi Evan,

    If you say so, then I would just have to believe it. I will find out if this additional code is really relevant after undergoing very rigorous regression test, which I don't have time at the moment.

    Just an advice, to whoever implemented this do your work properly so it is believable. Here are my current code comments about this.

        case GAPROLE_STARTED:
          {
            uint8_t ownAddress[B_ADDR_LEN];
            uint8_t systemId[DEVINFO_SYSTEM_ID_LEN];
    
            GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
    
            // use 6 bytes of device address for 8 bytes of system ID value
            systemId[0] = ownAddress[0];
            systemId[1] = ownAddress[1];
            systemId[2] = ownAddress[2];
    
            // set middle bytes to zero
            systemId[4] = 0x00;
            systemId[3] = 0x00;
    
            // shift three bytes up
            systemId[7] = ownAddress[5];
            systemId[6] = ownAddress[4];
            systemId[5] = ownAddress[3];
    
            DevInfo_SetParameter(DEVINFO_SYSTEM_ID, DEVINFO_SYSTEM_ID_LEN, systemId);
    
            // Display device address
            Display_print0(dispHandle, 1, 0, Util_convertBdAddr2Str(ownAddress));
            Display_print0(dispHandle, 2, 0, "Initialized");
    
            // Device starts advertising upon initialization of GAP
            uint8_t initialAdvertEnable = TRUE;  // PERSONAL EXPERIMENT
            // Set the Peripheral GAPRole Parameters
            GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), // PERSONAL EXPERIMENT
                             &initialAdvertEnable);
          }
          break;
        case GAPROLE_WAITING:
          {
            uint8_t advertReEnable = TRUE; // PERSONAL EXPERIMENT
    
            Util_stopClock(&periodicClock);
            attRsp_freeAttRsp(bleNotConnected);
                                           // NO DISPLAY PRINT OF "Disconnected"
            // Clear remaining lines
            Display_clearLines(dispHandle, 3, 5);
            
            GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &advertReEnable); // PERSONAL EXPERIMENT
            Display_print0(dispHandle, 2, 0, "Advertising"); // REDUNDANT CODE at GAPROLE_ADVERTISING
          }
          break;

    -kel

  • Hey Markel,

    Wasn't able to post the direct link as I was on my phone earlier. Here is the link to the PSIRT. 

    https://www.ti.com/lit/an/swra676/swra676.pdf?ts=1594255071937

  • Hi Evan,

    Thanks for the link.

    The problem at my side is I have to explain this to other people.

    -kel