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 Sign Counter Changed flag

I am trying not be a Gilda Radnor discussing the plight of Soviet Jewelry, but there is a critical and almost totally undocumented flag that appears early in the Simplelink sample applications.

GAP_EVENT_SIGN_COUNTER_CHANGED.

If this is not counting signs passed in the mall, or tracking the positive or negative values encountered in a message, could it possibly be something to do with the   device SIGNature?  [if it does, I found that only by noticing a reference to IRK and CSRK somewhere, then reading around in that topic]  And if so, why is it important to know how many times it has changed?  Does the device signature change frequently?

To the job of searching through the dozens of TI documents that may contain an answer: has anyone written a lookup document (sometimes called a Help file) that you can press an F1 key in CCS or IAR on an item, and find out an explanation of the thing, along with some sort of class heirarchy that indicates where it originates? And importantly, a date when the explanation was written... Using Find And Replace ==> Find In Files,  or using Grep to search through the entire TI folder really takes time.  Or keeping a dozen TI documents open, and searching through them one by one takes hours out of the day.  Many things seem to be partially explained, with that explanation spread loosely across multiple documents.

  • Hi,

    Your interpretation is correct. The sign counter is used as part of the CSRK. This is used for signed data exchange over BLE. Data signing allows for devices in an unencrypted connection to exchange authenticated data.

    "And if so, why is it important to know how many times it has changed?"
    The application may decide to store the sign counter to NV for future connections

    "Does the device signature change frequently?"
    Yes, it increments for each new data PDU sent.

    All of the above information comes from the Bluetooth Specification Version 4.1 [Vol 3] section 10.4, I recommend becoming a SIG member if possible so that you may reference the spec documents. However, I certainly understand your confusion considering the lack of comments on this specific event. I hope this clears it up
  • In general, you should start with the software developer's guide included with the installer which will point you to other documents when needed.

    The event is defined in the SDG as:

    If you do not know what signing is, you must go to the spec (Volume 1, Section 5.4.2):

    "Bluetooth LE supports the ability to send authenticated data over an unencrypted ATT bearer between two devices with a trusted relationship. This is
    accomplished by signing the data with a Connection Signature Resolving Key (CSRK). The sending devices places a signature after the Data PDU. The receiving verifies the signature and if the signature is verified the Data PDU is assumed to come from the trusted source. The signature is composed of a Message Authentication Code generated by the signing algorithm and a counter. The counter is used to protect against a replay attack and is incremented on each signed Data PDU sent."

    There is nothing that you, as the application, need to do in regards to the signcounter as it is managed by the stack. If desired, you can set / get its value using the GAPROLE_SIGNCOUNTER parameter, as stated in the "Configurable Parameters" section of the central or peripheral GAP Role Appendix in the software developer's guide.

  • Sean,
    Thanks for your specificity here. So SIGN_COUNTER is actually SIGNATURE_COUNTER, part of the CSRK, and is incremented each time new PDU data is sent, in accord with the Bluetooth Spec Version 1 Volume 3 Section 10.4. It is not important to know how many times it has changed, but the most recent value should be saved, then used to initiate a future connection with another device. And storing it is important, as it is apparently required when that future connection is made. (This last is reading between the lines. If not required, then it is optional and not necessary to save it, right?) (Gilda Radnor speaking, btw)
    Thanks again!
  • Tim,
    Thanks for the pointer to the spec (Volume 1). I intend to study that in depth prior to any further work with the sample applications. Of course, when I went to the Bluetooth website and searched for "Volume 1" the search tool was unable to find it. So are you referring to "Bluetooth Core Specification, version 1.0 volume 1" or "B-C-S Version 4.0 Volume 1" or is it Version 4.2 ? ... can you be more specific so I can find the document you are referring to?

    Nope, for the first hour or so of searching, I truly did not guess that GAP_EVENT_SIGN_COUNTER_CHANGED, which was defined as "The device level sign counter changed", had anything to do with message signatures. I spent the time searching for variations of "device level sign", being some kind of arcane indicator that some devices were level, some were tilted --- or some were higher or lower in priority than others. Sort of like either a tiltometer on a transport vessel or levels of the Hindu caste system. Obviously, sometimes the device changes levels, and it is important to count those change events and to know when the count changes.

    And yes, I did find the GAPROLE_SIGNCOUNTER parameter, but again the documentation did not suggest it had any purpose. I should have googled for "signing algorithm and a counter" and then I would have found what was involved.

    Luckily, now when we search for this flag on the Forum, these discussions will appear.
    Is it fair to say "the device level sign counter changed" should have read "the message signature counter changed" ?
    And if so, is there a central repository team manager who can make the change once in the code?

    This is one of those times it helps to already be an expert to begin learning the various tools.
    Just kidding ! (sort of) --- this is clearly a massive package of more-or-less related code blocks developed over decades by developers following different standards, speaking different languages, all across the world. And it works --- which is all that matters, in the end.

    Keep on trucking, and thanks for the support --- I mean that, truly.
  • Hello. I was looking at the 4.0 spec but it really depends on what stack you are using. CC254x devices implement BT 4.0. CC264x implements BT 4.1 (for now)...BT 4.2 will be in the next release.