libosmogsm 1.9.0.196-9975
Osmocom GSM library
kasumi.c File Reference

Kasumi cipher and KGcore functions. More...

#include <stdint.h>
#include <osmocom/core/bits.h>
#include <osmocom/gsm/kasumi.h>

Functions

static uint16_t kasumi_FI (uint16_t I, uint16_t skey)
 
static uint32_t kasumi_FO (uint32_t I, const uint16_t *KOi1, const uint16_t *KOi2, const uint16_t *KOi3, const uint16_t *KIi1, const uint16_t *KIi2, const uint16_t *KIi3, unsigned i)
 
static uint32_t kasumi_FL (uint32_t I, const uint16_t *KLi1, const uint16_t *KLi2, unsigned i)
 
uint64_t _kasumi (uint64_t P, const uint16_t *KLi1, const uint16_t *KLi2, const uint16_t *KOi1, const uint16_t *KOi2, const uint16_t *KOi3, const uint16_t *KIi1, const uint16_t *KIi2, const uint16_t *KIi3)
 Single iteration of KASUMI cipher. More...
 
void _kasumi_key_expand (const uint8_t *key, uint16_t *KLi1, uint16_t *KLi2, uint16_t *KOi1, uint16_t *KOi2, uint16_t *KOi3, uint16_t *KIi1, uint16_t *KIi2, uint16_t *KIi3)
 Expand key into set of subkeys - see TS 135 202 for details. More...
 
void _kasumi_kgcore (uint8_t CA, uint8_t cb, uint32_t cc, uint8_t cd, const uint8_t *ck, uint8_t *co, uint16_t cl)
 Implementation of the KGCORE algorithm (used by A5/3, A5/4, GEA3, GEA4 and ECSD) More...
 

Detailed Description

Kasumi cipher and KGcore functions.

Function Documentation

◆ _kasumi()

uint64_t _kasumi ( uint64_t  P,
const uint16_t *  KLi1,
const uint16_t *  KLi2,
const uint16_t *  KOi1,
const uint16_t *  KOi2,
const uint16_t *  KOi3,
const uint16_t *  KIi1,
const uint16_t *  KIi2,
const uint16_t *  KIi3 
)

Single iteration of KASUMI cipher.

Parameters
[in]PBlock, 64 bits to be processed in this round
[in]KLi1Expanded subkeys
[in]KLi2Expanded subkeys
[in]KOi1Expanded subkeys
[in]KOi2Expanded subkeys
[in]KOi3Expanded subkeys
[in]KIi1Expanded subkeys
[in]KIi2Expanded subkeys
[in]KIi3Expanded subkeys
Returns
processed block of 64 bits

References kasumi_FL(), kasumi_FO(), L, and R.

Referenced by _kasumi_kgcore().

◆ _kasumi_key_expand()

void _kasumi_key_expand ( const uint8_t *  key,
uint16_t *  KLi1,
uint16_t *  KLi2,
uint16_t *  KOi1,
uint16_t *  KOi2,
uint16_t *  KOi3,
uint16_t *  KIi1,
uint16_t *  KIi2,
uint16_t *  KIi3 
)

Expand key into set of subkeys - see TS 135 202 for details.

Parameters
[in]key(128 bits) as array of bytes
[out]KLi1Expanded subkeys
[out]KLi2Expanded subkeys
[out]KOi1Expanded subkeys
[out]KOi2Expanded subkeys
[out]KOi3Expanded subkeys
[out]KIi1Expanded subkeys
[out]KIi2Expanded subkeys
[out]KIi3Expanded subkeys

References osmo_rol16().

Referenced by _kasumi_kgcore().

◆ _kasumi_kgcore()

void _kasumi_kgcore ( uint8_t  CA,
uint8_t  cb,
uint32_t  cc,
uint8_t  cd,
const uint8_t *  ck,
uint8_t *  co,
uint16_t  cl 
)

Implementation of the KGCORE algorithm (used by A5/3, A5/4, GEA3, GEA4 and ECSD)

Parameters
[in]CA
[in]cb
[in]cc
[in]cd
[in]ck8-bytes long key
[out]cocl-dependent
[in]cl

References _kasumi(), and _kasumi_key_expand().

Referenced by _a5_4(), and gea4().

◆ kasumi_FI()

static uint16_t kasumi_FI ( uint16_t  I,
uint16_t  skey 
)
inlinestatic

References L, and R.

Referenced by kasumi_FO().

◆ kasumi_FL()

static uint32_t kasumi_FL ( uint32_t  I,
const uint16_t *  KLi1,
const uint16_t *  KLi2,
unsigned  i 
)
inlinestatic

References L, osmo_rol16(), and R.

Referenced by _kasumi().

◆ kasumi_FO()

static uint32_t kasumi_FO ( uint32_t  I,
const uint16_t *  KOi1,
const uint16_t *  KOi2,
const uint16_t *  KOi3,
const uint16_t *  KIi1,
const uint16_t *  KIi2,
const uint16_t *  KIi3,
unsigned  i 
)
inlinestatic

References kasumi_FI(), L, and R.

Referenced by _kasumi().