libosmogsm
0.9.3
Osmocom GSM library
|
Osmocom GSM A5 ciphering algorithm implementation. More...
#include <errno.h>
#include <string.h>
#include <stdbool.h>
#include <osmocom/gsm/a5.h>
#include <osmocom/gsm/kasumi.h>
Defines | |
#define | ENOTSUP EINVAL |
#define | A5_R1_LEN 19 |
#define | A5_R2_LEN 22 |
#define | A5_R3_LEN 23 |
#define | A5_R4_LEN 17 /* A5/2 only */ |
#define | A5_R1_MASK ((1<<A5_R1_LEN)-1) |
#define | A5_R2_MASK ((1<<A5_R2_LEN)-1) |
#define | A5_R3_MASK ((1<<A5_R3_LEN)-1) |
#define | A5_R4_MASK ((1<<A5_R4_LEN)-1) |
#define | A5_R1_TAPS 0x072000 /* x^19 + x^18 + x^17 + x^14 + 1 */ |
#define | A5_R2_TAPS 0x300000 /* x^22 + x^21 + 1 */ |
#define | A5_R3_TAPS 0x700080 /* x^23 + x^22 + x^21 + x^8 + 1 */ |
#define | A5_R4_TAPS 0x010800 /* x^17 + x^12 + 1 */ |
#define | A51_R1_CLKBIT 0x000100 |
#define | A51_R2_CLKBIT 0x000400 |
#define | A51_R3_CLKBIT 0x000400 |
#define | A52_R4_CLKBIT0 0x000400 |
#define | A52_R4_CLKBIT1 0x000008 |
#define | A52_R4_CLKBIT2 0x000080 |
Functions | |
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. | |
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. | |
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. | |
static uint32_t | _a5_12_parity (uint32_t x) |
Computes parity of a 32-bit word. | |
static uint32_t | _a5_12_majority (uint32_t v1, uint32_t v2, uint32_t v3) |
Compute majority bit from 3 taps. | |
static uint32_t | _a5_12_clock (uint32_t r, uint32_t mask, uint32_t taps) |
Compute the next LFSR state. | |
static void | _a5_1_clock (uint32_t r[], int force) |
GSM A5/1 Clocking function. | |
static uint8_t | _a5_1_get_output (uint32_t r[]) |
GSM A5/1 Output function. | |
void | osmo_a5_1 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) |
Generate a GSM A5/1 cipher stream. | |
static void | _a5_2_clock (uint32_t r[], int force) |
GSM A5/2 Clocking function. | |
static uint8_t | _a5_2_get_output (uint32_t r[]) |
GSM A5/2 Output function. | |
void | osmo_a5_2 (const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) |
Generate a GSM A5/1 cipher stream. |
Osmocom GSM A5 ciphering algorithm implementation.