anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /*--------------------------------------------------------- |
| 2 | * SNOW_3G.h |
| 3 | *---------------------------------------------------------*/ |
| 4 | /* |
| 5 | * The code has been referred from |
| 6 | * 1. https://www.gsma.com/aboutus/wp-content/uploads/2014/12/snow3gspec.pdf |
| 7 | * 2. https://www.gsma.com/aboutus/wp-content/uploads/2014/12/uea2uia2d1v21.pdf |
| 8 | */ |
| 9 | |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <string.h> |
| 14 | #include <math.h> |
| 15 | |
| 16 | |
| 17 | typedef unsigned char u8; |
| 18 | typedef unsigned int u32; |
| 19 | typedef unsigned long long u64; |
| 20 | |
| 21 | /* Initialization. |
| 22 | * Input k[4]: Four 32-bit words making up 128-bit key. |
| 23 | * Input IV[4]: Four 32-bit words making 128-bit initialization variable. |
| 24 | * Output: All the LFSRs and FSM are initialized for key generation. |
| 25 | * See Section 4.1 of |
| 26 | * (https://www.gsma.com/aboutus/wp-content/uploads/2014/12/snow3gspec.pdf) |
| 27 | * specs document. |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | void Initialize(u32 k[4], u32 IV[4]); |
| 32 | |
| 33 | /* Generation of Keystream. |
| 34 | * input n: number of 32-bit words of keystream. |
| 35 | * input z: space for the generated keystream, assumes |
| 36 | * memory is allocated already. |
| 37 | * output: generated keystream which is filled in z |
| 38 | * See section 4.2 of |
| 39 | * (https://www.gsma.com/aboutus/wp-content/uploads/2014/12/snow3gspec.pdf) |
| 40 | * specs document. |
| 41 | */ |
| 42 | |
| 43 | void GenerateKeystream(u32 n, u32 *z); |
| 44 | |