|
static uint32_t | osmo_a5_fn_count (uint32_t fn) |
| Converts a frame number into the 22 bit number used in A5/x. More...
|
|
int | osmo_a5 (int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) |
| Main method to generate a A5/x cipher stream. More...
|
|
void | osmo_a5_1 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) OSMO_DEPRECATED("Use generic osmo_a5() instead") |
|
void | osmo_a5_2 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) OSMO_DEPRECATED("Use generic osmo_a5() instead") |
|
void | _a5_4 (const uint8_t *ck, uint32_t fn, ubit_t *dl, ubit_t *ul, bool fn_correct) |
| Generate a GSM A5/4 cipher stream. More...
|
|
void | _a5_3 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul, bool fn_correct) |
| Generate a GSM A5/3 cipher stream. More...
|
|
static uint32_t | _a5_12_parity (uint32_t x) |
| Computes parity of a 32-bit word. More...
|
|
static uint32_t | _a5_12_majority (uint32_t v1, uint32_t v2, uint32_t v3) |
| Compute majority bit from 3 taps. More...
|
|
static uint32_t | _a5_12_clock (uint32_t r, uint32_t mask, uint32_t taps) |
| Compute the next LFSR state. More...
|
|
static void | _a5_1_clock (uint32_t r[], int force) |
| GSM A5/1 Clocking function. More...
|
|
static uint8_t | _a5_1_get_output (uint32_t r[]) |
| GSM A5/1 Output function. More...
|
|
void | _a5_1 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) |
| Generate a GSM A5/1 cipher stream. More...
|
|
static void | _a5_2_clock (uint32_t r[], int force) |
| GSM A5/2 Clocking function. More...
|
|
static uint8_t | _a5_2_get_output (uint32_t r[]) |
| GSM A5/2 Output function. More...
|
|
void | _a5_2 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) |
| Generate a GSM A5/1 cipher stream. More...
|
|
Full reimplementation of A5/1,2,3,4 (split and threadsafe).
The logic behind the algorithm is taken from "A pedagogical implementation
of the GSM A5/1 and A5/2 "voice privacy" encryption algorithms." by Marc Briceno, Ian Goldberg, and David Wagner.
void _a5_3 |
( |
const uint8_t * |
key, |
|
|
uint32_t |
fn, |
|
|
ubit_t * |
dl, |
|
|
ubit_t * |
ul, |
|
|
bool |
fn_correct |
|
) |
| |
Generate a GSM A5/3 cipher stream.
- Parameters
-
[in] | key | 8 byte array for the key (as received from the SIM) |
[in] | fn | Frame number |
[out] | dl | Pointer to array of ubits to return Downlink cipher stream |
[out] | ul | Pointer to array of ubits to return Uplink cipher stream |
[in] | fn_correct | true if fn is a real GSM frame number and thus requires internal conversion |
Either (or both) of dl/ul should be NULL if not needed.
Implementation based on specifications from 3GPP TS 55.216, 3GPP TR 55.919 and ETSI TS 135 202 with slight simplifications (CE hardcoded to 0).
References _a5_4(), and osmo_c4().
Referenced by osmo_a5().
void _a5_4 |
( |
const uint8_t * |
ck, |
|
|
uint32_t |
fn, |
|
|
ubit_t * |
dl, |
|
|
ubit_t * |
ul, |
|
|
bool |
fn_correct |
|
) |
| |
Generate a GSM A5/4 cipher stream.
- Parameters
-
[in] | key | 16 byte array for the key (as received from the SIM) |
[in] | fn | Frame number |
[out] | dl | Pointer to array of ubits to return Downlink cipher stream |
[out] | ul | Pointer to array of ubits to return Uplink cipher stream |
[in] | fn_correct | true if fn is a real GSM frame number and thus requires internal conversion |
Either (or both) of dl/ul should be NULL if not needed.
Implementation based on specifications from 3GPP TS 55.216, 3GPP TR 55.919 and ETSI TS 135 202 with slight simplifications (CE hardcoded to 0).
References _kasumi_kgcore(), osmo_a5_fn_count(), and osmo_pbit2ubit().
Referenced by _a5_3(), and osmo_a5().
int osmo_a5 |
( |
int |
n, |
|
|
const uint8_t * |
key, |
|
|
uint32_t |
fn, |
|
|
ubit_t * |
dl, |
|
|
ubit_t * |
ul |
|
) |
| |
Main method to generate a A5/x cipher stream.
- Parameters
-
[in] | n | Which A5/x method to use |
[in] | key | 8 or 16 (for a5/4) byte array for the key (as received from the SIM) |
[in] | fn | Frame number |
[out] | dl | Pointer to array of ubits to return Downlink cipher stream |
[out] | ul | Pointer to array of ubits to return Uplink cipher stream |
- Returns
- 0 for success, -ENOTSUP for invalid cipher selection.
Currently A5/[0-4] are supported. Either (or both) of dl/ul can be NULL if not needed.
References _a5_1(), _a5_2(), _a5_3(), _a5_4(), ENOTSUP, and n.
Referenced by osmo_a5_1(), and osmo_a5_2().