~ubuntu-branches/debian/lenny/dropbear/lenny

« back to all changes in this revision

Viewing changes to libtomcrypt/des.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape
  • Date: 2005-05-25 22:38:17 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050525223817-fdl653extybmz1zb
Tags: 0.45-3
* debian/dropbear.init: init script prints human readable message in case
  it's disabled (closes: #309099).
* debian/dropbear.postinst: configure: restart service through init script
  instead of start.
* debian/dropbear.prerm: set -u -> set -e.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#define EN0 0 
17
17
#define DE1 1
18
18
 
 
19
#if 0
19
20
const struct _cipher_descriptor des_desc =
20
21
{
21
22
    "des",
27
28
    &des_test,
28
29
    &des_keysize
29
30
};
 
31
#endif
30
32
 
31
33
const struct _cipher_descriptor des3_desc =
32
34
{
1377
1379
        *cook++ |= (*raw1 & 0x0000003fL);
1378
1380
    }
1379
1381
 
1380
 
    memcpy(keyout, dough, sizeof dough);
 
1382
    XMEMCPY(keyout, dough, sizeof dough);
1381
1383
}
1382
1384
 
1383
1385
#ifdef CLEAN_STACK
1395
1397
#endif
1396
1398
{
1397
1399
    ulong32 work, right, leftt;
1398
 
    int round;
 
1400
    int cur_round;
1399
1401
 
1400
1402
    leftt = block[0];
1401
1403
    right = block[1];
1439
1441
   }
1440
1442
#endif
1441
1443
 
1442
 
    for (round = 0; round < 8; round++) {
 
1444
    for (cur_round = 0; cur_round < 8; cur_round++) {
1443
1445
        work  = ROR(right, 4) ^ *keys++;
1444
1446
        leftt ^= SP7[work        & 0x3fL]
1445
1447
              ^ SP5[(work >>  8) & 0x3fL]
1510
1512
}
1511
1513
#endif
1512
1514
 
 
1515
#if 0
1513
1516
int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
1514
1517
{
1515
1518
    _ARGCHK(key != NULL);
1528
1531
 
1529
1532
    return CRYPT_OK;
1530
1533
}
 
1534
#endif
1531
1535
 
1532
1536
int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
1533
1537
{
1534
1538
    _ARGCHK(key != NULL);
1535
1539
    _ARGCHK(skey != NULL);
1536
1540
 
1537
 
    if( num_rounds != 0 && num_rounds != 16) {
 
1541
    if(num_rounds != 0 && num_rounds != 16) {
1538
1542
        return CRYPT_INVALID_ROUNDS;
1539
1543
    }
1540
1544
 
1553
1557
    return CRYPT_OK;
1554
1558
}
1555
1559
 
 
1560
#if 0
1556
1561
void des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key)
1557
1562
{
1558
1563
    ulong32 work[2];
1578
1583
    STORE32H(work[0],pt+0);
1579
1584
    STORE32H(work[1],pt+4);
1580
1585
}
 
1586
#endif
1581
1587
 
1582
1588
void des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key)
1583
1589
{
1610
1616
    STORE32H(work[1],pt+4);
1611
1617
}
1612
1618
 
 
1619
#if 0
1613
1620
int des_test(void)
1614
1621
{
1615
1622
 #ifndef LTC_TEST
1752
1759
    return CRYPT_OK;
1753
1760
  #endif
1754
1761
}
 
1762
#endif
1755
1763
 
1756
1764
int des3_test(void)
1757
1765
{
1789
1797
 #endif
1790
1798
}
1791
1799
 
 
1800
#if 0
1792
1801
int des_keysize(int *desired_keysize)
1793
1802
{
1794
1803
    _ARGCHK(desired_keysize != NULL);
1798
1807
    *desired_keysize = 8;
1799
1808
    return CRYPT_OK;
1800
1809
}
 
1810
#endif
1801
1811
 
1802
1812
int des3_keysize(int *desired_keysize)
1803
1813
{