4 * @brief Interface of eap_sim_t.
9 * Copyright (C) 2007 Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 typedef struct eap_sim_t eap_sim_t
;
27 typedef enum sim_subtype_t sim_subtype_t
;
28 typedef enum sim_attribute_t sim_attribute_t
;
30 #include <sa/authenticators/eap/eap_method.h>
33 * Subtypes of SIM messages
38 SIM_NOTIFICATION
= 12,
39 SIM_CLIENT_ERROR
= 14,
43 * enum names for sim_subtype_t
45 extern enum_name_t
*sim_subtype_names
;
47 enum sim_attribute_t
{
48 /** defines the end of attribute list */
56 AT_PERMANENT_ID_REQ
= 10,
62 AT_SELECTED_VERSION
= 16,
63 AT_FULLAUTH_ID_REQ
= 17,
65 AT_COUNTER_TOO_SMALL
= 20,
67 AT_CLIENT_ERROR_CODE
= 22,
70 AT_NEXT_PSEUDONYM
= 132,
71 AT_NEXT_REAUTH_ID
= 133,
77 * enum names for sim_subtype_t
79 extern enum_name_t
*sim_attribute_names
;
82 * @brief Cardreaders SIM function.
84 * @param rand RAND to run algo with
85 * @param rand_length length of value in rand
86 * @param sres buffer to get SRES
87 * @param sres_length size of buffer in sres, returns bytes written to SRES
88 * @param kc buffer to get Kc
89 * @param kc_length size of buffer in Kc, returns bytes written to Kc
90 * @return zero on success
92 typedef int (*sim_algo_t
)(const unsigned char *rand
, int rand_length
,
93 unsigned char *sres
, int *sres_length
,
94 unsigned char *kc
, int *kc_length
);
96 #ifndef SIM_READER_LIB
97 /** the library containing the cardreader with the SIM function */
98 #define SIM_READER_LIB "/root/strongswan-shared/trunk/src/charon/sa/authenticators/eap/sim_reader/sim_api.so"
99 #endif /* SIM_READER_LIB */
101 #ifndef SIM_READER_ALG
102 /** the SIM_READER_LIB's algorithm, uses sim_algo_t signature */
103 #define SIM_READER_ALG "sim_run_alg"
104 #endif /* SIM_READER_ALG */
109 * @brief Implementation of the eap_method_t interface using EAP-SIM.
111 * This EAP-SIM client implementation uses another pluggable library to
112 * access the SIM card. This module is specified using the SIM_READER_LIB
113 * definition. The function to run the algorithm has the sim_algo_t type and
114 * is named as SIM_READER_ALG is defined.
118 * - eap_client_create() using eap_method EAP_SIM
125 * Implemented eap_method_t interface.
127 eap_method_t eap_method_interface
;
131 * @brief Creates the EAP method EAP-SIM.
133 * @param server ID of the EAP server
134 * @param peer ID of the EAP client
135 * @return eap_sim_t object
139 eap_sim_t
*eap_create(eap_role_t role
,
140 identification_t
*server
, identification_t
*peer
);
142 #endif /* EAP_SIM_H_ */