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