Initialize the LTC_DES block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @param skey The key in as scheduled by this function. @return CRYPT_OK if successful */
| 1525 | @return CRYPT_OK if successful |
| 1526 | */ |
| 1527 | int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) |
| 1528 | { |
| 1529 | LTC_ARGCHK(key != NULL); |
| 1530 | LTC_ARGCHK(skey != NULL); |
| 1531 | |
| 1532 | if (num_rounds != 0 && num_rounds != 16) { |
| 1533 | return CRYPT_INVALID_ROUNDS; |
| 1534 | } |
| 1535 | |
| 1536 | if (keylen != 8) { |
| 1537 | return CRYPT_INVALID_KEYSIZE; |
| 1538 | } |
| 1539 | |
| 1540 | deskey(key, EN0, skey->des.ek); |
| 1541 | deskey(key, DE1, skey->des.dk); |
| 1542 | |
| 1543 | return CRYPT_OK; |
| 1544 | } |
| 1545 | |
| 1546 | /** |
| 1547 | Initialize the 3LTC_DES-EDE block cipher |