kasumi.c File Reference
`#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] | P | Block, 64 bits to be processed in this round
  [in] | KLi1 | Expanded subkeys
  [in] | KLi2 | Expanded subkeys
  [in] | KOi1 | Expanded subkeys
  [in] | KOi2 | Expanded subkeys
  [in] | KOi3 | Expanded subkeys
  [in] | KIi1 | Expanded subkeys
  [in] | KIi2 | Expanded subkeys
  [in] | KIi3 | Expanded subkeys

Returns
  processed block of 64 bits

References kasumi_FL(), and kasumi_FO().

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] | KLi1 | Expanded subkeys
  [out] | KLi2 | Expanded subkeys
  [out] | KOi1 | Expanded subkeys
  [out] | KOi2 | Expanded subkeys
  [out] | KOi3 | Expanded subkeys
  [out] | KIi1 | Expanded subkeys
  [out] | KIi2 | Expanded subkeys
  [out] | KIi3 | Expanded subkeys

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] | ck | 8-bytes long key
  [out] | co | cl-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
| ) |  |

inline static

Referenced by kasumi_FO().

## kasumi_FL()

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

inline static

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
| ) |  |

inline static

References kasumi_FI().

Referenced by _kasumi().