osmo-gmr 0.2.104-2b98
Osmocom GMR-1
A5 ciphering algorithm

Files

file  a5.h
 Osmocom GMR-1 A5 ciphering algorithm header.
 
file  a5.c
 Osmocom GMR-1 A5 ciphering algorithm implementation.
 

Macros

#define A51_R1_LEN   19
 
#define A51_R2_LEN   22
 
#define A51_R3_LEN   23
 
#define A51_R4_LEN   17
 
#define A51_R1_MASK   ((1<<A51_R1_LEN)-1)
 
#define A51_R2_MASK   ((1<<A51_R2_LEN)-1)
 
#define A51_R3_MASK   ((1<<A51_R3_LEN)-1)
 
#define A51_R4_MASK   ((1<<A51_R4_LEN)-1)
 
#define A51_R1_TAPS   0x072000 /* x^19 + x^18 + x^17 + x^14 + 1 */
 
#define A51_R2_TAPS   0x311000 /* x^22 + x^21 + x^17 + x^13 + 1 */
 
#define A51_R3_TAPS   0x660000 /* x^23 + x^22 + x^19 + x^18 + 1 */
 
#define A51_R4_TAPS   0x013100 /* x^17 + x^14 + x^13 + x^9 + 1 */
 
#define A51_BIT(r, n)   (1 << n)
 

Functions

void gmr1_a5 (int n, uint8_t *key, uint32_t fn, int nbits, ubit_t *dl, ubit_t *ul)
 Main method to generate a A5/x cipher stream. More...
 
void gmr1_a5_1 (uint8_t *key, uint32_t fn, int nbits, ubit_t *dl, ubit_t *ul)
 Generate a GMR-1 A5/1 cipher stream. More...
 

Detailed Description

Function Documentation

◆ gmr1_a5()

void gmr1_a5 ( int  n,
uint8_t *  key,
uint32_t  fn,
int  nbits,
ubit_t *  dl,
ubit_t *  ul 
)

Main method to generate a A5/x cipher stream.

Parameters
[in]nWhich A5/x method to use
[in]key8 byte array for the key (as received from the SIM)
[in]fnFrame number
[in]nbitsHow many bits to generate
[out]dlPointer to array of ubits to return Downlink cipher stream
[out]ulPointer to array of ubits to return Uplink cipher stream

Currently only A5/0 and A5/1. Either (or both) of dl/ul can be NULL if not needed.

References gmr1_a5_1().

◆ gmr1_a5_1()

void gmr1_a5_1 ( uint8_t *  key,
uint32_t  fn,
int  nbits,
ubit_t *  dl,
ubit_t *  ul 
)

Generate a GMR-1 A5/1 cipher stream.

Parameters
[in]key8 byte array for the key (as received from the SIM)
[in]fnFrame number
[in]nbitsHow many bits to generate
[out]dlPointer to array of ubits to return Downlink cipher stream
[out]ulPointer to array of ubits to return Uplink cipher stream

Either (or both) of dl/ul can be NULL if not needed.

Referenced by gmr1_a5().