/src/botan/build/include/botan/internal/des.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * DES |
3 | | * (C) 1999-2007 Jack Lloyd |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | */ |
7 | | |
8 | | #ifndef BOTAN_DES_H_ |
9 | | #define BOTAN_DES_H_ |
10 | | |
11 | | #include <botan/block_cipher.h> |
12 | | |
13 | | namespace Botan { |
14 | | |
15 | | /** |
16 | | * DES |
17 | | */ |
18 | | class DES final : public Block_Cipher_Fixed_Params<8, 8> |
19 | | { |
20 | | public: |
21 | | void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
22 | | void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
23 | | |
24 | | void clear() override; |
25 | 0 | std::string name() const override { return "DES"; } |
26 | 0 | BlockCipher* clone() const override { return new DES; } |
27 | | private: |
28 | | void key_schedule(const uint8_t[], size_t) override; |
29 | | |
30 | | secure_vector<uint32_t> m_round_key; |
31 | | }; |
32 | | |
33 | | /** |
34 | | * Triple DES |
35 | | */ |
36 | | class TripleDES final : public Block_Cipher_Fixed_Params<8, 16, 24, 8> |
37 | | { |
38 | | public: |
39 | | void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
40 | | void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
41 | | |
42 | | void clear() override; |
43 | 483 | std::string name() const override { return "TripleDES"; } |
44 | 0 | BlockCipher* clone() const override { return new TripleDES; } |
45 | | private: |
46 | | |
47 | | #if defined(BOTAN_HAS_DES_BMI2) |
48 | | static void bmi2_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks, const uint32_t key[]); |
49 | | static void bmi2_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks, const uint32_t key[]); |
50 | | #endif |
51 | | |
52 | | void key_schedule(const uint8_t[], size_t) override; |
53 | | |
54 | | secure_vector<uint32_t> m_round_key; |
55 | | }; |
56 | | |
57 | | } |
58 | | |
59 | | #endif |