Mercurial > dropbear
comparison libtomcrypt/src/ciphers/des.c @ 1435:f849a5ca2efc
update to libtomcrypt 1.17 (with Dropbear changes)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 17:50:50 +0800 |
parents | eef377591301 |
children | 6dba84798cd5 |
comparison
equal
deleted
inserted
replaced
1434:27b9ddb06b09 | 1435:f849a5ca2efc |
---|---|
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.com | 9 * Tom St Denis, [email protected], http://libtom.org |
10 */ | 10 */ |
11 #include "tomcrypt.h" | 11 #include "tomcrypt.h" |
12 | 12 |
13 /** | 13 /** |
14 @file des.c | 14 @file des.c |
15 DES code submitted by Dobes Vandermeer | 15 LTC_DES code submitted by Dobes Vandermeer |
16 */ | 16 */ |
17 | 17 |
18 #ifdef DES | 18 #ifdef LTC_DES |
19 | 19 |
20 #define EN0 0 | 20 #define EN0 0 |
21 #define DE1 1 | 21 #define DE1 1 |
22 | 22 |
23 #if 0 | 23 #if 0 |
1520 } | 1520 } |
1521 #endif | 1521 #endif |
1522 | 1522 |
1523 #if 0 | 1523 #if 0 |
1524 /** | 1524 /** |
1525 Initialize the DES block cipher | 1525 Initialize the LTC_DES block cipher |
1526 @param key The symmetric key you wish to pass | 1526 @param key The symmetric key you wish to pass |
1527 @param keylen The key length in bytes | 1527 @param keylen The key length in bytes |
1528 @param num_rounds The number of rounds desired (0 for default) | 1528 @param num_rounds The number of rounds desired (0 for default) |
1529 @param skey The key in as scheduled by this function. | 1529 @param skey The key in as scheduled by this function. |
1530 @return CRYPT_OK if successful | 1530 @return CRYPT_OK if successful |
1548 return CRYPT_OK; | 1548 return CRYPT_OK; |
1549 } | 1549 } |
1550 #endif | 1550 #endif |
1551 | 1551 |
1552 /** | 1552 /** |
1553 Initialize the 3DES-EDE block cipher | 1553 Initialize the 3LTC_DES-EDE block cipher |
1554 @param key The symmetric key you wish to pass | 1554 @param key The symmetric key you wish to pass |
1555 @param keylen The key length in bytes | 1555 @param keylen The key length in bytes |
1556 @param num_rounds The number of rounds desired (0 for default) | 1556 @param num_rounds The number of rounds desired (0 for default) |
1557 @param skey The key in as scheduled by this function. | 1557 @param skey The key in as scheduled by this function. |
1558 @return CRYPT_OK if successful | 1558 @return CRYPT_OK if successful |
1581 return CRYPT_OK; | 1581 return CRYPT_OK; |
1582 } | 1582 } |
1583 | 1583 |
1584 #if 0 | 1584 #if 0 |
1585 /** | 1585 /** |
1586 Encrypts a block of text with DES | 1586 Encrypts a block of text with LTC_DES |
1587 @param pt The input plaintext (8 bytes) | 1587 @param pt The input plaintext (8 bytes) |
1588 @param ct The output ciphertext (8 bytes) | 1588 @param ct The output ciphertext (8 bytes) |
1589 @param skey The key as scheduled | 1589 @param skey The key as scheduled |
1590 @return CRYPT_OK if successful | 1590 @return CRYPT_OK if successful |
1591 */ | 1591 */ |
1602 STORE32H(work[1],ct+4); | 1602 STORE32H(work[1],ct+4); |
1603 return CRYPT_OK; | 1603 return CRYPT_OK; |
1604 } | 1604 } |
1605 | 1605 |
1606 /** | 1606 /** |
1607 Decrypts a block of text with DES | 1607 Decrypts a block of text with LTC_DES |
1608 @param ct The input ciphertext (8 bytes) | 1608 @param ct The input ciphertext (8 bytes) |
1609 @param pt The output plaintext (8 bytes) | 1609 @param pt The output plaintext (8 bytes) |
1610 @param skey The key as scheduled | 1610 @param skey The key as scheduled |
1611 @return CRYPT_OK if successful | 1611 @return CRYPT_OK if successful |
1612 */ | 1612 */ |
1624 return CRYPT_OK; | 1624 return CRYPT_OK; |
1625 } | 1625 } |
1626 #endif | 1626 #endif |
1627 | 1627 |
1628 /** | 1628 /** |
1629 Encrypts a block of text with 3DES-EDE | 1629 Encrypts a block of text with 3LTC_DES-EDE |
1630 @param pt The input plaintext (8 bytes) | 1630 @param pt The input plaintext (8 bytes) |
1631 @param ct The output ciphertext (8 bytes) | 1631 @param ct The output ciphertext (8 bytes) |
1632 @param skey The key as scheduled | 1632 @param skey The key as scheduled |
1633 @return CRYPT_OK if successful | 1633 @return CRYPT_OK if successful |
1634 */ | 1634 */ |
1648 STORE32H(work[1],ct+4); | 1648 STORE32H(work[1],ct+4); |
1649 return CRYPT_OK; | 1649 return CRYPT_OK; |
1650 } | 1650 } |
1651 | 1651 |
1652 /** | 1652 /** |
1653 Decrypts a block of text with 3DES-EDE | 1653 Decrypts a block of text with 3LTC_DES-EDE |
1654 @param ct The input ciphertext (8 bytes) | 1654 @param ct The input ciphertext (8 bytes) |
1655 @param pt The output plaintext (8 bytes) | 1655 @param pt The output plaintext (8 bytes) |
1656 @param skey The key as scheduled | 1656 @param skey The key as scheduled |
1657 @return CRYPT_OK if successful | 1657 @return CRYPT_OK if successful |
1658 */ | 1658 */ |
1672 return CRYPT_OK; | 1672 return CRYPT_OK; |
1673 } | 1673 } |
1674 | 1674 |
1675 #if 0 | 1675 #if 0 |
1676 /** | 1676 /** |
1677 Performs a self-test of the DES block cipher | 1677 Performs a self-test of the LTC_DES block cipher |
1678 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled | 1678 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled |
1679 */ | 1679 */ |
1680 int des_test(void) | 1680 int des_test(void) |
1681 { | 1681 { |
1682 #ifndef LTC_TEST | 1682 #ifndef LTC_TEST |
1908 } | 1908 } |
1909 | 1909 |
1910 #endif | 1910 #endif |
1911 | 1911 |
1912 | 1912 |
1913 /* $Source: /cvs/libtom/libtomcrypt/src/ciphers/des.c,v $ */ | 1913 /* $Source$ */ |
1914 /* $Revision: 1.13 $ */ | 1914 /* $Revision$ */ |
1915 /* $Date: 2006/11/08 23:01:06 $ */ | 1915 /* $Date$ */ |