]> git.saurik.com Git - apple/ipsec.git/blob - ipsec-tools/racoon/eap_sim.h
536c6d434ef459e37a3a5dc251bb4b43ad5919b5
[apple/ipsec.git] / ipsec-tools / racoon / eap_sim.h
1 /*
2 * Copyright (c) 2012 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * eap_plugin.h - Extensible Authentication Protocol Plugin API.
25 *
26 * Redistribution and use in source and binary forms are permitted
27 * provided that the above copyright notice and this paragraph are
28 * duplicated in all such forms and that any documentation,
29 * advertising materials, and other materials related to such
30 * distribution and use acknowledge that the software was developed
31 * by the author.
32 *
33 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
35 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
36 *
37 * $Id: eap_plugin.h,v 1.4 2003/08/14 00:00:29 callie Exp $
38 */
39
40 /* ----------------------------------------------------------------------
41 IMPORTANT: EAP Plugin API is not stable.
42 The API will change in the upcoming releases
43 ---------------------------------------------------------------------- */
44
45 #ifndef __EAP_SIM__
46 #define __EAP_SIM__
47
48 #include "eap.h"
49
50 /* EAP-AKA Subtypes */
51 #define EAP_AKA_SUBTYPE_CHALLENGE 1
52 #define EAP_AKA_SUBTYPE_AUTH_REJECT 2
53 #define EAP_AKA_SUBTYPE_SYNC_FAIL 4
54 #define EAP_AKA_SUBTYPE_IDENTITY 5
55 #define EAP_AKA_SUBTYPE_NOTIFICATION 12
56 #define EAP_AKA_SUBTYPE_REAUTH 13
57 #define EAP_AKA_SUBTYPE_CLIENT_ERROR 14
58
59 /* EAP-SIM Subtypes */
60 #define EAP_SIM_SUBTYPE_START 10
61 #define EAP_SIM_SUBTYPE_CHALLENGE 11
62 #define EAP_SIM_SUBTYPE_NOTIFICATION 12
63 #define EAP_SIM_SUBTYPE_REAUTH 13
64 #define EAP_SIM_SUBTYPE_CLIENT_ERROR 14
65
66 /* Non-skippable attributes */
67 #define EAP_AT_RAND 1
68 #define EAP_AT_AUTN 2
69 #define EAP_AT_RES 3
70 #define EAP_AT_AUTS 4
71 #define EAP_AT_PADDING 6
72 #define EAP_AT_NONCE_MT 7
73 #define EAP_AT_PERMANENT_ID_REQ 10
74 #define EAP_AT_MAC 11
75 #define EAP_AT_NOTIFICATION 12
76 #define EAP_AT_ANY_ID_REQ 13
77 #define EAP_AT_IDENTITY 14
78 #define EAP_AT_VERSION_LIST 15
79 #define EAP_AT_SELECTED_VERSION 16
80 #define EAP_AT_FULL_AUTH_ID_REQ 17
81 #define EAP_AT_COUNTER 19
82 #define EAP_AT_COUNTER_TOO_SMALL 20
83 #define EAP_AT_NONCE_S 21
84 #define EAP_AT_CLIENT_ERROR_CODE 22
85 #define EAP_AT_KDF_INPUT 23
86 #define EAP_AT_KDF 24
87
88 /* Skippable attributes */
89 #define EAP_AT_IV 129
90 #define EAP_AT_ENCR_DATA 130
91 #define EAP_AT_NEXT_PSEUDONYM 132
92 #define EAP_AT_NEXT_REAUTH_ID 133
93 #define EAP_AT_CHECKCODE 134
94 #define EAP_AT_RESULT_IND 135
95 #define EAP_AT_BIDDING 136
96 #define EAP_AT_IPMS_IND 137
97 #define EAP_AT_IPMS_RES 138
98 #define EAP_AT_TRUST_IND 139
99
100 /* Attribute notification values */
101 #define EAP_AT_NOTIFICATION_GEN_FAIL_POST_AUTH 0 /* General failure after authentication */
102 #define EAP_AT_NOTIFICATION_USER_DENIED 1026 /* User has been temporarily denied access */
103 #define EAP_AT_NOTIFICATION_NOT_SUBSCRIBED 1031 /* User has not subscribed to the requested service */
104 #define EAP_AT_NOTIFICATION_GEN_FAIL 16384 /* General failure */
105 #define EAP_AT_NOTIFICATION_SUCCESS 32768 /* Success */
106
107 #define EAP_SIM_VERSION_1 1
108
109 typedef struct eap_sim_hdr {
110 u_int8_t eap_type; /* Must be EAP-SIM, 18 */
111 u_int8_t eap_subtype;
112 u_int16_t reserved;
113 } __attribute__((__packed__)) eap_sim_hdr_t;
114
115 typedef struct eap_sim_attribute {
116 u_int8_t at_type;
117 u_int8_t at_len;
118 u_int16_t at_value;
119 /* Followed by variable-length value */
120 } __attribute__((__packed__)) eap_sim_attr_t;
121
122 typedef struct eap_sim_msg {
123 eap_sim_hdr_t eap_hdr;
124 eap_sim_attr_t payload[0]; /* Multiple attributes */
125 } __attribute__((__packed__)) eap_sim_t;
126
127 int EAPSIMIdentity(char *identity, int maxlen);
128 int EAPSIMInit(EAP_Input_t *eap_in, void **context, CFDictionaryRef options);
129 int EAPSIMDispose(void *context);
130 int EAPSIMProcess(void *context, EAP_Input_t *eap_in, EAP_Output_t *eap_out);
131 int EAPSIMFree(void *context, EAP_Output_t *eap_out);
132 int EAPSIMGetAttribute(void *context, EAP_Attribute_t *eap_attr);
133
134 int EAPAKAIdentity(char *identity, int maxlen);
135 int EAPAKAInit(EAP_Input_t *eap_in, void **context, CFDictionaryRef options);
136 int EAPAKADispose(void *context);
137 int EAPAKAProcess(void *context, EAP_Input_t *eap_in, EAP_Output_t *eap_out);
138 int EAPAKAFree(void *context, EAP_Output_t *eap_out);
139 int EAPAKAGetAttribute(void *context, EAP_Attribute_t *eap_attr);
140
141 #endif