le_iks_aesMilenage_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_iks_aesMilenage_common.h
12  *
13  * Type definitions for le_iks_aesMilenage.
14  *
15  */
16 #ifndef LE_IKS_AESMILENAGE_COMMON_H_INCLUDE_GUARD
17 #define LE_IKS_AESMILENAGE_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 // Interface specific includes
23 #include "le_iks_common.h"
24 
25 #define IFGEN_LE_IKS_AESMILENAGE_PROTOCOL_ID "dc1d845cee526b5f5000430220d7a0ba"
26 #define IFGEN_LE_IKS_AESMILENAGE_MSG_SIZE 74
27 /** @addtogroup le_iks_aesMilenage
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  * Key size in bytes. This refers to the subscriber key, K.
34  */
35 //--------------------------------------------------------------------------------------------------
36 #define LE_IKS_AESMILENAGE_K_SIZE 16
37 
38 //--------------------------------------------------------------------------------------------------
39 /**
40  * OPC size in bytes.
41  */
42 //--------------------------------------------------------------------------------------------------
43 #define LE_IKS_AESMILENAGE_OPC_SIZE 16
44 
45 //--------------------------------------------------------------------------------------------------
46 /**
47  * OP size in bytes.
48  */
49 //--------------------------------------------------------------------------------------------------
50 #define LE_IKS_AESMILENAGE_OP_SIZE 16
51 
52 //--------------------------------------------------------------------------------------------------
53 /**
54  * Milenage parameter sizes in bytes.
55  */
56 //--------------------------------------------------------------------------------------------------
57 #define LE_IKS_AESMILENAGE_RAND_SIZE 16
58 
59 //--------------------------------------------------------------------------------------------------
60 /**
61  */
62 //--------------------------------------------------------------------------------------------------
63 #define LE_IKS_AESMILENAGE_AMF_SIZE 2
64 
65 //--------------------------------------------------------------------------------------------------
66 /**
67  */
68 //--------------------------------------------------------------------------------------------------
69 #define LE_IKS_AESMILENAGE_SQN_SIZE 6
70 
71 //--------------------------------------------------------------------------------------------------
72 /**
73  */
74 //--------------------------------------------------------------------------------------------------
75 #define LE_IKS_AESMILENAGE_MACA_SIZE 8
76 
77 //--------------------------------------------------------------------------------------------------
78 /**
79  */
80 //--------------------------------------------------------------------------------------------------
81 #define LE_IKS_AESMILENAGE_MACS_SIZE 8
82 
83 //--------------------------------------------------------------------------------------------------
84 /**
85  */
86 //--------------------------------------------------------------------------------------------------
87 #define LE_IKS_AESMILENAGE_RES_SIZE 8
88 
89 //--------------------------------------------------------------------------------------------------
90 /**
91  */
92 //--------------------------------------------------------------------------------------------------
93 #define LE_IKS_AESMILENAGE_CK_SIZE 16
94 
95 //--------------------------------------------------------------------------------------------------
96 /**
97  */
98 //--------------------------------------------------------------------------------------------------
99 #define LE_IKS_AESMILENAGE_IK_SIZE 16
100 
101 //--------------------------------------------------------------------------------------------------
102 /**
103  */
104 //--------------------------------------------------------------------------------------------------
105 #define LE_IKS_AESMILENAGE_AK_SIZE 6
106 
107 
108 //--------------------------------------------------------------------------------------------------
109 /**
110  * Get if this client bound locally.
111  */
112 //--------------------------------------------------------------------------------------------------
113 LE_SHARED bool ifgen_le_iks_aesMilenage_HasLocalBinding
114 (
115  void
116 );
117 
118 
119 //--------------------------------------------------------------------------------------------------
120 /**
121  * Init data that is common across all threads
122  */
123 //--------------------------------------------------------------------------------------------------
124 LE_SHARED void ifgen_le_iks_aesMilenage_InitCommonData
125 (
126  void
127 );
128 
129 
130 //--------------------------------------------------------------------------------------------------
131 /**
132  * Perform common initialization and open a session
133  */
134 //--------------------------------------------------------------------------------------------------
135 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_OpenSession
136 (
137  le_msg_SessionRef_t _ifgen_sessionRef,
138  bool isBlocking
139 );
140 
141 //--------------------------------------------------------------------------------------------------
142 /**
143  * Calculates the network authentication code MAC-A using the Milenage algorithm set with AES-128 as
144  * the block cipher. Implements the Milenage function f1.
145  *
146  * @return
147  * LE_OK if successful.
148  * LE_BAD_PARAMETER if either K or OPc reference is invalid
149  * or if either K or OPc key type is invalid
150  * or if either randPtr, amfPtr, sqnPtr, or macaPtr is NULL.
151  * LE_UNSUPPORTED if underlying resource does not support this operation.
152  * LE_FAULT if there was an internal error.
153  */
154 //--------------------------------------------------------------------------------------------------
155 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_GetMacA
156 (
157  le_msg_SessionRef_t _ifgen_sessionRef,
158  uint64_t kRef,
159  ///< [IN] Reference to K.
160  uint64_t opcRef,
161  ///< [IN] Reference to OPc.
162  const uint8_t* randPtr,
163  ///< [IN] RAND challenge. Assumed to be RAND_SIZE bytes.
164  size_t randSize,
165  ///< [IN]
166  const uint8_t* amfPtr,
167  ///< [IN] Authentication management field, AMF.
168  ///< Assumed to be AMF_SIZE bytes.
169  size_t amfSize,
170  ///< [IN]
171  const uint8_t* sqnPtr,
172  ///< [IN] Sequence number, SQN.
173  ///< Assumed to be SQN_SIZE bytes.
174  size_t sqnSize,
175  ///< [IN]
176  uint8_t* macaPtr,
177  ///< [OUT] Buffer to hold the network authentication code.
178  ///< Assumed to be MACA_SIZE bytes.
179  size_t* macaSizePtr
180  ///< [INOUT]
181 );
182 
183 //--------------------------------------------------------------------------------------------------
184 /**
185  * Calculates the re-synchronisation authentication code MAC-S using the Milenage algorithm set with
186  * AES-128 as the block cipher. Implements the Milenage function f1*.
187  *
188  * @return
189  * LE_OK if successful.
190  * LE_BAD_PARAMETER if either K or OPc reference is invalid
191  * or if either K or OPc key type is invalid
192  * or if either randPtr, amfPtr, sqnPtr, or macsPtr is NULL.
193  * LE_UNSUPPORTED if underlying resource does not support this operation.
194  * LE_FAULT if there was an internal error.
195  */
196 //--------------------------------------------------------------------------------------------------
197 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_GetMacS
198 (
199  le_msg_SessionRef_t _ifgen_sessionRef,
200  uint64_t kRef,
201  ///< [IN] Reference to K.
202  uint64_t opcRef,
203  ///< [IN] Reference to OPc.
204  const uint8_t* randPtr,
205  ///< [IN] RAND challenge. Assumed to be RAND_SIZE bytes.
206  size_t randSize,
207  ///< [IN]
208  const uint8_t* amfPtr,
209  ///< [IN] Authentication management field, AMF.
210  ///< Assumed to be AMF_SIZE bytes.
211  size_t amfSize,
212  ///< [IN]
213  const uint8_t* sqnPtr,
214  ///< [IN] Sequence number, SQN.
215  ///< Assumed to be SQN_SIZE bytes.
216  size_t sqnSize,
217  ///< [IN]
218  uint8_t* macsPtr,
219  ///< [OUT] Buffer to hold the re-sync authentication code.
220  ///< Assumed to be MACS_SIZE bytes.
221  size_t* macsSizePtr
222  ///< [INOUT]
223 );
224 
225 //--------------------------------------------------------------------------------------------------
226 /**
227  * Derives authentication response and keys using the Milenage algorithm set with AES-128 as the
228  * block cipher. Implements the Milenage functions f2, f3, f4, f5.
229  *
230  * @return
231  * LE_OK if successful.
232  * LE_BAD_PARAMETER if either K or OPc reference is invalid
233  * or if either K or OPc key type is invalid
234  * or if either randPtr, resPtr, ckPtr, ikPtr or akPtr is NULL.
235  * LE_UNSUPPORTED if underlying resource does not support this operation.
236  * LE_FAULT if there was an internal error.
237  */
238 //--------------------------------------------------------------------------------------------------
239 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_GetKeys
240 (
241  le_msg_SessionRef_t _ifgen_sessionRef,
242  uint64_t kRef,
243  ///< [IN] Reference to K.
244  uint64_t opcRef,
245  ///< [IN] Reference to OPc.
246  const uint8_t* randPtr,
247  ///< [IN] RAND challenge. Assumed to be RAND_SIZE bytes.
248  size_t randSize,
249  ///< [IN]
250  uint8_t* resPtr,
251  ///< [OUT] Buffer to hold the authentication response RES.
252  ///< Assumed to be RES_SIZE bytes.
253  size_t* resSizePtr,
254  ///< [INOUT]
255  uint8_t* ckPtr,
256  ///< [OUT] Buffer to hold the confidentiality key CK.
257  ///< Assumed to be CK_SIZE bytes.
258  size_t* ckSizePtr,
259  ///< [INOUT]
260  uint8_t* ikPtr,
261  ///< [OUT] Buffer to hold the integrity key IK.
262  ///< Assumed to be IK_SIZE bytes.
263  size_t* ikSizePtr,
264  ///< [INOUT]
265  uint8_t* akPtr,
266  ///< [OUT] Buffer to hold the anonymity key AK.
267  ///< Assumed to be AK_SIZE bytes.
268  size_t* akSizePtr
269  ///< [INOUT]
270 );
271 
272 //--------------------------------------------------------------------------------------------------
273 /**
274  * Derives the anonymity key for the re-synchronisation message using the Milenage algorithm set
275  * with AES-128 as the block cipher. Implements the Milenage functions f5*.
276  *
277  * @return
278  * LE_OK if successful.
279  * LE_BAD_PARAMETER if either K or OPc reference is invalid
280  * or if either K or OPc key type is invalid
281  * or if either randPtr or akPtr is NULL.
282  * LE_UNSUPPORTED if underlying resource does not support this operation.
283  * LE_FAULT if there was an internal error.
284  */
285 //--------------------------------------------------------------------------------------------------
286 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_GetAk
287 (
288  le_msg_SessionRef_t _ifgen_sessionRef,
289  uint64_t kRef,
290  ///< [IN] Reference to K.
291  uint64_t opcRef,
292  ///< [IN] Reference to OPc.
293  const uint8_t* randPtr,
294  ///< [IN] RAND challenge. Assumed to be RAND_SIZE bytes.
295  size_t randSize,
296  ///< [IN]
297  uint8_t* akPtr,
298  ///< [OUT] Buffer to hold the anonymity key AK.
299  ///< Assumed to be AK_SIZE bytes.
300  size_t* akSizePtr
301  ///< [INOUT]
302 );
303 
304 //--------------------------------------------------------------------------------------------------
305 /**
306  * Derive an OPc value from the specified K and the internal OP value.
307  *
308  * @note
309  * This function is generally not used in devices as most OPc values are derived in a factory
310  * or network setting.
311  *
312  * @return
313  * LE_OK if successful.
314  * LE_BAD_PARAMETER if OP reference is invalid
315  * or if kPtr, opcPtr is NULL.
316  * LE_FAULT if there was an internal error.
317  */
318 //--------------------------------------------------------------------------------------------------
319 LE_SHARED le_result_t ifgen_le_iks_aesMilenage_DeriveOpc
320 (
321  le_msg_SessionRef_t _ifgen_sessionRef,
322  uint64_t opRef,
323  ///< [IN] Reference to OP key.
324  const uint8_t* kPtr,
325  ///< [IN] K.
326  size_t kSize,
327  ///< [IN]
328  uint8_t* opcPtr,
329  ///< [OUT] Buffer to hold the OPc value.
330  size_t* opcSizePtr
331  ///< [INOUT]
332 );
333 /** @} **/
334 #endif // LE_IKS_AESMILENAGE_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860