Hello.
CKSN - Ciphering Key Sequence Number is associated with Kc and is a bit trickier than trivial counter.
According to GSM 04.08 (p. 278 in v5.3.0 in my case) it's comprised as follows: * 3 bits - actual key sequence (value 111 seems to be reserved) * 1 bit - always 0 * 3 bits - CKSN IEI
Could you help me to understand how to properly generate it: - the last bit (8th) is not specified - does it mean it's always 0? - what is CKSN IEI and how do I calculate\use it? - am I right that 3-bit key seq. value is simple counter that I increment with each Kc generation? - what do I do when key seq. reach 6 - start over with 0 again?
And of course I'm interested if CKSN-related code is available as part of libosmogsm or some other open source project: the code is always helpful in understanding and I don't have to reinvent the wheel :)
best regards, Max.
CKSN - Ciphering Key Sequence Number is associated with Kc and is a bit trickier than trivial counter.
No it's not ... it's really just a counter. Just with 1 bit fixed to 0 and a a reserved value.
7 is reserved as "invalid". When the MS sends that, it means it has no Kc whatsoever to re-use.
- what is CKSN IEI and how do I calculate\use it?
It's nothing. Really. For whatever reason when they describe an IE they add this "IEI" field which is nothing but documentation. Don't worry about it, just consider it's not there and the CKSN is 4 bits only.
- am I right that 3-bit key seq. value is simple counter that I increment with each
Kc generation?
- what do I do when key seq. reach 6 - start over with 0 again?
Sure. But you can actually count in any way you'd like. The only requirement is that you don't reuse the one sent by the phone and you don't use 7.
And of course I'm interested if CKSN-related code is available as part of libosmogsm or some other open source project: the code is always helpful in understanding and I don't have to reinvent the wheel :)
OpenBSC handles the key_seq in the authentication procedure. But there is really nothing to it.
Cheers,
Sylvain
Max,
On Fri, Apr 20, 2012 at 19:09, Max Max.Suraev@fairwaves.ru wrote:
- what is CKSN IEI and how do I calculate\use it?
IEI is a Information Element Identifier, which is a part of TLV-coded (Type-Length-Value) Information Elements (IEs). In other words, IEI represents type (T) of the data payload which follows it. TLV is an encoding used in most of the classical GSM protocols. I don't recall where it is described in the Standard, but here is a nice paper which you easily find on Google which describes ciphering and described TLV structure as well (section 6.1.2): http://www.cs.ru.nl/~fabianbr/scriptie.pdf
On Fri, Apr 20, 2012 at 19:33, Alexander Chemeris alexander.chemeris@gmail.com wrote:
Max,
On Fri, Apr 20, 2012 at 19:09, Max Max.Suraev@fairwaves.ru wrote:
- what is CKSN IEI and how do I calculate\use it?
IEI is a Information Element Identifier, which is a part of TLV-coded (Type-Length-Value) Information Elements (IEs). In other words, IEI represents type (T) of the data payload which follows it. TLV is an encoding used in most of the classical GSM protocols. I don't recall where it is described in the Standard, but here is a nice paper which you easily find on Google which describes ciphering and described TLV structure as well (section 6.1.2): http://www.cs.ru.nl/~fabianbr/scriptie.pdf
But as Sylvain mentioned, in almost all cases CKSN is sent as "V" IE, so no IEI is needed. The only place where you seem to need CKSN IEI is in GPRS Mobility Management Messages "Authentication and ciphering request" (section 9.4.9), where it CKSN is sent as "TV" IE. And there in the table left column you see the IEI value "8-", meaning that it's "8-in-the-MSB".
baseband-devel@lists.osmocom.org