ReactOS 0.4.15-dev-7924-g5949c20
des.c File Reference
#include "tomcrypt.h"
Include dependency graph for des.c:

Go to the source code of this file.

Macros

#define EN0   0
 
#define DE1   1
 

Functions

static void cookey (const ulong32 *raw1, ulong32 *keyout)
 
static void deskey (const unsigned char *key, short edf, ulong32 *keyout)
 
static void desfunc (ulong32 *block, const ulong32 *keys)
 
int des_setup (const unsigned char *key, int keylen, int num_rounds, des_key *des)
 
int des3_setup (const unsigned char *key, int keylen, int num_rounds, des3_key *des3)
 
void des_ecb_encrypt (const unsigned char *pt, unsigned char *ct, const des_key *des)
 
void des_ecb_decrypt (const unsigned char *ct, unsigned char *pt, const des_key *des)
 
void des3_ecb_encrypt (const unsigned char *pt, unsigned char *ct, const des3_key *des3)
 
void des3_ecb_decrypt (const unsigned char *ct, unsigned char *pt, const des3_key *des3)
 

Variables

static const ulong32 bytebit [8]
 
static const ulong32 bigbyte [24]
 
static const unsigned char pc1 [56]
 
static const unsigned char totrot [16]
 
static const unsigned char pc2 [48]
 
static const ulong32 SP1 [64]
 
static const ulong32 SP2 [64]
 
static const ulong32 SP3 [64]
 
static const ulong32 SP4 [64]
 
static const ulong32 SP5 [64]
 
static const ulong32 SP6 [64]
 
static const ulong32 SP7 [64]
 
static const ulong32 SP8 [64]
 
static const ulong64 des_ip [8][256]
 
static const ulong64 des_fp [8][256]
 

Macro Definition Documentation

◆ DE1

#define DE1   1

Definition at line 35 of file des.c.

◆ EN0

#define EN0   0

Definition at line 34 of file des.c.

Function Documentation

◆ cookey()

static void cookey ( const ulong32 raw1,
ulong32 keyout 
)
static

Definition at line 1333 of file des.c.

1334{
1335 ulong32 *cook;
1336 const ulong32 *raw0;
1337 ulong32 dough[32];
1338 int i;
1339
1340 cook = dough;
1341 for(i=0; i < 16; i++, raw1++)
1342 {
1343 raw0 = raw1++;
1344 *cook = (*raw0 & 0x00fc0000L) << 6;
1345 *cook |= (*raw0 & 0x00000fc0L) << 10;
1346 *cook |= (*raw1 & 0x00fc0000L) >> 10;
1347 *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
1348 *cook = (*raw0 & 0x0003f000L) << 12;
1349 *cook |= (*raw0 & 0x0000003fL) << 16;
1350 *cook |= (*raw1 & 0x0003f000L) >> 4;
1351 *cook++ |= (*raw1 & 0x0000003fL);
1352 }
1353
1354 memcpy(keyout, dough, sizeof dough);
1355}
ULONG32 ulong32
Definition: tomcrypt.h:84
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by deskey().

◆ des3_ecb_decrypt()

void des3_ecb_decrypt ( const unsigned char ct,
unsigned char pt,
const des3_key des3 
)

Definition at line 1485 of file des.c.

1486{
1487 ulong32 work[2];
1488 LOAD32H(work[0], ct+0);
1489 LOAD32H(work[1], ct+4);
1490 desfunc(work, des3->dk[0]);
1491 desfunc(work, des3->dk[1]);
1492 desfunc(work, des3->dk[2]);
1493 STORE32H(work[0],pt+0);
1494 STORE32H(work[1],pt+4);
1495}
static void desfunc(ulong32 *block, const ulong32 *keys)
Definition: des.c:1357
#define STORE32H(x, y)
Definition: tomcrypt.h:87
#define LOAD32H(x, y)
Definition: tomcrypt.h:91
#define pt(x, y)
Definition: drawing.c:79
ulong32 dk[3][32]
Definition: tomcrypt.h:129

Referenced by encrypt_block_impl(), and KsecDecryptMemoryDes3().

◆ des3_ecb_encrypt()

void des3_ecb_encrypt ( const unsigned char pt,
unsigned char ct,
const des3_key des3 
)

Definition at line 1473 of file des.c.

1474{
1475 ulong32 work[2];
1476 LOAD32H(work[0], pt+0);
1477 LOAD32H(work[1], pt+4);
1478 desfunc(work, des3->ek[0]);
1479 desfunc(work, des3->ek[1]);
1480 desfunc(work, des3->ek[2]);
1481 STORE32H(work[0],ct+0);
1482 STORE32H(work[1],ct+4);
1483}
ulong32 ek[3][32]
Definition: tomcrypt.h:129

Referenced by encrypt_block_impl(), and KsecEncryptMemoryDes3().

◆ des3_setup()

int des3_setup ( const unsigned char key,
int  keylen,
int  num_rounds,
des3_key des3 
)

Definition at line 1432 of file des.c.

1433{
1434 if(num_rounds != 0 && num_rounds != 16) {
1435 return CRYPT_INVALID_ROUNDS;
1436 }
1437
1438 if (keylen != 24) {
1439 return CRYPT_INVALID_KEYSIZE;
1440 }
1441
1442 deskey(key, EN0, des3->ek[0]);
1443 deskey(key+8, DE1, des3->ek[1]);
1444 deskey(key+16, EN0, des3->ek[2]);
1445
1446 deskey(key, DE1, des3->dk[2]);
1447 deskey(key+8, EN0, des3->dk[1]);
1448 deskey(key+16, DE1, des3->dk[0]);
1449
1450 return CRYPT_OK;
1451}
static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
Definition: des.c:1285
#define DE1
Definition: des.c:35
#define EN0
Definition: des.c:34
@ CRYPT_INVALID_ROUNDS
Definition: tomcrypt.h:48
@ CRYPT_INVALID_KEYSIZE
Definition: tomcrypt.h:47
@ CRYPT_OK
Definition: tomcrypt.h:43
Definition: copy.c:22

Referenced by KsecGetDes3Key(), KsecInitializeEncryptionSupport(), and setup_key_impl().

◆ des_ecb_decrypt()

void des_ecb_decrypt ( const unsigned char ct,
unsigned char pt,
const des_key des 
)

Definition at line 1463 of file des.c.

1464{
1465 ulong32 work[2];
1466 LOAD32H(work[0], ct+0);
1467 LOAD32H(work[1], ct+4);
1468 desfunc(work, des->dk);
1469 STORE32H(work[0],pt+0);
1470 STORE32H(work[1],pt+4);
1471}
static const WCHAR des[]
Definition: oid.c:1212

Referenced by encrypt_block_impl().

◆ des_ecb_encrypt()

void des_ecb_encrypt ( const unsigned char pt,
unsigned char ct,
const des_key des 
)

Definition at line 1453 of file des.c.

1454{
1455 ulong32 work[2];
1456 LOAD32H(work[0], pt+0);
1457 LOAD32H(work[1], pt+4);
1458 desfunc(work, des->ek);
1459 STORE32H(work[0],ct+0);
1460 STORE32H(work[1],ct+4);
1461}

Referenced by encrypt_block_impl().

◆ des_setup()

int des_setup ( const unsigned char key,
int  keylen,
int  num_rounds,
des_key des 
)

Definition at line 1416 of file des.c.

1417{
1418 if (num_rounds != 0 && num_rounds != 16) {
1419 return CRYPT_INVALID_ROUNDS;
1420 }
1421
1422 if (keylen != 8) {
1423 return CRYPT_INVALID_KEYSIZE;
1424 }
1425
1426 deskey(key, EN0, des->ek);
1427 deskey(key, DE1, des->dk);
1428
1429 return CRYPT_OK;
1430}

Referenced by setup_key_impl().

◆ desfunc()

static void desfunc ( ulong32 block,
const ulong32 keys 
)
static

Definition at line 1357 of file des.c.

1358{
1359 ulong64 tmp;
1360 ulong32 work, right, leftt;
1361 int cur_round;
1362
1363 leftt = block[0];
1364 right = block[1];
1365
1366 tmp = des_ip[0][byte(leftt, 0)] ^
1367 des_ip[1][byte(leftt, 1)] ^
1368 des_ip[2][byte(leftt, 2)] ^
1369 des_ip[3][byte(leftt, 3)] ^
1370 des_ip[4][byte(right, 0)] ^
1371 des_ip[5][byte(right, 1)] ^
1372 des_ip[6][byte(right, 2)] ^
1373 des_ip[7][byte(right, 3)];
1374 leftt = (ulong32)(tmp >> 32);
1375 right = (ulong32)(tmp & 0xFFFFFFFFUL);
1376
1377 for (cur_round = 0; cur_round < 8; cur_round++) {
1378 work = ROR(right, 4) ^ *keys++;
1379 leftt ^= SP7[work & 0x3fL]
1380 ^ SP5[(work >> 8) & 0x3fL]
1381 ^ SP3[(work >> 16) & 0x3fL]
1382 ^ SP1[(work >> 24) & 0x3fL];
1383 work = right ^ *keys++;
1384 leftt ^= SP8[ work & 0x3fL]
1385 ^ SP6[(work >> 8) & 0x3fL]
1386 ^ SP4[(work >> 16) & 0x3fL]
1387 ^ SP2[(work >> 24) & 0x3fL];
1388
1389 work = ROR(leftt, 4) ^ *keys++;
1390 right ^= SP7[ work & 0x3fL]
1391 ^ SP5[(work >> 8) & 0x3fL]
1392 ^ SP3[(work >> 16) & 0x3fL]
1393 ^ SP1[(work >> 24) & 0x3fL];
1394 work = leftt ^ *keys++;
1395 right ^= SP8[ work & 0x3fL]
1396 ^ SP6[(work >> 8) & 0x3fL]
1397 ^ SP4[(work >> 16) & 0x3fL]
1398 ^ SP2[(work >> 24) & 0x3fL];
1399 }
1400
1401 tmp = des_fp[0][byte(leftt, 0)] ^
1402 des_fp[1][byte(leftt, 1)] ^
1403 des_fp[2][byte(leftt, 2)] ^
1404 des_fp[3][byte(leftt, 3)] ^
1405 des_fp[4][byte(right, 0)] ^
1406 des_fp[5][byte(right, 1)] ^
1407 des_fp[6][byte(right, 2)] ^
1408 des_fp[7][byte(right, 3)];
1409 leftt = (ulong32)(tmp >> 32);
1410 right = (ulong32)(tmp & 0xFFFFFFFFUL);
1411
1412 block[0] = right;
1413 block[1] = leftt;
1414}
static const ulong32 SP3[64]
Definition: des.c:116
static const ulong32 SP5[64]
Definition: des.c:156
static const ulong32 SP1[64]
Definition: des.c:76
static const ulong32 SP7[64]
Definition: des.c:196
static const ulong64 des_fp[8][256]
Definition: des.c:759
static const ulong64 des_ip[8][256]
Definition: des.c:236
static const ulong32 SP2[64]
Definition: des.c:96
static const ulong32 SP4[64]
Definition: des.c:136
static const ulong32 SP8[64]
Definition: des.c:216
static const ulong32 SP6[64]
Definition: des.c:176
#define byte(x, n)
Definition: tomcrypt.h:118
#define ROR(x, y)
Definition: tomcrypt.h:110
ULONG64 ulong64
Definition: tomcrypt.h:79
GLdouble GLdouble right
Definition: glext.h:10859
static unsigned int block
Definition: xmlmemory.c:101

Referenced by des3_ecb_decrypt(), des3_ecb_encrypt(), des_ecb_decrypt(), and des_ecb_encrypt().

◆ deskey()

static void deskey ( const unsigned char key,
short  edf,
ulong32 keyout 
)
static

Definition at line 1285 of file des.c.

1286{
1287 ulong32 i, j, l, m, n, kn[32];
1288 unsigned char pc1m[56], pcr[56];
1289
1290 for (j=0; j < 56; j++) {
1291 l = (ulong32)pc1[j];
1292 m = l & 7;
1293 pc1m[j] = (unsigned char)((key[l >> 3U] & bytebit[m]) == bytebit[m] ? 1 : 0);
1294 }
1295
1296 for (i=0; i < 16; i++) {
1297 if (edf == DE1) {
1298 m = (15 - i) << 1;
1299 } else {
1300 m = i << 1;
1301 }
1302 n = m + 1;
1303 kn[m] = kn[n] = 0L;
1304 for (j=0; j < 28; j++) {
1305 l = j + (ulong32)totrot[i];
1306 if (l < 28) {
1307 pcr[j] = pc1m[l];
1308 } else {
1309 pcr[j] = pc1m[l - 28];
1310 }
1311 }
1312 for (/*j = 28*/; j < 56; j++) {
1313 l = j + (ulong32)totrot[i];
1314 if (l < 56) {
1315 pcr[j] = pc1m[l];
1316 } else {
1317 pcr[j] = pc1m[l - 28];
1318 }
1319 }
1320 for (j=0; j < 24; j++) {
1321 if ((int)pcr[(int)pc2[j]] != 0) {
1322 kn[m] |= bigbyte[j];
1323 }
1324 if ((int)pcr[(int)pc2[j+24]] != 0) {
1325 kn[n] |= bigbyte[j];
1326 }
1327 }
1328 }
1329
1330 cookey(kn, keyout);
1331}
r l[0]
Definition: byte_order.h:168
static const unsigned char totrot[16]
Definition: des.c:61
static void cookey(const ulong32 *raw1, ulong32 *keyout)
Definition: des.c:1333
static const unsigned char pc1[56]
Definition: des.c:54
static const ulong32 bytebit[8]
Definition: des.c:37
static const ulong32 bigbyte[24]
Definition: des.c:42
static const unsigned char pc2[48]
Definition: des.c:68
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned char
Definition: typeof.h:29
GLdouble n
Definition: glext.h:7729
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define L(x)
Definition: ntvdm.h:50

Referenced by des3_setup(), des_setup(), key_decryptsession(), key_decryptsession_pk(), key_encryptsession(), key_encryptsession_pk(), key_get_conv(), SystemFunction004(), SystemFunction005(), SystemFunction024(), and SystemFunction025().

Variable Documentation

◆ bigbyte

const ulong32 bigbyte[24]
static
Initial value:
=
{
0x800000UL, 0x400000UL, 0x200000UL, 0x100000UL,
0x80000UL, 0x40000UL, 0x20000UL, 0x10000UL,
0x8000UL, 0x4000UL, 0x2000UL, 0x1000UL,
0x800UL, 0x400UL, 0x200UL, 0x100UL,
0x80UL, 0x40UL, 0x20UL, 0x10UL,
0x8UL, 0x4UL, 0x2UL, 0x1L
}

Definition at line 42 of file des.c.

Referenced by deskey().

◆ bytebit

const ulong32 bytebit[8]
static
Initial value:
=
{
0200, 0100, 040, 020, 010, 04, 02, 01
}

Definition at line 37 of file des.c.

Referenced by deskey().

◆ des_fp

const ulong64 des_fp[8][256]
static

Definition at line 759 of file des.c.

Referenced by desfunc().

◆ des_ip

const ulong64 des_ip[8][256]
static

Definition at line 236 of file des.c.

Referenced by desfunc().

◆ pc1

const unsigned char pc1[56]
static
Initial value:
= {
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3
}

Definition at line 54 of file des.c.

Referenced by deskey(), IopSuffixUnicodeString(), PostfixUnicodeString(), RtlPrefixString(), and RtlPrefixUnicodeString().

◆ pc2

const unsigned char pc2[48]
static
Initial value:
= {
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31
}

Definition at line 68 of file des.c.

Referenced by deskey(), IopSuffixUnicodeString(), PostfixUnicodeString(), RtlPrefixString(), and RtlPrefixUnicodeString().

◆ SP1

const ulong32 SP1[64]
static
Initial value:
=
{
0x01010400UL, 0x00000000UL, 0x00010000UL, 0x01010404UL,
0x01010004UL, 0x00010404UL, 0x00000004UL, 0x00010000UL,
0x00000400UL, 0x01010400UL, 0x01010404UL, 0x00000400UL,
0x01000404UL, 0x01010004UL, 0x01000000UL, 0x00000004UL,
0x00000404UL, 0x01000400UL, 0x01000400UL, 0x00010400UL,
0x00010400UL, 0x01010000UL, 0x01010000UL, 0x01000404UL,
0x00010004UL, 0x01000004UL, 0x01000004UL, 0x00010004UL,
0x00000000UL, 0x00000404UL, 0x00010404UL, 0x01000000UL,
0x00010000UL, 0x01010404UL, 0x00000004UL, 0x01010000UL,
0x01010400UL, 0x01000000UL, 0x01000000UL, 0x00000400UL,
0x01010004UL, 0x00010000UL, 0x00010400UL, 0x01000004UL,
0x00000400UL, 0x00000004UL, 0x01000404UL, 0x00010404UL,
0x01010404UL, 0x00010004UL, 0x01010000UL, 0x01000404UL,
0x01000004UL, 0x00000404UL, 0x00010404UL, 0x01010400UL,
0x00000404UL, 0x01000400UL, 0x01000400UL, 0x00000000UL,
0x00010004UL, 0x00010400UL, 0x00000000UL, 0x01010004UL
}

Definition at line 76 of file des.c.

Referenced by desfunc().

◆ SP2

const ulong32 SP2[64]
static
Initial value:
=
{
0x80108020UL, 0x80008000UL, 0x00008000UL, 0x00108020UL,
0x00100000UL, 0x00000020UL, 0x80100020UL, 0x80008020UL,
0x80000020UL, 0x80108020UL, 0x80108000UL, 0x80000000UL,
0x80008000UL, 0x00100000UL, 0x00000020UL, 0x80100020UL,
0x00108000UL, 0x00100020UL, 0x80008020UL, 0x00000000UL,
0x80000000UL, 0x00008000UL, 0x00108020UL, 0x80100000UL,
0x00100020UL, 0x80000020UL, 0x00000000UL, 0x00108000UL,
0x00008020UL, 0x80108000UL, 0x80100000UL, 0x00008020UL,
0x00000000UL, 0x00108020UL, 0x80100020UL, 0x00100000UL,
0x80008020UL, 0x80100000UL, 0x80108000UL, 0x00008000UL,
0x80100000UL, 0x80008000UL, 0x00000020UL, 0x80108020UL,
0x00108020UL, 0x00000020UL, 0x00008000UL, 0x80000000UL,
0x00008020UL, 0x80108000UL, 0x00100000UL, 0x80000020UL,
0x00100020UL, 0x80008020UL, 0x80000020UL, 0x00100020UL,
0x00108000UL, 0x00000000UL, 0x80008000UL, 0x00008020UL,
0x80000000UL, 0x80100020UL, 0x80108020UL, 0x00108000UL
}

Definition at line 96 of file des.c.

Referenced by desfunc().

◆ SP3

const ulong32 SP3[64]
static
Initial value:
=
{
0x00000208UL, 0x08020200UL, 0x00000000UL, 0x08020008UL,
0x08000200UL, 0x00000000UL, 0x00020208UL, 0x08000200UL,
0x00020008UL, 0x08000008UL, 0x08000008UL, 0x00020000UL,
0x08020208UL, 0x00020008UL, 0x08020000UL, 0x00000208UL,
0x08000000UL, 0x00000008UL, 0x08020200UL, 0x00000200UL,
0x00020200UL, 0x08020000UL, 0x08020008UL, 0x00020208UL,
0x08000208UL, 0x00020200UL, 0x00020000UL, 0x08000208UL,
0x00000008UL, 0x08020208UL, 0x00000200UL, 0x08000000UL,
0x08020200UL, 0x08000000UL, 0x00020008UL, 0x00000208UL,
0x00020000UL, 0x08020200UL, 0x08000200UL, 0x00000000UL,
0x00000200UL, 0x00020008UL, 0x08020208UL, 0x08000200UL,
0x08000008UL, 0x00000200UL, 0x00000000UL, 0x08020008UL,
0x08000208UL, 0x00020000UL, 0x08000000UL, 0x08020208UL,
0x00000008UL, 0x00020208UL, 0x00020200UL, 0x08000008UL,
0x08020000UL, 0x08000208UL, 0x00000208UL, 0x08020000UL,
0x00020208UL, 0x00000008UL, 0x08020008UL, 0x00020200UL
}

Definition at line 116 of file des.c.

Referenced by desfunc().

◆ SP4

const ulong32 SP4[64]
static
Initial value:
=
{
0x00802001UL, 0x00002081UL, 0x00002081UL, 0x00000080UL,
0x00802080UL, 0x00800081UL, 0x00800001UL, 0x00002001UL,
0x00000000UL, 0x00802000UL, 0x00802000UL, 0x00802081UL,
0x00000081UL, 0x00000000UL, 0x00800080UL, 0x00800001UL,
0x00000001UL, 0x00002000UL, 0x00800000UL, 0x00802001UL,
0x00000080UL, 0x00800000UL, 0x00002001UL, 0x00002080UL,
0x00800081UL, 0x00000001UL, 0x00002080UL, 0x00800080UL,
0x00002000UL, 0x00802080UL, 0x00802081UL, 0x00000081UL,
0x00800080UL, 0x00800001UL, 0x00802000UL, 0x00802081UL,
0x00000081UL, 0x00000000UL, 0x00000000UL, 0x00802000UL,
0x00002080UL, 0x00800080UL, 0x00800081UL, 0x00000001UL,
0x00802001UL, 0x00002081UL, 0x00002081UL, 0x00000080UL,
0x00802081UL, 0x00000081UL, 0x00000001UL, 0x00002000UL,
0x00800001UL, 0x00002001UL, 0x00802080UL, 0x00800081UL,
0x00002001UL, 0x00002080UL, 0x00800000UL, 0x00802001UL,
0x00000080UL, 0x00800000UL, 0x00002000UL, 0x00802080UL
}

Definition at line 136 of file des.c.

Referenced by desfunc().

◆ SP5

const ulong32 SP5[64]
static
Initial value:
=
{
0x00000100UL, 0x02080100UL, 0x02080000UL, 0x42000100UL,
0x00080000UL, 0x00000100UL, 0x40000000UL, 0x02080000UL,
0x40080100UL, 0x00080000UL, 0x02000100UL, 0x40080100UL,
0x42000100UL, 0x42080000UL, 0x00080100UL, 0x40000000UL,
0x02000000UL, 0x40080000UL, 0x40080000UL, 0x00000000UL,
0x40000100UL, 0x42080100UL, 0x42080100UL, 0x02000100UL,
0x42080000UL, 0x40000100UL, 0x00000000UL, 0x42000000UL,
0x02080100UL, 0x02000000UL, 0x42000000UL, 0x00080100UL,
0x00080000UL, 0x42000100UL, 0x00000100UL, 0x02000000UL,
0x40000000UL, 0x02080000UL, 0x42000100UL, 0x40080100UL,
0x02000100UL, 0x40000000UL, 0x42080000UL, 0x02080100UL,
0x40080100UL, 0x00000100UL, 0x02000000UL, 0x42080000UL,
0x42080100UL, 0x00080100UL, 0x42000000UL, 0x42080100UL,
0x02080000UL, 0x00000000UL, 0x40080000UL, 0x42000000UL,
0x00080100UL, 0x02000100UL, 0x40000100UL, 0x00080000UL,
0x00000000UL, 0x40080000UL, 0x02080100UL, 0x40000100UL
}

Definition at line 156 of file des.c.

Referenced by desfunc().

◆ SP6

const ulong32 SP6[64]
static
Initial value:
=
{
0x20000010UL, 0x20400000UL, 0x00004000UL, 0x20404010UL,
0x20400000UL, 0x00000010UL, 0x20404010UL, 0x00400000UL,
0x20004000UL, 0x00404010UL, 0x00400000UL, 0x20000010UL,
0x00400010UL, 0x20004000UL, 0x20000000UL, 0x00004010UL,
0x00000000UL, 0x00400010UL, 0x20004010UL, 0x00004000UL,
0x00404000UL, 0x20004010UL, 0x00000010UL, 0x20400010UL,
0x20400010UL, 0x00000000UL, 0x00404010UL, 0x20404000UL,
0x00004010UL, 0x00404000UL, 0x20404000UL, 0x20000000UL,
0x20004000UL, 0x00000010UL, 0x20400010UL, 0x00404000UL,
0x20404010UL, 0x00400000UL, 0x00004010UL, 0x20000010UL,
0x00400000UL, 0x20004000UL, 0x20000000UL, 0x00004010UL,
0x20000010UL, 0x20404010UL, 0x00404000UL, 0x20400000UL,
0x00404010UL, 0x20404000UL, 0x00000000UL, 0x20400010UL,
0x00000010UL, 0x00004000UL, 0x20400000UL, 0x00404010UL,
0x00004000UL, 0x00400010UL, 0x20004010UL, 0x00000000UL,
0x20404000UL, 0x20000000UL, 0x00400010UL, 0x20004010UL
}

Definition at line 176 of file des.c.

Referenced by desfunc().

◆ SP7

const ulong32 SP7[64]
static
Initial value:
=
{
0x00200000UL, 0x04200002UL, 0x04000802UL, 0x00000000UL,
0x00000800UL, 0x04000802UL, 0x00200802UL, 0x04200800UL,
0x04200802UL, 0x00200000UL, 0x00000000UL, 0x04000002UL,
0x00000002UL, 0x04000000UL, 0x04200002UL, 0x00000802UL,
0x04000800UL, 0x00200802UL, 0x00200002UL, 0x04000800UL,
0x04000002UL, 0x04200000UL, 0x04200800UL, 0x00200002UL,
0x04200000UL, 0x00000800UL, 0x00000802UL, 0x04200802UL,
0x00200800UL, 0x00000002UL, 0x04000000UL, 0x00200800UL,
0x04000000UL, 0x00200800UL, 0x00200000UL, 0x04000802UL,
0x04000802UL, 0x04200002UL, 0x04200002UL, 0x00000002UL,
0x00200002UL, 0x04000000UL, 0x04000800UL, 0x00200000UL,
0x04200800UL, 0x00000802UL, 0x00200802UL, 0x04200800UL,
0x00000802UL, 0x04000002UL, 0x04200802UL, 0x04200000UL,
0x00200800UL, 0x00000000UL, 0x00000002UL, 0x04200802UL,
0x00000000UL, 0x00200802UL, 0x04200000UL, 0x00000800UL,
0x04000002UL, 0x04000800UL, 0x00000800UL, 0x00200002UL
}

Definition at line 196 of file des.c.

Referenced by desfunc().

◆ SP8

const ulong32 SP8[64]
static
Initial value:
=
{
0x10001040UL, 0x00001000UL, 0x00040000UL, 0x10041040UL,
0x10000000UL, 0x10001040UL, 0x00000040UL, 0x10000000UL,
0x00040040UL, 0x10040000UL, 0x10041040UL, 0x00041000UL,
0x10041000UL, 0x00041040UL, 0x00001000UL, 0x00000040UL,
0x10040000UL, 0x10000040UL, 0x10001000UL, 0x00001040UL,
0x00041000UL, 0x00040040UL, 0x10040040UL, 0x10041000UL,
0x00001040UL, 0x00000000UL, 0x00000000UL, 0x10040040UL,
0x10000040UL, 0x10001000UL, 0x00041040UL, 0x00040000UL,
0x00041040UL, 0x00040000UL, 0x10041000UL, 0x00001000UL,
0x00000040UL, 0x10040040UL, 0x00001000UL, 0x00041040UL,
0x10001000UL, 0x00000040UL, 0x10000040UL, 0x10040000UL,
0x10040040UL, 0x10000000UL, 0x00040000UL, 0x10001040UL,
0x00000000UL, 0x10041040UL, 0x00040040UL, 0x10000040UL,
0x10040000UL, 0x10001000UL, 0x10001040UL, 0x00000000UL,
0x10041040UL, 0x00041000UL, 0x00041000UL, 0x00001040UL,
0x00001040UL, 0x00040040UL, 0x10000000UL, 0x10041000UL
}

Definition at line 216 of file des.c.

Referenced by desfunc().

◆ totrot

const unsigned char totrot[16]
static
Initial value:
= {
1, 2, 4, 6,
8, 10, 12, 14,
15, 17, 19, 21,
23, 25, 27, 28
}

Definition at line 61 of file des.c.

Referenced by deskey().