/src/botan/build/include/botan/internal/camellia.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Camellia |
3 | | * (C) 2012 Jack Lloyd |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | */ |
7 | | |
8 | | #ifndef BOTAN_CAMELLIA_H_ |
9 | | #define BOTAN_CAMELLIA_H_ |
10 | | |
11 | | #include <botan/block_cipher.h> |
12 | | |
13 | | namespace Botan { |
14 | | |
15 | | /** |
16 | | * Camellia-128 |
17 | | */ |
18 | | class Camellia_128 final : public Block_Cipher_Fixed_Params<16, 16> { |
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 | 52 | std::string name() const override { return "Camellia-128"; } |
26 | | |
27 | 0 | std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<Camellia_128>(); } |
28 | | |
29 | | bool has_keying_material() const override; |
30 | | |
31 | | private: |
32 | | void key_schedule(std::span<const uint8_t> key) override; |
33 | | |
34 | | secure_vector<uint64_t> m_SK; |
35 | | }; |
36 | | |
37 | | /** |
38 | | * Camellia-192 |
39 | | */ |
40 | | class Camellia_192 final : public Block_Cipher_Fixed_Params<16, 24> { |
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 | 7 | std::string name() const override { return "Camellia-192"; } |
48 | | |
49 | 0 | std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<Camellia_192>(); } |
50 | | |
51 | | bool has_keying_material() const override; |
52 | | |
53 | | private: |
54 | | void key_schedule(std::span<const uint8_t> key) override; |
55 | | |
56 | | secure_vector<uint64_t> m_SK; |
57 | | }; |
58 | | |
59 | | /** |
60 | | * Camellia-256 |
61 | | */ |
62 | | class Camellia_256 final : public Block_Cipher_Fixed_Params<16, 32> { |
63 | | public: |
64 | | void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
65 | | void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; |
66 | | |
67 | | void clear() override; |
68 | | |
69 | 36 | std::string name() const override { return "Camellia-256"; } |
70 | | |
71 | 0 | std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<Camellia_256>(); } |
72 | | |
73 | | bool has_keying_material() const override; |
74 | | |
75 | | private: |
76 | | void key_schedule(std::span<const uint8_t> key) override; |
77 | | |
78 | | secure_vector<uint64_t> m_SK; |
79 | | }; |
80 | | |
81 | | } // namespace Botan |
82 | | |
83 | | #endif |