]> git.zerfleddert.de Git - proxmark3-svn/blame - client/reveng/preset.c
ADD: Mifare Desfire defines
[proxmark3-svn] / client / reveng / preset.c
CommitLineData
a78a3d9d 1/* preset.c
2 * Greg Cook, 24/Feb/2016
3 */
4
5/* CRC RevEng, an arbitrary-precision CRC calculator and algorithm finder
6 * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Gregory Cook
7 *
8 * This file is part of CRC RevEng.
9 *
10 * CRC RevEng is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * CRC RevEng is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with CRC RevEng. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/* 2016-02-23: added 11 new algorithms, 4 new aliases
25 * 2016-02-22: split off from model.c
26 * 2016-02-22: preset points to primary alias, eliminated strcmp()
27 * 2016-02-22: eliminated bogus calls to bsearch()
28 * 2015-07-29: eliminated struct malias.isprimry
29 * 2014-01-14: added CRC-8/DVB-S2
30 * 2014-01-11: corrected CRC-40/GSM, added alias CRC-8/AES
31 * 2013-10-14: added CRC-13/BBC and six cdma2000 algorithms
32 * 2013-06-11: ensure BMP_BIT is an integer constant to compile presets
33 * 2013-01-20: big polynomials autogenerated, corrected CRC-82/DARC
34 * 2012-07-19: added CRC-8/EBU
35 * 2012-07-16: added CRC-15/MPT1327
36 * 2012-05-25: removed CRC-1/PARITY-EVEN, CRC-1/PARITY-ODD
37 * 2012-04-12: added model CRC-31/PHILIPS
38 * 2012-02-20: corrected model CRC-6/DARC
39 * 2011-08-28: added model CRC-64/XZ
40 * 2011-04-30: added models CRC-16/TMS37157 and CRC-A, and alias CRC-B
41 * 2011-02-10: made preset models ANSI C compliant
42 * 2011-01-17: fixed ANSI C warnings (except preset models)
43 * 2011-01-01: added mbynum(), mcount()
44 * 2010-12-26: renamed CRC RevEng
45 * 2010-12-18: minor change to mtostr() output format
46 * 2010-12-15: added mcmp(), mmatch()
47 * 2010-12-14: finished mbynam(), mnames()
48 * 2010-12-13: restarted with PCONST macros
49 * 2010-12-12: was having so much fun I didn't think to try compiling. :(
50 * 2010-12-12: started models.c
51 */
52
53#include <ctype.h>
54#include <stdio.h>
55#include <stdlib.h>
56#include <string.h>
57#include "reveng.h"
58
59/* Private declarations */
60
61/* incomplete type declaration to permit cross-reference */
62struct malias;
63
64struct mpreset {
65 const unsigned long width; /* width of CRC algorithm */
66 const bmp_t *const bspoly; /* polynomial with highest-order term removed. length determines CRC width */
67 const bmp_t *const binit; /* initial register value. length == poly.length */
68 const int flags; /* P_REFIN and P_REFOUT indicate reflected input/output */
69 const bmp_t *const bxorout; /* final register XOR mask. length == poly.length */
70 const bmp_t *const bcheck; /* optional check value, the CRC of the UTF-8 string "123456789" */
71 const struct malias *const alias; /* optional canonical name of the model */
72};
73
74struct malias {
75 const char *name; /* name of alias */
76 const struct mpreset *const model; /* corresponding model */
77};
78
79#ifdef PRESETS
80# if BMP_BIT < 32
81# error config.h: BMP_BIT must be an integer constant macro to compile presets
82# else /* BMP_BIT */
83
84/* Big polynomial constants. */
85
86/* Directives for relink.pl */
87/* CONSTANT b40 = (40, 0x0004820009) */
88/* CONSTANT b40a = (40, 0xffffffffff) */
89/* CONSTANT b40b = (40, 0xd4164fc646) */
90/* CONSTANT b64 = (64, 0x42f0e1eba9ea3693) */
91/* CONSTANT b64a = (64, 0x6c40df5f0b497347) */
92/* CONSTANT b64b = (64, 0xffffffffffffffff) */
93/* CONSTANT b64c = (64, 0x62ec59e3f1a4f00a) */
94/* CONSTANT b64d = (64, 0x995dc9bbdf1939fa) */
95/* CONSTANT b82 = (82, 0x0308c0111011401440411) */
96/* CONSTANT b82a = (82, 0x09ea83f625023801fd612) */
97
98/* The next section was generated by relink.pl from the directives above. */
99
100/* DO NOT EDIT the section below, INCLUDING the next comment. */
101/* BEGIN AUTO-GENERATED CONSTANTS */
102# if BMP_BIT >= 40
103static const bmp_t b40[] = {
104 BMP_C(0x0004820009) << (BMP_BIT - 40),
105};
106static const bmp_t b40a[] = {
107 BMP_C(0xffffffffff) << (BMP_BIT - 40),
108};
109static const bmp_t b40b[] = {
110 BMP_C(0xd4164fc646) << (BMP_BIT - 40),
111};
112# else /* BMP_BIT */
113static const bmp_t b40[] = {
114 BMP_C(0x00048200) << (BMP_BIT - 32) | BMP_C(0x04) >> (39 - BMP_BIT),
115 BMP_C(0x09) << (BMP_BIT * 2 - 40),
116};
117static const bmp_t b40a[] = {
118 BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7f) >> (39 - BMP_BIT),
119 BMP_C(0xff) << (BMP_BIT * 2 - 40),
120};
121static const bmp_t b40b[] = {
122 BMP_C(0xd4164fc6) << (BMP_BIT - 32) | BMP_C(0x23) >> (39 - BMP_BIT),
123 BMP_C(0x46) << (BMP_BIT * 2 - 40),
124};
125# endif /* BMP_BIT */
126
127# if BMP_BIT >= 64
128static const bmp_t b64[] = {
129 BMP_C(0x42f0e1eba9ea3693) << (BMP_BIT - 64),
130};
131static const bmp_t b64a[] = {
132 BMP_C(0x6c40df5f0b497347) << (BMP_BIT - 64),
133};
134static const bmp_t b64b[] = {
135 BMP_C(0xffffffffffffffff) << (BMP_BIT - 64),
136};
137static const bmp_t b64c[] = {
138 BMP_C(0x62ec59e3f1a4f00a) << (BMP_BIT - 64),
139};
140static const bmp_t b64d[] = {
141 BMP_C(0x995dc9bbdf1939fa) << (BMP_BIT - 64),
142};
143# else /* BMP_BIT */
144static const bmp_t b64[] = {
145 BMP_C(0x42f0e1eb) << (BMP_BIT - 32) | BMP_C(0x54f51b49) >> (63 - BMP_BIT),
146 BMP_C(0xa9ea3693) << (BMP_BIT * 2 - 64),
147};
148static const bmp_t b64a[] = {
149 BMP_C(0x6c40df5f) << (BMP_BIT - 32) | BMP_C(0x05a4b9a3) >> (63 - BMP_BIT),
150 BMP_C(0x0b497347) << (BMP_BIT * 2 - 64),
151};
152static const bmp_t b64b[] = {
153 BMP_C(0xffffffff) << (BMP_BIT - 32) | BMP_C(0x7fffffff) >> (63 - BMP_BIT),
154 BMP_C(0xffffffff) << (BMP_BIT * 2 - 64),
155};
156static const bmp_t b64c[] = {
157 BMP_C(0x62ec59e3) << (BMP_BIT - 32) | BMP_C(0x78d27805) >> (63 - BMP_BIT),
158 BMP_C(0xf1a4f00a) << (BMP_BIT * 2 - 64),
159};
160static const bmp_t b64d[] = {
161 BMP_C(0x995dc9bb) << (BMP_BIT - 32) | BMP_C(0x6f8c9cfd) >> (63 - BMP_BIT),
162 BMP_C(0xdf1939fa) << (BMP_BIT * 2 - 64),
163};
164# endif /* BMP_BIT */
165
166# if BMP_BIT >= 82
167static const bmp_t b82[] = {
168 BMP_C(0x0308c0111011401440411) << (BMP_BIT - 82),
169};
170static const bmp_t b82a[] = {
171 BMP_C(0x09ea83f625023801fd612) << (BMP_BIT - 82),
172};
173# elif BMP_BIT >= 41
174static const bmp_t b82[] = {
175 BMP_C(0x01846008880) << (BMP_BIT - 41) | BMP_C(0x08a00a20208) >> (81 - BMP_BIT),
176 BMP_C(0x11401440411) << (BMP_BIT * 2 - 82),
177};
178static const bmp_t b82a[] = {
179 BMP_C(0x04f541fb128) << (BMP_BIT - 41) | BMP_C(0x011c00feb09) >> (81 - BMP_BIT),
180 BMP_C(0x023801fd612) << (BMP_BIT * 2 - 82),
181};
182# else /* BMP_BIT */
183static const bmp_t b82[] = {
184 BMP_C(0x0c230044) << (BMP_BIT - 32) | BMP_C(0x040) >> (40 - BMP_BIT),
185 BMP_C(0x40450051) << (BMP_BIT * 2 - 64) | BMP_C(0x00104) >> (80 - BMP_BIT * 2),
186 BMP_C(0x00411) << (BMP_BIT * 3 - 82),
187};
188static const bmp_t b82a[] = {
189 BMP_C(0x27aa0fd8) << (BMP_BIT - 32) | BMP_C(0x094) >> (40 - BMP_BIT),
190 BMP_C(0x9408e007) << (BMP_BIT * 2 - 64) | BMP_C(0x0f584) >> (80 - BMP_BIT * 2),
191 BMP_C(0x3d612) << (BMP_BIT * 3 - 82),
192};
193# endif /* BMP_BIT */
194
195/* END AUTO-GENERATED CONSTANTS */
196/* DO NOT EDIT the section above, INCLUDING the previous comment. */
197
198/* Array of the polynomial bitmaps used in the model table. */
199static const bmp_t b32[] = {
200 BMP_C(0x00000000) << (BMP_BIT - 32), /* 0 -- 5, 00 */
201 BMP_C(0x000000af) << (BMP_BIT - 32), /* 1 -- 32,000000af */
202 BMP_C(0x00010000) << (BMP_BIT - 32), /* 2 -- 16, 0001 */
203 BMP_C(0x00020000) << (BMP_BIT - 32), /* 3 -- 15, 0001 */
204 BMP_C(0x00065b00) << (BMP_BIT - 32), /* 4 -- 24, 00065b */
205 BMP_C(0x007e0000) << (BMP_BIT - 32), /* 5 -- 16, 007e */
206 BMP_C(0x007f0000) << (BMP_BIT - 32), /* 6 -- 16, 007f */
207 BMP_C(0x03400000) << (BMP_BIT - 32), /* 7 -- 11, 01a */
208 BMP_C(0x0376e6e7) << (BMP_BIT - 32), /* 8 -- 32,0376e6e7 */
209 BMP_C(0x04c11db7) << (BMP_BIT - 32), /* 9 -- 32,04c11db7 */
210 BMP_C(0x05890000) << (BMP_BIT - 32), /* 10 -- 16, 0589 */
211 BMP_C(0x07000000) << (BMP_BIT - 32), /* 11 -- 8, 07 */
212 BMP_C(0x09823b6e) << (BMP_BIT - 32), /* 12 -- 31,04c11db7 */
213 BMP_C(0x0b3c0000) << (BMP_BIT - 32), /* 13 -- 15, 059e */
214 BMP_C(0x0c000000) << (BMP_BIT - 32), /* 14 -- 6, 03 */
215 BMP_C(0x0c200000) << (BMP_BIT - 32), /* 15 -- 11, 061 */
216 BMP_C(0x0fb30000) << (BMP_BIT - 32), /* 16 -- 16, 0fb3 */
217 BMP_C(0x10210000) << (BMP_BIT - 32), /* 17 -- 16, 1021 */
218 BMP_C(0x12000000) << (BMP_BIT - 32), /* 18 -- 7, 09 */
219 BMP_C(0x130d2afc) << (BMP_BIT - 32), /* 19 -- 30,04c34abf */
220 BMP_C(0x15000000) << (BMP_BIT - 32), /* 20 -- 8, 15 */
221 BMP_C(0x18000000) << (BMP_BIT - 32), /* 21 -- 6, 06 */
222 BMP_C(0x19d3c8d8) << (BMP_BIT - 32), /* 22 -- 31,0ce9e46c */
223 BMP_C(0x1c000000) << (BMP_BIT - 32), /* 23 -- 6, 07 */
224 BMP_C(0x1d000000) << (BMP_BIT - 32), /* 24 -- 8, 1d */
225 BMP_C(0x1d0f0000) << (BMP_BIT - 32), /* 25 -- 16, 1d0f */
226 BMP_C(0x1edc6f41) << (BMP_BIT - 32), /* 26 -- 32,1edc6f41 */
227 BMP_C(0x1f23b800) << (BMP_BIT - 32), /* 27 -- 24, 1f23b8 */
228 BMP_C(0x20140000) << (BMP_BIT - 32), /* 28 -- 14, 0805 */
229 BMP_C(0x20b40000) << (BMP_BIT - 32), /* 29 -- 14, 082d */
230 BMP_C(0x21890000) << (BMP_BIT - 32), /* 30 -- 16, 2189 */
231 BMP_C(0x21cf0200) << (BMP_BIT - 32), /* 31 -- 24, 21cf02 */
232 BMP_C(0x23ef5200) << (BMP_BIT - 32), /* 32 -- 24, 23ef52 */
233 BMP_C(0x25000000) << (BMP_BIT - 32), /* 33 -- 8, 25 */
234 BMP_C(0x26b10000) << (BMP_BIT - 32), /* 34 -- 16, 26b1 */
235 BMP_C(0x27d00000) << (BMP_BIT - 32), /* 35 -- 13, 04fa */
236 BMP_C(0x28000000) << (BMP_BIT - 32), /* 36 -- 5, 05 */
237 BMP_C(0x29b10000) << (BMP_BIT - 32), /* 37 -- 16, 29b1 */
238 BMP_C(0x30000000) << (BMP_BIT - 32), /* 38 -- 4, 3 */
239 BMP_C(0x3010bf7f) << (BMP_BIT - 32), /* 39 -- 32,3010bf7f */
240 BMP_C(0x31000000) << (BMP_BIT - 32), /* 40 -- 8, 31 */
241 BMP_C(0x31c30000) << (BMP_BIT - 32), /* 41 -- 16, 31c3 */
242 BMP_C(0x328b6300) << (BMP_BIT - 32), /* 42 -- 24, 328b63 */
243 BMP_C(0x34000000) << (BMP_BIT - 32), /* 43 -- 6, 0d */
244 BMP_C(0x340bc6d9) << (BMP_BIT - 32), /* 44 -- 32,340bc6d9 */
245 BMP_C(0x38000000) << (BMP_BIT - 32), /* 45 -- 5, 07 */
246 BMP_C(0x39000000) << (BMP_BIT - 32), /* 46 -- 8, 39 */
247 BMP_C(0x3d650000) << (BMP_BIT - 32), /* 47 -- 16, 3d65 */
248 BMP_C(0x44c20000) << (BMP_BIT - 32), /* 48 -- 16, 44c2 */
249 BMP_C(0x48000000) << (BMP_BIT - 32), /* 49 -- 5, 09 */
250 BMP_C(0x4acc0000) << (BMP_BIT - 32), /* 50 -- 15, 2566 */
251 BMP_C(0x4b000000) << (BMP_BIT - 32), /* 51 -- 8, 4b */
252 BMP_C(0x4b370000) << (BMP_BIT - 32), /* 52 -- 16, 4b37 */
253 BMP_C(0x4c060000) << (BMP_BIT - 32), /* 53 -- 16, 4c06 */
254 BMP_C(0x55000000) << (BMP_BIT - 32), /* 54 -- 8, 55 */
255 BMP_C(0x55555500) << (BMP_BIT - 32), /* 55 -- 24, 555555 */
256 BMP_C(0x5d6dcb00) << (BMP_BIT - 32), /* 56 -- 24, 5d6dcb */
257 BMP_C(0x60000000) << (BMP_BIT - 32), /* 57 -- 3, 3 */
258 BMP_C(0x60e00000) << (BMP_BIT - 32), /* 58 -- 11, 307 */
259 BMP_C(0x63d00000) << (BMP_BIT - 32), /* 59 -- 16, 63d0 */
260 BMP_C(0x64000000) << (BMP_BIT - 32), /* 60 -- 6, 19 */
261 BMP_C(0x66400000) << (BMP_BIT - 32), /* 61 -- 10, 199 */
262 BMP_C(0x6f630000) << (BMP_BIT - 32), /* 62 -- 16, 6f63 */
263 BMP_C(0x6f910000) << (BMP_BIT - 32), /* 63 -- 16, 6f91 */
264 BMP_C(0x70000000) << (BMP_BIT - 32), /* 64 -- 4, 7 */
265 BMP_C(0x70a00000) << (BMP_BIT - 32), /* 65 -- 11, 385 */
266 BMP_C(0x765e7680) << (BMP_BIT - 32), /* 66 -- 32,765e7680 */
267 BMP_C(0x7979bd00) << (BMP_BIT - 32), /* 67 -- 24, 7979bd */
268 BMP_C(0x7e000000) << (BMP_BIT - 32), /* 68 -- 8, 7e */
269 BMP_C(0x80006300) << (BMP_BIT - 32), /* 69 -- 24, 800063 */
270 BMP_C(0x80050000) << (BMP_BIT - 32), /* 70 -- 16, 8005 */
271 BMP_C(0x800d0000) << (BMP_BIT - 32), /* 71 -- 16, 800d */
272 BMP_C(0x80c2e71c) << (BMP_BIT - 32), /* 72 -- 30,2030b9c7 */
273 BMP_C(0x80f00000) << (BMP_BIT - 32), /* 73 -- 12, 80f */
274 BMP_C(0x814141ab) << (BMP_BIT - 32), /* 74 -- 32,814141ab */
275 BMP_C(0x864cfb00) << (BMP_BIT - 32), /* 75 -- 24, 864cfb */
276 BMP_C(0x87315576) << (BMP_BIT - 32), /* 76 -- 32,87315576 */
277 BMP_C(0x89ec0000) << (BMP_BIT - 32), /* 77 -- 16, 89ec */
278 BMP_C(0x8a000000) << (BMP_BIT - 32), /* 78 -- 7, 45 */
279 BMP_C(0x8b320000) << (BMP_BIT - 32), /* 79 -- 15, 4599 */
280 BMP_C(0x8bb70000) << (BMP_BIT - 32), /* 80 -- 16, 8bb7 */
281 BMP_C(0x8cc00000) << (BMP_BIT - 32), /* 81 -- 10, 233 */
282 BMP_C(0x906e0000) << (BMP_BIT - 32), /* 82 -- 16, 906e */
283 BMP_C(0x97000000) << (BMP_BIT - 32), /* 83 -- 8, 97 */
284 BMP_C(0x98000000) << (BMP_BIT - 32), /* 84 -- 6, 26 */
285 BMP_C(0x9b000000) << (BMP_BIT - 32), /* 85 -- 8, 9b */
286 BMP_C(0x9c000000) << (BMP_BIT - 32), /* 86 -- 6, 27 */
287 BMP_C(0x9e000000) << (BMP_BIT - 32), /* 87 -- 7, 4f */
288 BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 88 -- 16, 9ecf */
289 BMP_C(0xa0970000) << (BMP_BIT - 32), /* 89 -- 16, a097 */
290 BMP_C(0xa1000000) << (BMP_BIT - 32), /* 90 -- 8, a1 */
291 BMP_C(0xa6000000) << (BMP_BIT - 32), /* 91 -- 7, 53 */
292 BMP_C(0xa8000000) << (BMP_BIT - 32), /* 92 -- 5, 15 */
293 BMP_C(0xa833982b) << (BMP_BIT - 32), /* 93 -- 32,a833982b */
294 BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 94 -- 24, abcdef */
295 BMP_C(0xb0000000) << (BMP_BIT - 32), /* 95 -- 4, b */
296 BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 96 -- 16, b2aa */
297 BMP_C(0xb4600000) << (BMP_BIT - 32), /* 97 -- 11, 5a3 */
298 BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 98 -- 16, b4c8 */
299 BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 99 -- 24, b4f3e6 */
300 BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 100 -- 24, b704ce */
301 BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 101 -- 16, bb3d */
302 BMP_C(0xbc000000) << (BMP_BIT - 32), /* 102 -- 8, bc */
303 BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 103 -- 32,bd0be338 */
304 BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 104 -- 16, bdf4 */
305 BMP_C(0xbf050000) << (BMP_BIT - 32), /* 105 -- 16, bf05 */
306 BMP_C(0xc0000000) << (BMP_BIT - 32), /* 106 -- 3, 6 */
307 BMP_C(0xc2000000) << (BMP_BIT - 32), /* 107 -- 7, 61 */
308 BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 108 -- 24, c25a56 */
309 BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 109 -- 16, c2b7 */
310 BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 110 -- 16, c6c6 */
311 BMP_C(0xc8000000) << (BMP_BIT - 32), /* 111 -- 5, 19 */
312 BMP_C(0xc8670000) << (BMP_BIT - 32), /* 112 -- 16, c867 */
313 BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 113 -- 32,cbf43926 */
314 BMP_C(0xcde70300) << (BMP_BIT - 32), /* 114 -- 24, cde703 */
315 BMP_C(0xd0000000) << (BMP_BIT - 32), /* 115 -- 8, d0 */
316 BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 116 -- 15, 6815 */
317 BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 117 -- 16, d0db */
318 BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 118 -- 12, d4d */
319 BMP_C(0xd5000000) << (BMP_BIT - 32), /* 119 -- 8, d5 */
320 BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 120 -- 16, d64e */
321 BMP_C(0xda000000) << (BMP_BIT - 32), /* 121 -- 8, da */
322 BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 122 -- 12, daf */
323 BMP_C(0xe0000000) << (BMP_BIT - 32), /* 123 -- 3, 7 */
324 BMP_C(0xe3069283) << (BMP_BIT - 32), /* 124 -- 32,e3069283 */
325 BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 125 -- 16, e5cc */
326 BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 126 -- 13, 1cf5 */
327 BMP_C(0xea000000) << (BMP_BIT - 32), /* 127 -- 7, 75 */
328 BMP_C(0xea820000) << (BMP_BIT - 32), /* 128 -- 16, ea82 */
329 BMP_C(0xec000000) << (BMP_BIT - 32), /* 129 -- 6, 3b */
330 BMP_C(0xf0000000) << (BMP_BIT - 32), /* 130 -- 4, f */
331 BMP_C(0xf1300000) << (BMP_BIT - 32), /* 131 -- 12, f13 */
332 BMP_C(0xf4000000) << (BMP_BIT - 32), /* 132 -- 8, f4 */
333 BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 133 -- 12, f5b */
334 BMP_C(0xf6400000) << (BMP_BIT - 32), /* 134 -- 10, 3d9 */
335 BMP_C(0xf8000000) << (BMP_BIT - 32), /* 135 -- 5, 1f */
336 BMP_C(0xfc000000) << (BMP_BIT - 32), /* 136 -- 6, 3f */
337 BMP_C(0xfc891918) << (BMP_BIT - 32), /* 137 -- 32,fc891918 */
338 BMP_C(0xfd000000) << (BMP_BIT - 32), /* 138 -- 8, fd */
339 BMP_C(0xfe000000) << (BMP_BIT - 32), /* 139 -- 7, 7f */
340 BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 140 -- 24, fedcba */
341 BMP_C(0xfee80000) << (BMP_BIT - 32), /* 141 -- 16, fee8 */
342 BMP_C(0xff000000) << (BMP_BIT - 32), /* 142 -- 8, ff */
343 BMP_C(0xffc00000) << (BMP_BIT - 32), /* 143 -- 10, 3ff */
344 BMP_C(0xfff00000) << (BMP_BIT - 32), /* 144 -- 12, fff */
345 BMP_C(0xffff0000) << (BMP_BIT - 32), /* 145 -- 16, ffff */
346 BMP_C(0xffffff00) << (BMP_BIT - 32), /* 146 -- 24, ffffff */
347 BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 147 -- 30,3fffffff */
348 BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 148 -- 31,7fffffff */
349 BMP_C(0xffffffff) << (BMP_BIT - 32), /* 149 -- 32,ffffffff */
350};
351
352static const struct malias aliases[];
353
354/* Table of preset CRC models.
355 * Sorted by left-justified polynomial for bsearch().
356 */
357static const struct mpreset models[] = {
358 {32UL, b32+ 1, 0, P_BE, 0, b32+103, aliases+115}, /* 0 */
359 {40UL, b40, 0, P_BE, b40a, b40b, aliases+ 74}, /* 1 */
360 {24UL, b32+ 4, b32+ 55, P_LE, 0, b32+108, aliases+ 49}, /* 2 */
361 {32UL, b32+ 9, 0, P_BE, b32+149, b32+ 66, aliases+ 68}, /* 3 */
362 {32UL, b32+ 9, b32+149, P_BE, 0, b32+ 8, aliases+ 67}, /* 4 */
363 {32UL, b32+ 9, b32+149, P_BE, b32+149, b32+137, aliases+ 62}, /* 5 */
364 {32UL, b32+ 9, b32+149, P_LE, 0, b32+ 44, aliases+107}, /* 6 */
365 {32UL, b32+ 9, b32+149, P_LE, b32+149, b32+113, aliases+ 59}, /* 7 */
366 {16UL, b32+ 10, 0, P_BE, 0, b32+ 6, aliases+ 27}, /* 8 */
367 {16UL, b32+ 10, 0, P_BE, b32+ 2, b32+ 5, aliases+ 26}, /* 9 */
368 { 8UL, b32+ 11, 0, P_BE, 0, b32+132, aliases+ 88}, /* 10 */
369 { 8UL, b32+ 11, 0, P_BE, b32+ 54, b32+ 90, aliases+ 95}, /* 11 */
370 { 8UL, b32+ 11, b32+142, P_LE, 0, b32+115, aliases+ 98}, /* 12 */
371 {31UL, b32+ 12, b32+148, P_BE, b32+148, b32+ 22, aliases+ 58}, /* 13 */
372 { 6UL, b32+ 14, 0, P_LE, 0, b32+ 21, aliases+ 81}, /* 14 */
373 {82UL, b82, 0, P_LE, 0, b82a, aliases+101}, /* 15 */
374 {16UL, b32+ 17, 0, P_BE, 0, b32+ 41, aliases+116}, /* 16 */
375 {16UL, b32+ 17, 0, P_LE, 0, b32+ 30, aliases+108}, /* 17 */
376 {16UL, b32+ 17, b32+ 25, P_BE, 0, b32+125, aliases+ 18}, /* 18 */
377 {16UL, b32+ 17, b32+ 77, P_LE, 0, b32+ 34, aliases+ 44}, /* 19 */
378 {16UL, b32+ 17, b32+ 96, P_LE, 0, b32+ 59, aliases+ 40}, /* 20 */
379 {16UL, b32+ 17, b32+110, P_LE, 0, b32+105, aliases+102}, /* 21 */
380 {16UL, b32+ 17, b32+145, P_BE, 0, b32+ 37, aliases+ 21}, /* 22 */
381 {16UL, b32+ 17, b32+145, P_BE, b32+145, b32+120, aliases+ 31}, /* 23 */
382 {16UL, b32+ 17, b32+145, P_LE, 0, b32+ 63, aliases+ 39}, /* 24 */
383 {16UL, b32+ 17, b32+145, P_LE, b32+145, b32+ 82, aliases+112}, /* 25 */
384 { 7UL, b32+ 18, 0, P_BE, 0, b32+127, aliases+ 85}, /* 26 */
385 { 6UL, b32+ 23, b32+136, P_BE, 0, b32+129, aliases+ 79}, /* 27 */
386 { 8UL, b32+ 24, b32+138, P_BE, 0, b32+ 68, aliases+ 94}, /* 28 */
387 { 8UL, b32+ 24, b32+142, P_BE, b32+142, b32+ 51, aliases+ 99}, /* 29 */
388 { 8UL, b32+ 24, b32+142, P_LE, 0, b32+ 83, aliases+ 93}, /* 30 */
389 {32UL, b32+ 26, b32+149, P_LE, b32+149, b32+124, aliases+ 69}, /* 31 */
390 {14UL, b32+ 28, 0, P_LE, 0, b32+ 29, aliases+ 12}, /* 32 */
391 { 5UL, b32+ 36, b32+135, P_LE, b32+135, b32+111, aliases+ 77}, /* 33 */
392 { 4UL, b32+ 38, 0, P_LE, 0, b32+ 64, aliases+ 73}, /* 34 */
393 { 4UL, b32+ 38, b32+130, P_BE, b32+130, b32+ 95, aliases+ 72}, /* 35 */
394 { 8UL, b32+ 40, 0, P_LE, 0, b32+ 90, aliases+ 97}, /* 36 */
395 {24UL, b32+ 42, b32+146, P_BE, b32+146, b32+ 99, aliases+ 52}, /* 37 */
396 { 8UL, b32+ 46, 0, P_LE, 0, b32+ 20, aliases+ 91}, /* 38 */
397 {16UL, b32+ 47, 0, P_BE, b32+145, b32+109, aliases+ 29}, /* 39 */
398 {16UL, b32+ 47, 0, P_LE, b32+145, b32+128, aliases+ 28}, /* 40 */
399 {64UL, b64, 0, P_BE, 0, b64a, aliases+ 82}, /* 41 */
400 {64UL, b64, b64b, P_BE, b64b, b64c, aliases+ 83}, /* 42 */
401 {64UL, b64, b64b, P_LE, b64b, b64d, aliases+ 84}, /* 43 */
402 { 5UL, b32+ 49, b32+ 49, P_BE, 0, b32+ 0, aliases+ 75}, /* 44 */
403 {24UL, b32+ 56, b32+ 94, P_BE, 0, b32+ 27, aliases+ 51}, /* 45 */
404 {24UL, b32+ 56, b32+140, P_BE, 0, b32+ 67, aliases+ 50}, /* 46 */
405 { 3UL, b32+ 57, b32+123, P_LE, 0, b32+106, aliases+ 56}, /* 47 */
406 {11UL, b32+ 58, 0, P_BE, 0, b32+ 15, aliases+ 6}, /* 48 */
407 { 6UL, b32+ 60, 0, P_LE, 0, b32+ 84, aliases+ 80}, /* 49 */
408 {16UL, b32+ 62, 0, P_BE, 0, b32+104, aliases+ 36}, /* 50 */
409 {11UL, b32+ 65, b32+ 7, P_BE, 0, b32+ 97, aliases+ 5}, /* 51 */
410 {24UL, b32+ 69, 0, P_BE, 0, b32+ 32, aliases+ 54}, /* 52 */
411 {16UL, b32+ 70, 0, P_BE, 0, b32+141, aliases+ 19}, /* 53 */
412 {16UL, b32+ 70, 0, P_LE, 0, b32+101, aliases+ 0}, /* 54 */
413 {16UL, b32+ 70, 0, P_LE, b32+145, b32+ 48, aliases+ 38}, /* 55 */
414 {16UL, b32+ 70, b32+ 71, P_BE, 0, b32+ 88, aliases+ 25}, /* 56 */
415 {16UL, b32+ 70, b32+145, P_LE, 0, b32+ 52, aliases+109}, /* 57 */
416 {16UL, b32+ 70, b32+145, P_LE, b32+145, b32+ 98, aliases+ 46}, /* 58 */
417 {30UL, b32+ 72, b32+147, P_BE, b32+147, b32+ 19, aliases+ 57}, /* 59 */
418 {12UL, b32+ 73, 0, P_BE, 0, b32+133, aliases+ 9}, /* 60 */
419 {12UL, b32+ 73, 0, P_BELE, 0, b32+122, aliases+ 10}, /* 61 */
420 {32UL, b32+ 74, 0, P_BE, 0, b32+ 39, aliases+ 71}, /* 62 */
421 {24UL, b32+ 75, 0, P_BE, 0, b32+114, aliases+ 53}, /* 63 */
422 {24UL, b32+ 75, b32+100, P_BE, 0, b32+ 31, aliases+ 48}, /* 64 */
423 { 7UL, b32+ 78, 0, P_BE, 0, b32+107, aliases+ 87}, /* 65 */
424 {15UL, b32+ 79, 0, P_BE, 0, b32+ 13, aliases+ 13}, /* 66 */
425 {16UL, b32+ 80, 0, P_BE, 0, b32+117, aliases+ 42}, /* 67 */
426 {10UL, b32+ 81, 0, P_BE, 0, b32+ 61, aliases+ 3}, /* 68 */
427 { 8UL, b32+ 85, 0, P_BE, 0, b32+127, aliases+ 96}, /* 69 */
428 { 8UL, b32+ 85, 0, P_LE, 0, b32+ 33, aliases+100}, /* 70 */
429 { 8UL, b32+ 85, b32+142, P_BE, 0, b32+121, aliases+ 90}, /* 71 */
430 { 6UL, b32+ 86, b32+136, P_BE, 0, b32+ 43, aliases+ 78}, /* 72 */
431 { 7UL, b32+ 87, b32+139, P_LE, 0, b32+ 91, aliases+ 86}, /* 73 */
432 {16UL, b32+ 89, 0, P_BE, 0, b32+ 16, aliases+ 43}, /* 74 */
433 { 5UL, b32+ 92, 0, P_LE, 0, b32+ 45, aliases+ 76}, /* 75 */
434 {32UL, b32+ 93, b32+149, P_LE, b32+149, b32+ 76, aliases+ 70}, /* 76 */
435 {16UL, b32+112, b32+145, P_BE, 0, b32+ 53, aliases+ 23}, /* 77 */
436 {15UL, b32+116, 0, P_BE, b32+ 3, b32+ 50, aliases+ 14}, /* 78 */
437 { 8UL, b32+119, 0, P_BE, 0, b32+102, aliases+ 92}, /* 79 */
438 {13UL, b32+126, 0, P_BE, 0, b32+ 35, aliases+ 11}, /* 80 */
439 {12UL, b32+131, b32+144, P_BE, 0, b32+118, aliases+ 8}, /* 81 */
440 {10UL, b32+134, b32+143, P_BE, 0, b32+ 81, aliases+ 4}, /* 82 */
441 { 0UL, 0, 0, P_BE, 0, 0, NULL }, /* terminating entry */
442};
443# define NPRESETS 83
444
445/* List of names with pointers to models, pre-sorted for use with bsearch() */
446static const struct malias aliases[] = {
447 {"ARC", models+54}, /* 0 */
448 {"B-CRC-32", models+ 5}, /* 1 */
449 {"CKSUM", models+ 3}, /* 2 */
450 {"CRC-10", models+68}, /* 3 */
451 {"CRC-10/CDMA2000", models+82}, /* 4 */
452 {"CRC-11", models+51}, /* 5 */
453 {"CRC-11/UMTS", models+48}, /* 6 */
454 {"CRC-12/3GPP", models+61}, /* 7 */
455 {"CRC-12/CDMA2000", models+81}, /* 8 */
456 {"CRC-12/DECT", models+60}, /* 9 */
457 {"CRC-12/UMTS", models+61}, /* 10 */
458 {"CRC-13/BBC", models+80}, /* 11 */
459 {"CRC-14/DARC", models+32}, /* 12 */
460 {"CRC-15", models+66}, /* 13 */
461 {"CRC-15/MPT1327", models+78}, /* 14 */
462 {"CRC-16", models+54}, /* 15 */
463 {"CRC-16/ACORN", models+16}, /* 16 */
464 {"CRC-16/ARC", models+54}, /* 17 */
465 {"CRC-16/AUG-CCITT", models+18}, /* 18 */
466 {"CRC-16/BUYPASS", models+53}, /* 19 */
467 {"CRC-16/CCITT", models+17}, /* 20 */
468 {"CRC-16/CCITT-FALSE", models+22}, /* 21 */
469 {"CRC-16/CCITT-TRUE", models+17}, /* 22 */
470 {"CRC-16/CDMA2000", models+77}, /* 23 */
471 {"CRC-16/DARC", models+23}, /* 24 */
472 {"CRC-16/DDS-110", models+56}, /* 25 */
473 {"CRC-16/DECT-R", models+ 9}, /* 26 */
474 {"CRC-16/DECT-X", models+ 8}, /* 27 */
475 {"CRC-16/DNP", models+40}, /* 28 */
476 {"CRC-16/EN-13757", models+39}, /* 29 */
477 {"CRC-16/EPC", models+23}, /* 30 */
478 {"CRC-16/GENIBUS", models+23}, /* 31 */
479 {"CRC-16/I-CODE", models+23}, /* 32 */
480 {"CRC-16/IBM-SDLC", models+25}, /* 33 */
481 {"CRC-16/ISO-HDLC", models+25}, /* 34 */
482 {"CRC-16/LHA", models+54}, /* 35 */
483 {"CRC-16/LJ1200", models+50}, /* 36 */
484 {"CRC-16/LTE", models+16}, /* 37 */
485 {"CRC-16/MAXIM", models+55}, /* 38 */
486 {"CRC-16/MCRF4XX", models+24}, /* 39 */
487 {"CRC-16/RIELLO", models+20}, /* 40 */
488 {"CRC-16/SPI-FUJITSU", models+18}, /* 41 */
489 {"CRC-16/T10-DIF", models+67}, /* 42 */
490 {"CRC-16/TELEDISK", models+74}, /* 43 */
491 {"CRC-16/TMS37157", models+19}, /* 44 */
492 {"CRC-16/UMTS", models+53}, /* 45 */
493 {"CRC-16/USB", models+58}, /* 46 */
494 {"CRC-16/VERIFONE", models+53}, /* 47 */
495 {"CRC-24", models+64}, /* 48 */
496 {"CRC-24/BLE", models+ 2}, /* 49 */
497 {"CRC-24/FLEXRAY-A", models+46}, /* 50 */
498 {"CRC-24/FLEXRAY-B", models+45}, /* 51 */
499 {"CRC-24/INTERLAKEN", models+37}, /* 52 */
500 {"CRC-24/LTE-A", models+63}, /* 53 */
501 {"CRC-24/LTE-B", models+52}, /* 54 */
502 {"CRC-24/OPENPGP", models+64}, /* 55 */
503 {"CRC-3/ROHC", models+47}, /* 56 */
504 {"CRC-30/CDMA", models+59}, /* 57 */
505 {"CRC-31/PHILIPS", models+13}, /* 58 */
506 {"CRC-32", models+ 7}, /* 59 */
507 {"CRC-32/AAL5", models+ 5}, /* 60 */
508 {"CRC-32/ADCCP", models+ 7}, /* 61 */
509 {"CRC-32/BZIP2", models+ 5}, /* 62 */
510 {"CRC-32/CASTAGNOLI", models+31}, /* 63 */
511 {"CRC-32/DECT-B", models+ 5}, /* 64 */
512 {"CRC-32/INTERLAKEN", models+31}, /* 65 */
513 {"CRC-32/ISCSI", models+31}, /* 66 */
514 {"CRC-32/MPEG-2", models+ 4}, /* 67 */
515 {"CRC-32/POSIX", models+ 3}, /* 68 */
516 {"CRC-32C", models+31}, /* 69 */
517 {"CRC-32D", models+76}, /* 70 */
518 {"CRC-32Q", models+62}, /* 71 */
519 {"CRC-4/INTERLAKEN", models+35}, /* 72 */
520 {"CRC-4/ITU", models+34}, /* 73 */
521 {"CRC-40/GSM", models+ 1}, /* 74 */
522 {"CRC-5/EPC", models+44}, /* 75 */
523 {"CRC-5/ITU", models+75}, /* 76 */
524 {"CRC-5/USB", models+33}, /* 77 */
525 {"CRC-6/CDMA2000-A", models+72}, /* 78 */
526 {"CRC-6/CDMA2000-B", models+27}, /* 79 */
527 {"CRC-6/DARC", models+49}, /* 80 */
528 {"CRC-6/ITU", models+14}, /* 81 */
529 {"CRC-64", models+41}, /* 82 */
530 {"CRC-64/WE", models+42}, /* 83 */
531 {"CRC-64/XZ", models+43}, /* 84 */
532 {"CRC-7", models+26}, /* 85 */
533 {"CRC-7/ROHC", models+73}, /* 86 */
534 {"CRC-7/UMTS", models+65}, /* 87 */
535 {"CRC-8", models+10}, /* 88 */
536 {"CRC-8/AES", models+30}, /* 89 */
537 {"CRC-8/CDMA2000", models+71}, /* 90 */
538 {"CRC-8/DARC", models+38}, /* 91 */
539 {"CRC-8/DVB-S2", models+79}, /* 92 */
540 {"CRC-8/EBU", models+30}, /* 93 */
541 {"CRC-8/I-CODE", models+28}, /* 94 */
542 {"CRC-8/ITU", models+11}, /* 95 */
543 {"CRC-8/LTE", models+69}, /* 96 */
544 {"CRC-8/MAXIM", models+36}, /* 97 */
545 {"CRC-8/ROHC", models+12}, /* 98 */
546 {"CRC-8/SAE-J1850", models+29}, /* 99 */
547 {"CRC-8/WCDMA", models+70}, /* 100 */
548 {"CRC-82/DARC", models+15}, /* 101 */
549 {"CRC-A", models+21}, /* 102 */
550 {"CRC-B", models+25}, /* 103 */
551 {"CRC-CCITT", models+17}, /* 104 */
552 {"CRC-IBM", models+54}, /* 105 */
553 {"DOW-CRC", models+36}, /* 106 */
554 {"JAMCRC", models+ 6}, /* 107 */
555 {"KERMIT", models+17}, /* 108 */
556 {"MODBUS", models+57}, /* 109 */
557 {"PKZIP", models+ 7}, /* 110 */
558 {"R-CRC-16", models+ 9}, /* 111 */
559 {"X-25", models+25}, /* 112 */
560 {"X-CRC-12", models+60}, /* 113 */
561 {"X-CRC-16", models+ 8}, /* 114 */
562 {"XFER", models+ 0}, /* 115 */
563 {"XMODEM", models+16}, /* 116 */
564 {"ZMODEM", models+16}, /* 117 */
565 {NULL, NULL }, /* terminating entry */
566};
567# define NALIASES 118
568
569# endif /* BMP_BIT */
570#else /* PRESETS */
571
572static const struct mpreset models[] = {
573 { 0UL, 0, 0, P_BE, 0, 0, NULL }, /* terminating entry */
574};
575# define NPRESETS 0
576
577static const struct malias aliases[] = {
578 {NULL, NULL }, /* terminating entry */
579};
580# define NALIASES 0
581
582#endif /* PRESETS */
583
584static void munpack(model_t *, const struct mpreset *);
585
586/* copy a parameter of a preset to a poly */
587#define PUNPACK(poly, preset, field) {\
588 unsigned long iter, idx; \
589 praloc((poly), ((preset)->field ? (preset)->width : 0UL)); \
590 for(iter=0UL, idx=0UL; iter < (poly)->length; iter += BMP_BIT, ++idx) \
591 (poly)->bitmap[idx] = (preset)->field[idx]; \
592}
593
594/* copy a parameter of a preset into a model */
595#define MUNPACK(parm) PUNPACK(&dest->parm, src, b##parm)
596
597/* Definitions */
598
599int
600mbynam(model_t *dest, const char *key) {
601 /* Sets parameters in dest according to the model named by key.
602 */
603 size_t left = 0, right = NALIASES, middle = 0;
604 int cmp = 1;
605 char *ukey, *uptr;
606
607 if(!aliases->name)
608 return(-1);
609 if(!(ukey = malloc((size_t) 1 + strlen(key)))) {
610 uerror("cannot allocate memory for comparison string");
611 return(0);
612 }
613 uptr = ukey;
614 do
615 *uptr++ = toupper(*key);
616 while(*key++);
617
618 while(left < right && cmp) {
619 middle = (left >> 1) + (right >> 1);
620 cmp = strcmp(ukey, aliases[middle].name);
621 if(cmp < 0) right = middle;
622 else if(cmp > 0) left = middle + 1;
623 }
624 free(ukey);
625
626 if(cmp)
627 return(0);
628 munpack(dest, aliases[middle].model);
629 return(1);
630}
631
632void
633mbynum(model_t *dest, int num) {
634 /* Sets parameters in dest according to the model indexed by num. */
635 if(num > NPRESETS)
636 num = NPRESETS;
637 munpack(dest, num+models);
638}
639
640int
641mcount(void) {
642 /* Returns the number of preset models. */
643 return(NPRESETS);
644}
645
646char *
647mnames(void) {
648 /* Returns a malloc()-ed string of the names of all preset
649 * models, separated by newlines and terminated by NULL.
650 * Aliases are not listed.
651 */
652 size_t size = 0;
653 char *string, *sptr;
654 const struct malias *aptr = aliases;
655
656 while(aptr->name) {
657 if(aptr == aptr->model->alias)
658 size += strlen(aptr->name) + 1;
659 ++aptr;
660 }
661 if(!size) return(NULL);
662 if((string = malloc(size))) {
663 aptr = aliases;
664 sptr = string;
665 while(aptr->name) {
666 if(aptr == aptr->model->alias) {
667 strcpy(sptr, aptr->name);
668 sptr += strlen(aptr->name);
669 *sptr++ = '\n';
670 }
671 ++aptr;
672 }
673 *--sptr = '\0';
674 } else
675 uerror("cannot allocate memory for list of models");
676
677 return(string);
678}
679
680void
681mmatch(model_t *model, int flags) {
682 /* searches models[] for a model matching the argument, and links a name if found
683 * if flags & M_OVERWR, copies the found model onto the argument. */
684 size_t left = 0, right = NPRESETS, middle = 0;
685 poly_t poly = PZERO;
686 int cmp = 1;
687 if(!model) return;
688
689 while(left < right && cmp) {
690 middle = (left >> 1) + (right >> 1);
691 PUNPACK(&poly, models+middle, bspoly);
692 cmp = psncmp(&model->spoly, &poly);
693 if(!cmp) {
694 PUNPACK(&poly, models+middle, binit);
695 cmp = psncmp(&model->init, &poly);
696 }
697 if(!cmp) {
698 if((model->flags & P_REFIN) && (~models[middle].flags & P_REFIN))
699 cmp = 1;
700 else if((~model->flags & P_REFIN) && (models[middle].flags & P_REFIN))
701 cmp = -1;
702 else if((model->flags & P_REFOUT) && (~models[middle].flags & P_REFOUT))
703 cmp = 1;
704 else if((~model->flags & P_REFOUT) && (models[middle].flags & P_REFOUT))
705 cmp = -1;
706 else {
707 PUNPACK(&poly, models+middle, bxorout);
708 cmp = psncmp(&model->xorout, &poly);
709 }
710 }
711 if(cmp < 0) right = middle;
712 else if(cmp > 0) left = middle + 1;
713 }
714 pfree(&poly);
715
716 if(!cmp) {
717 model->name = models[middle].alias->name;
718 if(flags & M_OVERWR)
719 munpack(model, models+middle);
720 }
721}
722
723/* Private functions */
724
725static void
726munpack(model_t *dest, const struct mpreset *src) {
727 /* Copies the parameters of src to dest.
728 * dest must be an initialised model.
729 */
730 if(!dest || !src) return;
731 MUNPACK(spoly);
732 MUNPACK(init);
733 MUNPACK(xorout);
734 MUNPACK(check);
735 dest->flags = src->flags;
736 /* link to the name as it is static */
737 dest->name = src->alias->name;
738}
Impressum, Datenschutz