11
11
* modification, are permitted provided that the following conditions
12
12
* are met:
13
13
* 1. Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
14
+ * notice, this list of conditions and the following disclaimer.
15
15
* 2. Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the distribution.
18
- * 3. All advertising materials mentioning features or use of this software
19
- * must display the following acknowledgement:
20
- *This product includes software developed by the University of
21
- *California, Berkeley and its contributors.
22
- * 4. Neither the name of the University nor the names of its contributors
23
- * may be used to endorse or promote products derived from this software
24
- * without specific prior written permission.
16
+ * notice, this list of conditions and the following disclaimer in the
17
+ * documentation and/or other materials provided with the distribution.
18
+ * 3. Neither the name of the University nor the names of its contributors
19
+ * may be used to endorse or promote products derived from this software
20
+ * without specific prior written permission.
25
21
*
26
22
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27
23
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
24
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30
26
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31
27
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32
28
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -337,7 +333,7 @@ intchars_in;
337
333
338
334
/* ===== (mostly) Standard DES Tables ==================== */
339
335
340
- static unsignedchar IP []= {/* initial permutation */
336
+ static const unsignedchar IP []= {/* initial permutation */
341
337
58 ,50 ,42 ,34 ,26 ,18 ,10 ,2 ,
342
338
60 ,52 ,44 ,36 ,28 ,20 ,12 ,4 ,
343
339
62 ,54 ,46 ,38 ,30 ,22 ,14 ,6 ,
@@ -350,7 +346,7 @@ static unsigned char IP[] = {/* initial permutation */
350
346
351
347
/* The final permutation is the inverse of IP - no table is necessary */
352
348
353
- static unsignedchar ExpandTr []= {/* expansion operation */
349
+ static const unsignedchar ExpandTr []= {/* expansion operation */
354
350
32 ,1 ,2 ,3 ,4 ,5 ,
355
351
4 ,5 ,6 ,7 ,8 ,9 ,
356
352
8 ,9 ,10 ,11 ,12 ,13 ,
@@ -361,7 +357,7 @@ static unsigned char ExpandTr[] = {/* expansion operation */
361
357
28 ,29 ,30 ,31 ,32 ,1 ,
362
358
};
363
359
364
- static unsignedchar PC1 []= {/* permuted choice table 1 */
360
+ static const unsignedchar PC1 []= {/* permuted choice table 1 */
365
361
57 ,49 ,41 ,33 ,25 ,17 ,9 ,
366
362
1 ,58 ,50 ,42 ,34 ,26 ,18 ,
367
363
10 ,2 ,59 ,51 ,43 ,35 ,27 ,
@@ -373,12 +369,12 @@ static unsigned char PC1[] = {/* permuted choice table 1 */
373
369
21 ,13 ,5 ,28 ,20 ,12 ,4 ,
374
370
};
375
371
376
- static unsignedchar Rotates []= {/* PC1 rotation schedule */
372
+ static const unsignedchar Rotates []= {/* PC1 rotation schedule */
377
373
1 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,1 ,
378
374
};
379
375
380
376
/* note: each "row" of PC2 is left-padded with bits that make it invertible */
381
- static unsignedchar PC2 []= {/* permuted choice table 2 */
377
+ static const unsignedchar PC2 []= {/* permuted choice table 2 */
382
378
9 ,18 ,14 ,17 ,11 ,24 ,1 ,5 ,
383
379
22 ,25 ,3 ,28 ,15 ,6 ,21 ,10 ,
384
380
35 ,38 ,23 ,19 ,12 ,4 ,26 ,8 ,
@@ -390,7 +386,7 @@ static unsigned char PC2[] = {/* permuted choice table 2 */
390
386
0 ,0 ,46 ,42 ,50 ,36 ,29 ,32 ,
391
387
};
392
388
393
- static unsignedchar S [8 ][64 ]= {/* 48->32 bit substitution tables */
389
+ static const unsignedchar S [8 ][64 ]= {/* 48->32 bit substitution tables */
394
390
/* S[1]*/
395
391
{14 ,4 ,13 ,1 ,2 ,15 ,11 ,8 ,3 ,10 ,6 ,12 ,5 ,9 ,0 ,7 ,
396
392
0 ,15 ,7 ,4 ,14 ,2 ,13 ,1 ,10 ,6 ,12 ,11 ,9 ,5 ,3 ,8 ,
@@ -433,7 +429,7 @@ static unsigned char S[8][64] = {/* 48->32 bit substitution tables */
433
429
2 ,1 ,14 ,7 ,4 ,10 ,8 ,13 ,15 ,12 ,9 ,0 ,3 ,5 ,6 ,11 }
434
430
};
435
431
436
- static unsignedchar P32Tr []= {/* 32-bit permutation function */
432
+ static const unsignedchar P32Tr []= {/* 32-bit permutation function */
437
433
16 ,7 ,20 ,21 ,
438
434
29 ,12 ,28 ,17 ,
439
435
1 ,15 ,23 ,26 ,
@@ -444,7 +440,7 @@ static unsigned char P32Tr[] = {/* 32-bit permutation function */
444
440
22 ,11 ,4 ,25 ,
445
441
};
446
442
447
- static unsignedchar CIFP []= {/* compressed/interleaved permutation */
443
+ static const unsignedchar CIFP []= {/* compressed/interleaved permutation */
448
444
1 ,2 ,3 ,4 ,17 ,18 ,19 ,20 ,
449
445
5 ,6 ,7 ,8 ,21 ,22 ,23 ,24 ,
450
446
9 ,10 ,11 ,12 ,25 ,26 ,27 ,28 ,
@@ -456,7 +452,7 @@ static unsigned char CIFP[] = { /* compressed/interleaved permutation */
456
452
45 ,46 ,47 ,48 ,61 ,62 ,63 ,64 ,
457
453
};
458
454
459
- static unsignedchar itoa64 []= /* 0..63 => ascii-64 */
455
+ static const unsignedchar itoa64 []= /* 0..63 => ascii-64 */
460
456
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
461
457
462
458