blob: d9de10b41c2df7caff320cdf86ebc7a15371b083 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file kasumi.h
2 * KASUMI header.
Sylvain Munaut579a7102014-06-16 14:59:30 +02003 *
4 * See kasumi.c for details
5 * The parameters are described in TS 135 202.
6 */
7
8#pragma once
9
10#include <stdint.h>
11
Neels Hofmeyr87e45502017-06-20 00:17:59 +020012/*! Single iteration of KASUMI cipher
Sylvain Munaut579a7102014-06-16 14:59:30 +020013 * \param[in] P Block, 64 bits to be processed in this round
14 * \param[in] KLi1 Expanded subkeys
15 * \param[in] KLi2 Expanded subkeys
16 * \param[in] KOi1 Expanded subkeys
17 * \param[in] KOi2 Expanded subkeys
18 * \param[in] KOi3 Expanded subkeys
19 * \param[in] KIi1 Expanded subkeys
20 * \param[in] KIi2 Expanded subkeys
21 * \param[in] KIi3 Expanded subkeys
22 * \returns processed block of 64 bits
23 */
24uint64_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);
25
Neels Hofmeyr87e45502017-06-20 00:17:59 +020026/*! Implementation of the KGCORE algorithm (used by A5/3, A5/4, GEA3, GEA4 and ECSD)
Sylvain Munaut579a7102014-06-16 14:59:30 +020027 * \param[in] CA
28 * \param[in] cb
29 * \param[in] cc
30 * \param[in] cd
31 * \param[in] ck 8-bytes long key
32 * \param[out] co cl-dependent
33 * \param[in] cl
34 */
35void _kasumi_kgcore(uint8_t CA, uint8_t cb, uint32_t cc, uint8_t cd, const uint8_t *ck, uint8_t *co, uint16_t cl);
36
Neels Hofmeyr87e45502017-06-20 00:17:59 +020037/*! Expand key into set of subkeys - see TS 135 202 for details
Sylvain Munaut579a7102014-06-16 14:59:30 +020038 * \param[in] key (128 bits) as array of bytes
39 * \param[out] KLi1 Expanded subkeys
40 * \param[out] KLi2 Expanded subkeys
41 * \param[out] KOi1 Expanded subkeys
42 * \param[out] KOi2 Expanded subkeys
43 * \param[out] KOi3 Expanded subkeys
44 * \param[out] KIi1 Expanded subkeys
45 * \param[out] KIi2 Expanded subkeys
46 * \param[out] KIi3 Expanded subkeys
47 */
48void _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);