Botan  1.10.9
safer_sk.h
Go to the documentation of this file.
1 /*
2 * SAFER-SK
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_SAFER_SK_H__
9 #define BOTAN_SAFER_SK_H__
10 
11 #include <botan/block_cipher.h>
12 
13 namespace Botan {
14 
15 /**
16 * SAFER-SK
17 */
18 class BOTAN_DLL SAFER_SK : public Block_Cipher_Fixed_Params<8, 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(EK); }
25  std::string name() const;
26  BlockCipher* clone() const;
27 
28  /**
29  * @param rounds the number of rounds to use - must be between 1
30  * and 13
31  */
32  SAFER_SK(size_t rounds);
33  private:
34  size_t get_rounds() const { return (EK.size() - 8) / 16; }
35  void key_schedule(const byte[], size_t);
36 
37  SecureVector<byte> EK;
38  };
39 
40 }
41 
42 #endif
unsigned char byte
Definition: types.h:22
void clear()
Definition: safer_sk.h:24
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415