/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 | | public: |
20 | | void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
21 | | void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
22 | | |
23 | | void clear() override; |
24 | | |
25 | 0 | std::string name() const override { return "DES"; } |
26 | | |
27 | 0 | std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<DES>(); } |
28 | | |
29 | | bool has_keying_material() const override; |
30 | | |
31 | | private: |
32 | | void key_schedule(std::span<const uint8_t>) override; |
33 | | |
34 | | secure_vector<uint32_t> m_round_key; |
35 | | }; |
36 | | |
37 | | /** |
38 | | * Triple DES |
39 | | */ |
40 | | class TripleDES final : public Block_Cipher_Fixed_Params<8, 16, 24, 8> { |
41 | | public: |
42 | | void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
43 | | void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
44 | | |
45 | | void clear() override; |
46 | | |
47 | 0 | std::string name() const override { return "TripleDES"; } |
48 | | |
49 | 0 | std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<TripleDES>(); } |
50 | | |
51 | | bool has_keying_material() const override; |
52 | | |
53 | | private: |
54 | | void key_schedule(std::span<const uint8_t>) override; |
55 | | |
56 | | secure_vector<uint32_t> m_round_key; |
57 | | }; |
58 | | |
59 | | } // namespace Botan |
60 | | |
61 | | #endif |