1 /* profiles.c Definitions of stringprep profiles.
2 * Copyright (C) 2002, 2003, 2004 Simon Josefsson
4 * This file is part of GNU Libidn.
6 * GNU Libidn is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GNU Libidn; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "stringprep.h"
24 const Stringprep_profiles stringprep_profiles
[] = {
25 {"Nameprep", stringprep_nameprep
},
26 {"KRBprep", stringprep_kerberos5
}, /* Deprecate? */
27 {"Nodeprep", stringprep_xmpp_nodeprep
},
28 {"Resourceprep", stringprep_xmpp_resourceprep
},
29 {"plain", stringprep_plain
}, /* sasl-anon-00. */
30 {"trace", stringprep_trace
}, /* sasl-anon-01,02. */
31 {"SASLprep", stringprep_saslprep
},
32 {"ISCSIprep", stringprep_iscsi
}, /* Obsolete. */
33 {"iSCSI", stringprep_iscsi
}, /* IANA. */
37 const Stringprep_profile stringprep_nameprep
[] = {
38 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
39 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_2
},
40 {STRINGPREP_NFKC
, 0, 0},
41 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_1_2
},
42 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
43 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
44 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
45 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
46 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
47 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_7
},
48 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
49 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
50 {STRINGPREP_BIDI
, 0, 0},
51 {STRINGPREP_BIDI_PROHIBIT_TABLE
, ~STRINGPREP_NO_BIDI
,
52 stringprep_rfc3454_C_8
},
53 {STRINGPREP_BIDI_RAL_TABLE
, 0, stringprep_rfc3454_D_1
},
54 {STRINGPREP_BIDI_L_TABLE
, 0, stringprep_rfc3454_D_2
},
55 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
56 stringprep_rfc3454_A_1
},
60 const Stringprep_profile stringprep_kerberos5
[] = {
61 /* XXX this is likely to be wrong as the specification is
63 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
64 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_3
},
65 {STRINGPREP_NFKC
, 0, 0},
66 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_1_2
},
67 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
68 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
69 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
70 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
71 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
72 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_7
},
73 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
74 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
75 {STRINGPREP_BIDI
, 0, 0},
76 {STRINGPREP_BIDI_PROHIBIT_TABLE
, ~STRINGPREP_NO_BIDI
,
77 stringprep_rfc3454_C_8
},
78 {STRINGPREP_BIDI_RAL_TABLE
, 0, stringprep_rfc3454_D_1
},
79 {STRINGPREP_BIDI_L_TABLE
, 0, stringprep_rfc3454_D_2
},
80 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
81 stringprep_rfc3454_A_1
},
85 const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit
[] = {
86 {0x000022}, /* #x22 (") */
87 {0x000026}, /* #x26 (&) */
88 {0x000027}, /* #x27 (') */
89 {0x00002F}, /* #x2F (/) */
90 {0x00003A}, /* #x3A (:) */
91 {0x00003C}, /* #x3C (<) */
92 {0x00003E}, /* #x3E (>) */
93 {0x000040}, /* #x40 (@) */
97 const Stringprep_profile stringprep_xmpp_nodeprep
[] = {
98 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
99 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_2
},
100 {STRINGPREP_NFKC
, 0, 0},
101 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_1_1
},
102 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_1_2
},
103 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
104 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
105 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
106 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
107 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
108 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
109 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_7
},
110 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
111 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
112 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_xmpp_nodeprep_prohibit
},
113 {STRINGPREP_BIDI
, 0, 0},
114 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
115 {STRINGPREP_BIDI_RAL_TABLE
, 0, stringprep_rfc3454_D_1
},
116 {STRINGPREP_BIDI_L_TABLE
, 0, stringprep_rfc3454_D_2
},
117 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
118 stringprep_rfc3454_A_1
},
122 const Stringprep_profile stringprep_xmpp_resourceprep
[] = {
123 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
124 {STRINGPREP_NFKC
, 0, 0},
125 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_1_2
},
126 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
127 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
128 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
129 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
130 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
131 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
132 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_7
},
133 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
134 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
135 {STRINGPREP_BIDI
, 0, 0},
136 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
137 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_1
},
138 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_2
},
139 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
140 stringprep_rfc3454_A_1
},
144 const Stringprep_profile stringprep_plain
[] = {
145 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
146 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
147 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
148 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
149 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
150 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
151 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
152 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
153 {STRINGPREP_BIDI
, 0, 0},
154 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
155 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_1
},
156 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_2
},
160 const Stringprep_profile stringprep_trace
[] = {
161 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
162 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
163 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
164 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
165 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
166 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
167 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
168 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
169 {STRINGPREP_BIDI
, 0, 0},
170 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
171 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_1
},
172 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_2
},
176 const Stringprep_table_element stringprep_iscsi_prohibit
[] = {
177 {0x0000}, /* [ASCII CONTROL CHARACTERS and SPACE through ,] */
222 {0x002F}, /* [ASCII /] */
223 {0x003B}, /* [ASCII ; through @] */
229 {0x005B}, /* [ASCII [ through `] */
235 {0x007B}, /* [ASCII { through DEL] */
240 {0x3002}, /* ideographic full stop */
244 const Stringprep_profile stringprep_iscsi
[] = {
245 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
246 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_2
},
247 {STRINGPREP_NFKC
, 0, 0},
248 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
249 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
250 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
251 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
252 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
253 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
254 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
255 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
256 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
257 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
258 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_iscsi_prohibit
},
259 {STRINGPREP_BIDI
, 0, 0},
260 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
261 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_1
},
262 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_2
},
263 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
264 stringprep_rfc3454_A_1
},
268 const Stringprep_table_element stringprep_saslprep_space_map
[] = {
269 {0x0000A0, 0, {0x0020}}, /* 00A0; NO-BREAK SPACE */
270 {0x001680, 0, {0x0020}}, /* 1680; OGHAM SPACE MARK */
271 {0x002000, 0, {0x0020}}, /* 2000; EN QUAD */
272 {0x002001, 0, {0x0020}}, /* 2001; EM QUAD */
273 {0x002002, 0, {0x0020}}, /* 2002; EN SPACE */
274 {0x002003, 0, {0x0020}}, /* 2003; EM SPACE */
275 {0x002004, 0, {0x0020}}, /* 2004; THREE-PER-EM SPACE */
276 {0x002005, 0, {0x0020}}, /* 2005; FOUR-PER-EM SPACE */
277 {0x002006, 0, {0x0020}}, /* 2006; SIX-PER-EM SPACE */
278 {0x002007, 0, {0x0020}}, /* 2007; FIGURE SPACE */
279 {0x002008, 0, {0x0020}}, /* 2008; PUNCTUATION SPACE */
280 {0x002009, 0, {0x0020}}, /* 2009; THIN SPACE */
281 {0x00200A, 0, {0x0020}}, /* 200A; HAIR SPACE */
282 {0x00200B, 0, {0x0020}}, /* 200B; ZERO WIDTH SPACE */
283 {0x00202F, 0, {0x0020}}, /* 202F; NARROW NO-BREAK SPACE */
284 {0x00205F, 0, {0x0020}}, /* 205F; MEDIUM MATHEMATICAL SPACE */
285 {0x003000, 0, {0x0020}}, /* 3000; IDEOGRAPHIC SPACE */
289 const Stringprep_profile stringprep_saslprep
[] = {
290 {STRINGPREP_MAP_TABLE
, 0, stringprep_saslprep_space_map
},
291 {STRINGPREP_MAP_TABLE
, 0, stringprep_rfc3454_B_1
},
292 {STRINGPREP_NFKC
, 0, 0},
293 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
294 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_1
},
295 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_2_2
},
296 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_3
},
297 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_4
},
298 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_5
},
299 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_6
},
300 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_7
},
301 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
302 {STRINGPREP_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_9
},
303 {STRINGPREP_BIDI
, 0, 0},
304 {STRINGPREP_BIDI_PROHIBIT_TABLE
, 0, stringprep_rfc3454_C_8
},
305 {STRINGPREP_BIDI_RAL_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_1
},
306 {STRINGPREP_BIDI_L_TABLE
, ~STRINGPREP_NO_BIDI
, stringprep_rfc3454_D_2
},
307 {STRINGPREP_UNASSIGNED_TABLE
, ~STRINGPREP_NO_UNASSIGNED
,
308 stringprep_rfc3454_A_1
},