Botan: src/block/cast/cast128.h Source File

Botan 1.10.16

cast128.h
Go to the documentation of this file.
1 /*
2 * CAST-128
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_CAST128_H__
9 #define BOTAN_CAST128_H__
10
11 #include <botan/block_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * CAST-128
17 */
18 class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16>
19 {
20 public:
21 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
22 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
23
24 void clear() { zeroise(MK); zeroise(RK); }
25 std::string name() const { return "CAST-128"; }
26 BlockCipher* clone() const { return new CAST_128; }
27
28 CAST_128() : MK(16), RK(16) {}
29 private:
30 void key_schedule(const byte[], size_t);
31
32 static void cast_ks(MemoryRegion<u32bit>& ks,
33 MemoryRegion<u32bit>& user_key);
34
35 static const u32bit S5[256];
36 static const u32bit S6[256];
37 static const u32bit S7[256];
38 static const u32bit S8[256];
39
40 SecureVector<u32bit> MK, RK;
41 };
42
43 extern const u32bit CAST_SBOX1[256];
44 extern const u32bit CAST_SBOX2[256];
45 extern const u32bit CAST_SBOX3[256];
46 extern const u32bit CAST_SBOX4[256];
47
48 }
49
50 #endif
Botan::CAST_128::clear
void clear()
Definition: cast128.h:24
Botan::CAST_128
Definition: cast128.h:18
Botan::CAST_SBOX2
const u32bit CAST_SBOX2[256]
Definition: cast256.h:40
Botan::CAST_SBOX1
const u32bit CAST_SBOX1[256]
Definition: cast256.h:39
Botan::CAST_128::CAST_128
CAST_128()
Definition: cast128.h:28
Botan::CAST_128::clone
BlockCipher * clone() const
Definition: cast128.h:26
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::CAST_128::name
std::string name() const
Definition: cast128.h:25
Botan::CAST_SBOX4
const u32bit CAST_SBOX4[256]
Definition: cast256.h:42
Botan::MemoryRegion< u32bit >
Botan
Definition: algo_base.h:14
Botan::SecureVector< u32bit >
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:104
Botan::zeroise
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::CAST_SBOX3
const u32bit CAST_SBOX3[256]
Definition: cast256.h:41
Botan::BlockCipher
Definition: block_cipher.h:18