Removed strayed code fragment
[strongswan.git] / src / charon / plugins / eap_aka_3gpp2 / eap_aka_3gpp2_functions.h
1 /*
2 * Copyright (C) 2008-2009 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup eap_aka_3gpp2_functions eap_aka_3gpp2_functions
18 * @{ @ingroup eap_aka_3gpp2
19 */
20
21 #ifndef EAP_AKA_3GPP2_FUNCTIONS_H_
22 #define EAP_AKA_3GPP2_FUNCTIONS_H_
23
24 #include <sa/authenticators/eap/sim_manager.h>
25
26 #define AKA_SQN_LEN 6
27 #define AKA_K_LEN 16
28 #define AKA_MAC_LEN 8
29 #define AKA_AK_LEN 6
30 #define AKA_AMF_LEN 2
31 #define AKA_FMK_LEN 4
32
33 typedef struct eap_aka_3gpp2_functions_t eap_aka_3gpp2_functions_t;
34
35 /**
36 * f1-f5(), f1*() and f5*() functions from the 3GPP2 (S.S0055) standard.
37 */
38 struct eap_aka_3gpp2_functions_t {
39
40 /**
41 * Calculate MAC from RAND, SQN, AMF using K.
42 *
43 * @param k secret key K
44 * @param rand random value rand
45 * @param sqn sequence number
46 * @param amf authentication management field
47 * @param mac buffer receiving mac MAC
48 */
49 void (*f1)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
50 u_char rand[AKA_RAND_LEN], u_char sqn[AKA_SQN_LEN],
51 u_char amf[AKA_AMF_LEN], u_char mac[AKA_MAC_LEN]);
52
53 /**
54 * Calculate MACS from RAND, SQN, AMF using K
55 *
56 * @param k secret key K
57 * @param rand random value RAND
58 * @param sqn sequence number
59 * @param amf authentication management field
60 * @param macs buffer receiving resynchronization mac MACS
61 */
62 void (*f1star)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
63 u_char rand[AKA_RAND_LEN], u_char sqn[AKA_SQN_LEN],
64 u_char amf[AKA_AMF_LEN], u_char macs[AKA_MAC_LEN]);
65
66 /**
67 * Calculate RES from RAND using K
68 *
69 * @param k secret key K
70 * @param rand random value RAND
71 * @param res buffer receiving result RES, uses full 128 bit
72 */
73 void (*f2)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
74 u_char rand[AKA_RAND_LEN], u_char res[AKA_RES_MAX]);
75 /**
76 * Calculate CK from RAND using K
77 *
78 * @param k secret key K
79 * @param rand random value RAND
80 * @param macs buffer receiving encryption key CK
81 */
82 void (*f3)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
83 u_char rand[AKA_RAND_LEN], u_char ck[AKA_CK_LEN]);
84 /**
85 * Calculate IK from RAND using K
86 *
87 * @param k secret key K
88 * @param rand random value RAND
89 * @param macs buffer receiving integrity key IK
90 */
91 void (*f4)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
92 u_char rand[AKA_RAND_LEN], u_char ik[AKA_IK_LEN]);
93 /**
94 * Calculate AK from a RAND using K
95 *
96 * @param k secret key K
97 * @param rand random value RAND
98 * @param macs buffer receiving anonymity key AK
99 */
100 void (*f5)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
101 u_char rand[AKA_RAND_LEN], u_char ak[AKA_AK_LEN]);
102 /**
103 * Calculate AKS from a RAND using K
104 *
105 * @param k secret key K
106 * @param rand random value RAND
107 * @param macs buffer receiving resynchronization anonymity key AKS
108 */
109 void (*f5star)(eap_aka_3gpp2_functions_t *this, u_char k[AKA_K_LEN],
110 u_char rand[AKA_RAND_LEN], u_char aks[AKA_AK_LEN]);
111
112 /**
113 * Destroy a eap_aka_3gpp2_functions_t.
114 */
115 void (*destroy)(eap_aka_3gpp2_functions_t *this);
116 };
117
118 /**
119 * Create a eap_aka_3gpp2_functions instance.
120 *
121 * @return function set, NULL on error
122 */
123 eap_aka_3gpp2_functions_t *eap_aka_3gpp2_functions_create();
124
125 #endif /** EAP_AKA_3GPP2_FUNCTIONS_H_ @}*/