diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-06-30 19:50:14 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-06-30 19:50:14 +0200 |
commit | e335b91ccd6175f43d8bb0c2ea4811e49cb4d95b (patch) | |
tree | b399365d992b69c061fa81273e72202cbc311232 /src | |
parent | b9ce51c5fd9773694856802a175efdd9b37a2242 (diff) |
GPRS: Add 'input' generator functions for GPRS cipher algorithm
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs_cipher_core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gprs_cipher_core.c b/src/gprs_cipher_core.c index a72dda84..6174bd72 100644 --- a/src/gprs_cipher_core.c +++ b/src/gprs_cipher_core.c @@ -83,3 +83,17 @@ int gprs_cipher_supported(enum gprs_ciph_algo algo) return 0; } + +/* GSM TS 04.64 / Section A.2.1 : Generation of 'input' */ +uint32_t gprs_cipher_gen_input_ui(uint32_t iov_ui, uint8_t sapi, uint32_t lfn, uint32_t oc) +{ + uint32_t sx = ((1<<27) * sapi) + (1<<31); + + return (iov_ui ^ sx) + lfn + oc; +} + +/* GSM TS 04.64 / Section A.2.1 : Generation of 'input' */ +uint32_t gprs_cipher_gen_input_i(uint32_t iov_i, uint32_t lfn, uint32_t oc) +{ + return iov_i + lfn + oc; +} |