Botan  2.1.0
Crypto and TLS for C++11
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Botan::Serpent Class Referencefinal

#include <serpent.h>

Inheritance diagram for Botan::Serpent:
Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 > Botan::BlockCipher Botan::SymmetricAlgorithm

Public Types

enum  
 

Public Member Functions

size_t block_size () const override
 
void clear () override
 
BlockCipherclone () const override
 
void decrypt (const uint8_t in[], uint8_t out[]) const
 
void decrypt (uint8_t block[]) const
 
template<typename Alloc >
void decrypt (std::vector< uint8_t, Alloc > &block) const
 
template<typename Alloc , typename Alloc2 >
void decrypt (const std::vector< uint8_t, Alloc > &in, std::vector< uint8_t, Alloc2 > &out) const
 
void decrypt_n (const uint8_t in[], uint8_t out[], size_t blocks) const override
 
void encrypt (const uint8_t in[], uint8_t out[]) const
 
void encrypt (uint8_t block[]) const
 
template<typename Alloc >
void encrypt (std::vector< uint8_t, Alloc > &block) const
 
template<typename Alloc , typename Alloc2 >
void encrypt (const std::vector< uint8_t, Alloc > &in, std::vector< uint8_t, Alloc2 > &out) const
 
void encrypt_n (const uint8_t in[], uint8_t out[], size_t blocks) const override
 
Key_Length_Specification key_spec () const override
 
size_t maximum_keylength () const
 
size_t minimum_keylength () const
 
std::string name () const override
 
size_t parallel_bytes () const
 
size_t parallelism () const override
 
std::string provider () const override
 
void set_key (const SymmetricKey &key)
 
template<typename Alloc >
void set_key (const std::vector< uint8_t, Alloc > &key)
 
void set_key (const uint8_t key[], size_t length)
 
bool valid_keylength (size_t length) const
 

Static Public Member Functions

static std::unique_ptr< BlockCiphercreate (const std::string &algo_spec, const std::string &provider="")
 
static std::unique_ptr< BlockCiphercreate_or_throw (const std::string &algo_spec, const std::string &provider="")
 
static std::vector< std::string > providers (const std::string &algo_spec)
 

Protected Member Functions

const secure_vector< uint32_t > & get_round_keys () const
 
void set_round_keys (const uint32_t ks[132])
 
void simd_decrypt_4 (const uint8_t in[64], uint8_t out[64]) const
 
void simd_encrypt_4 (const uint8_t in[64], uint8_t out[64]) const
 

Detailed Description

Serpent is the most conservative of the AES finalists http://www.cl.cam.ac.uk/~rja14/serpent.html

Definition at line 19 of file serpent.h.

Member Enumeration Documentation

anonymous enum
inherited

Member Function Documentation

size_t Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD >::block_size ( ) const
inlineoverridevirtualinherited
Returns
block size of this algorithm

Implements Botan::BlockCipher.

Definition at line 187 of file block_cipher.h.

187 { return BS; }
void Botan::Serpent::clear ( )
overridevirtual

Reset the state.

Implements Botan::SymmetricAlgorithm.

Definition at line 242 of file serpent.cpp.

References Botan::zap().

243  {
244  zap(m_round_key);
245  }
void zap(std::vector< T, Alloc > &vec)
Definition: secmem.h:221
BlockCipher* Botan::Serpent::clone ( ) const
inlineoverridevirtual
Returns
new object representing the same algorithm as *this

Implements Botan::BlockCipher.

Definition at line 28 of file serpent.h.

28 { return new Serpent; }
std::unique_ptr< BlockCipher > Botan::BlockCipher::create ( const std::string &  algo_spec,
const std::string &  provider = "" 
)
staticinherited

Create an instance based on a name If provider is empty then best available is chosen.

Parameters
algo_specalgorithm name
providerprovider implementation to choose
Returns
a null pointer if the algo/provider combination cannot be found

Definition at line 88 of file block_cipher.cpp.

References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), Botan::SCAN_Name::arg_count_between(), Botan::BlockCipher::block_size(), BOTAN_UNUSED, Botan::HashFunction::create(), Botan::StreamCipher::create(), hash, and Botan::make_openssl_block_cipher().

Referenced by botan_block_cipher_init(), Botan::MessageAuthenticationCode::create(), Botan::StreamCipher::create(), Botan::BlockCipher::create_or_throw(), Botan::get_aead(), Botan::get_block_cipher(), and Botan::get_cipher_mode().

90  {
91 #if defined(BOTAN_HAS_OPENSSL)
92  if(provider.empty() || provider == "openssl")
93  {
94  if(auto bc = make_openssl_block_cipher(algo))
95  return bc;
96 
97  if(!provider.empty())
98  return nullptr;
99  }
100 #endif
101 
102  // TODO: CommonCrypto
103  // TODO: CryptoAPI
104  // TODO: /dev/crypto
105 
106  // Only base providers from here on out
107  if(provider.empty() == false && provider != "base")
108  return nullptr;
109 
110 #if defined(BOTAN_HAS_AES)
111  if(algo == "AES-128")
112  {
113  return std::unique_ptr<BlockCipher>(new AES_128);
114  }
115 
116  if(algo == "AES-192")
117  {
118  return std::unique_ptr<BlockCipher>(new AES_192);
119  }
120 
121  if(algo == "AES-256")
122  {
123  return std::unique_ptr<BlockCipher>(new AES_256);
124  }
125 #endif
126 
127 #if defined(BOTAN_HAS_SERPENT)
128  if(algo == "Serpent")
129  {
130  return std::unique_ptr<BlockCipher>(new Serpent);
131  }
132 #endif
133 
134 #if defined(BOTAN_HAS_TWOFISH)
135  if(algo == "Twofish")
136  {
137  return std::unique_ptr<BlockCipher>(new Twofish);
138  }
139 #endif
140 
141 #if defined(BOTAN_HAS_THREEFISH_512)
142  if(algo == "Threefish-512")
143  {
144  return std::unique_ptr<BlockCipher>(new Threefish_512);
145  }
146 #endif
147 
148 #if defined(BOTAN_HAS_BLOWFISH)
149  if(algo == "Blowfish")
150  {
151  return std::unique_ptr<BlockCipher>(new Blowfish);
152  }
153 #endif
154 
155 #if defined(BOTAN_HAS_CAMELLIA)
156  if(algo == "Camellia-128")
157  {
158  return std::unique_ptr<BlockCipher>(new Camellia_128);
159  }
160 
161  if(algo == "Camellia-192")
162  {
163  return std::unique_ptr<BlockCipher>(new Camellia_192);
164  }
165 
166  if(algo == "Camellia-256")
167  {
168  return std::unique_ptr<BlockCipher>(new Camellia_256);
169  }
170 #endif
171 
172 #if defined(BOTAN_HAS_DES)
173  if(algo == "DES")
174  {
175  return std::unique_ptr<BlockCipher>(new DES);
176  }
177 
178  if(algo == "DESX")
179  {
180  return std::unique_ptr<BlockCipher>(new DESX);
181  }
182 
183  if(algo == "TripleDES" || algo == "3DES" || algo == "DES-EDE")
184  {
185  return std::unique_ptr<BlockCipher>(new TripleDES);
186  }
187 #endif
188 
189 #if defined(BOTAN_HAS_NOEKEON)
190  if(algo == "Noekeon")
191  {
192  return std::unique_ptr<BlockCipher>(new Noekeon);
193  }
194 #endif
195 
196 #if defined(BOTAN_HAS_CAST)
197  if(algo == "CAST-128" || algo == "CAST5")
198  {
199  return std::unique_ptr<BlockCipher>(new CAST_128);
200  }
201 
202  if(algo == "CAST-256")
203  {
204  return std::unique_ptr<BlockCipher>(new CAST_256);
205  }
206 #endif
207 
208 #if defined(BOTAN_HAS_IDEA)
209  if(algo == "IDEA")
210  {
211  return std::unique_ptr<BlockCipher>(new IDEA);
212  }
213 #endif
214 
215 #if defined(BOTAN_HAS_KASUMI)
216  if(algo == "KASUMI")
217  {
218  return std::unique_ptr<BlockCipher>(new KASUMI);
219  }
220 #endif
221 
222 #if defined(BOTAN_HAS_MISTY1)
223  if(algo == "MISTY1")
224  {
225  return std::unique_ptr<BlockCipher>(new MISTY1);
226  }
227 #endif
228 
229 #if defined(BOTAN_HAS_SEED)
230  if(algo == "SEED")
231  {
232  return std::unique_ptr<BlockCipher>(new SEED);
233  }
234 #endif
235 
236 #if defined(BOTAN_HAS_XTEA)
237  if(algo == "XTEA")
238  {
239  return std::unique_ptr<BlockCipher>(new XTEA);
240  }
241 #endif
242 
243  const SCAN_Name req(algo);
244 
245 #if defined(BOTAN_HAS_GOST_28147_89)
246  if(req.algo_name() == "GOST-28147-89")
247  {
248  return std::unique_ptr<BlockCipher>(new GOST_28147_89(req.arg(0, "R3411_94_TestParam")));
249  }
250 #endif
251 
252 #if defined(BOTAN_HAS_CASCADE)
253  if(req.algo_name() == "Cascade" && req.arg_count() == 2)
254  {
255  std::unique_ptr<BlockCipher> c1(BlockCipher::create(req.arg(0)));
256  std::unique_ptr<BlockCipher> c2(BlockCipher::create(req.arg(1)));
257 
258  if(c1 && c2)
259  return std::unique_ptr<BlockCipher>(new Cascade_Cipher(c1.release(), c2.release()));
260  }
261 #endif
262 
263 #if defined(BOTAN_HAS_LION)
264  if(req.algo_name() == "Lion" && req.arg_count_between(2, 3))
265  {
266  std::unique_ptr<HashFunction> hash(HashFunction::create(req.arg(0)));
267  std::unique_ptr<StreamCipher> stream(StreamCipher::create(req.arg(1)));
268 
269  if(hash && stream)
270  {
271  const size_t block_size = req.arg_as_integer(2, 1024);
272  return std::unique_ptr<BlockCipher>(new Lion(hash.release(), stream.release(), block_size));
273  }
274  }
275 #endif
276 
277  BOTAN_UNUSED(req);
279 
280  return nullptr;
281  }
#define BOTAN_UNUSED(v)
Definition: assert.h:92
static std::unique_ptr< HashFunction > create(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:93
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
static std::unique_ptr< StreamCipher > create(const std::string &algo_spec, const std::string &provider="")
virtual std::string provider() const
Definition: block_cipher.h:71
std::unique_ptr< BlockCipher > make_openssl_block_cipher(const std::string &name)
virtual size_t block_size() const =0
MechanismType hash
std::unique_ptr< BlockCipher > Botan::BlockCipher::create_or_throw ( const std::string &  algo_spec,
const std::string &  provider = "" 
)
staticinherited

Create an instance based on a name, or throw if the algo/provider combination cannot be found. If provider is empty then best available is chosen.

Definition at line 285 of file block_cipher.cpp.

References Botan::BlockCipher::create().

Referenced by Botan::make_block_cipher(), Botan::rfc3394_keyunwrap(), Botan::rfc3394_keywrap(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::TLS_CBC_HMAC_AEAD_Mode().

287  {
288  if(auto bc = BlockCipher::create(algo, provider))
289  {
290  return bc;
291  }
292  throw Lookup_Error("Block cipher", algo, provider);
293  }
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
virtual std::string provider() const
Definition: block_cipher.h:71
void Botan::BlockCipher::decrypt ( const uint8_t  in[],
uint8_t  out[] 
) const
inlineinherited

Decrypt a block.

Parameters
inThe ciphertext block to be decypted as a byte array. Must be of length block_size().
outThe byte array designated to hold the decrypted block. Must be of length block_size().

Definition at line 90 of file block_cipher.h.

Referenced by Botan::DESX::decrypt_n(), Botan::XTS_Decryption::finish(), and Botan::CTS_Decryption::finish().

91  { decrypt_n(in, out, 1); }
virtual void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
void Botan::BlockCipher::decrypt ( uint8_t  block[]) const
inlineinherited

Decrypt a block.

Parameters
blockthe ciphertext block to be decrypted Must be of length block_size(). Will hold the result when the function has finished.

Definition at line 107 of file block_cipher.h.

107 { decrypt_n(block, block, 1); }
virtual void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
template<typename Alloc >
void Botan::BlockCipher::decrypt ( std::vector< uint8_t, Alloc > &  block) const
inlineinherited

Decrypt one or more blocks

Parameters
blockthe input/output buffer (multiple of block_size())

Definition at line 124 of file block_cipher.h.

125  {
126  return decrypt_n(block.data(), block.data(), block.size() / block_size());
127  }
virtual void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
virtual size_t block_size() const =0
template<typename Alloc , typename Alloc2 >
void Botan::BlockCipher::decrypt ( const std::vector< uint8_t, Alloc > &  in,
std::vector< uint8_t, Alloc2 > &  out 
) const
inlineinherited

Decrypt one or more blocks

Parameters
inthe input buffer (multiple of block_size())
outthe output buffer (same size as in)

Definition at line 147 of file block_cipher.h.

149  {
150  return decrypt_n(in.data(), out.data(), in.size() / block_size());
151  }
virtual void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
virtual size_t block_size() const =0
void Botan::Serpent::decrypt_n ( const uint8_t  in[],
uint8_t  out[],
size_t  blocks 
) const
overridevirtual

Decrypt one or more blocks

Parameters
inthe input buffer (multiple of block_size())
outthe output buffer (same size as in)
blocksthe number of blocks to process

Implements Botan::BlockCipher.

Definition at line 118 of file serpent.cpp.

References Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::BLOCK_SIZE, BOTAN_PARALLEL_SIMD_FOR, Botan::CPUID::has_simd_32(), i_transform, key_xor, Botan::load_le(), SBoxD1, SBoxD2, SBoxD3, SBoxD4, SBoxD5, SBoxD6, SBoxD7, SBoxD8, simd_decrypt_4(), and Botan::store_le().

119  {
120 #if defined(BOTAN_HAS_SERPENT_SIMD)
121  if(CPUID::has_simd_32())
122  {
123  while(blocks >= 4)
124  {
125  simd_decrypt_4(in, out);
126  in += 4 * BLOCK_SIZE;
127  out += 4 * BLOCK_SIZE;
128  blocks -= 4;
129  }
130  }
131 #endif
132 
133  BOTAN_PARALLEL_SIMD_FOR(size_t i = 0; i < blocks; ++i)
134  {
135  uint32_t B0, B1, B2, B3;
136  load_le(in + 16*i, B0, B1, B2, B3);
137 
138  key_xor(32,B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(31,B0,B1,B2,B3);
139  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(30,B0,B1,B2,B3);
140  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(29,B0,B1,B2,B3);
141  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(28,B0,B1,B2,B3);
142  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(27,B0,B1,B2,B3);
143  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(26,B0,B1,B2,B3);
144  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor(25,B0,B1,B2,B3);
145  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor(24,B0,B1,B2,B3);
146  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(23,B0,B1,B2,B3);
147  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(22,B0,B1,B2,B3);
148  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(21,B0,B1,B2,B3);
149  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(20,B0,B1,B2,B3);
150  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(19,B0,B1,B2,B3);
151  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(18,B0,B1,B2,B3);
152  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor(17,B0,B1,B2,B3);
153  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor(16,B0,B1,B2,B3);
154  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(15,B0,B1,B2,B3);
155  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(14,B0,B1,B2,B3);
156  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(13,B0,B1,B2,B3);
157  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(12,B0,B1,B2,B3);
158  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(11,B0,B1,B2,B3);
159  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(10,B0,B1,B2,B3);
160  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor( 9,B0,B1,B2,B3);
161  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor( 8,B0,B1,B2,B3);
162  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor( 7,B0,B1,B2,B3);
163  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor( 6,B0,B1,B2,B3);
164  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor( 5,B0,B1,B2,B3);
165  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor( 4,B0,B1,B2,B3);
166  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor( 3,B0,B1,B2,B3);
167  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor( 2,B0,B1,B2,B3);
168  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor( 1,B0,B1,B2,B3);
169  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor( 0,B0,B1,B2,B3);
170 
171  store_le(out + 16*i, B0, B1, B2, B3);
172  }
173  }
#define i_transform(B0, B1, B2, B3)
#define SBoxD4(B0, B1, B2, B3)
Definition: serpent_sbox.h:297
#define SBoxD2(B0, B1, B2, B3)
Definition: serpent_sbox.h:244
#define SBoxD6(B0, B1, B2, B3)
Definition: serpent_sbox.h:349
static bool has_simd_32()
Definition: cpuid.cpp:351
T load_le(const uint8_t in[], size_t off)
Definition: loadstor.h:129
#define SBoxD1(B0, B1, B2, B3)
Definition: serpent_sbox.h:219
void simd_decrypt_4(const uint8_t in[64], uint8_t out[64]) const
#define SBoxD3(B0, B1, B2, B3)
Definition: serpent_sbox.h:272
#define SBoxD8(B0, B1, B2, B3)
Definition: serpent_sbox.h:401
#define key_xor(round, B0, B1, B2, B3)
Definition: serpent.cpp:49
#define SBoxD7(B0, B1, B2, B3)
Definition: serpent_sbox.h:377
#define SBoxD5(B0, B1, B2, B3)
Definition: serpent_sbox.h:323
#define BOTAN_PARALLEL_SIMD_FOR
Definition: compiler.h:146
void store_le(uint16_t in, uint8_t out[2])
Definition: loadstor.h:457
void Botan::BlockCipher::encrypt ( const uint8_t  in[],
uint8_t  out[] 
) const
inlineinherited

Encrypt a block.

Parameters
inThe plaintext block to be encrypted as a byte array. Must be of length block_size().
outThe byte array designated to hold the encrypted block. Must be of length block_size().

Definition at line 80 of file block_cipher.h.

Referenced by Botan::aont_package(), Botan::aont_unpackage(), Botan::DESX::encrypt_n(), Botan::XTS_Encryption::finish(), Botan::CTS_Encryption::finish(), Botan::CFB_Encryption::process(), Botan::CBC_Encryption::process(), and Botan::CFB_Decryption::process().

81  { encrypt_n(in, out, 1); }
virtual void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
void Botan::BlockCipher::encrypt ( uint8_t  block[]) const
inlineinherited

Encrypt a block.

Parameters
blockthe plaintext block to be encrypted Must be of length block_size(). Will hold the result when the function has finished.

Definition at line 99 of file block_cipher.h.

99 { encrypt_n(block, block, 1); }
virtual void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
template<typename Alloc >
void Botan::BlockCipher::encrypt ( std::vector< uint8_t, Alloc > &  block) const
inlineinherited

Encrypt one or more blocks

Parameters
blockthe input/output buffer (multiple of block_size())

Definition at line 114 of file block_cipher.h.

115  {
116  return encrypt_n(block.data(), block.data(), block.size() / block_size());
117  }
virtual void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
virtual size_t block_size() const =0
template<typename Alloc , typename Alloc2 >
void Botan::BlockCipher::encrypt ( const std::vector< uint8_t, Alloc > &  in,
std::vector< uint8_t, Alloc2 > &  out 
) const
inlineinherited

Encrypt one or more blocks

Parameters
inthe input buffer (multiple of block_size())
outthe output buffer (same size as in)

Definition at line 135 of file block_cipher.h.

137  {
138  return encrypt_n(in.data(), out.data(), in.size() / block_size());
139  }
virtual void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const =0
virtual size_t block_size() const =0
void Botan::Serpent::encrypt_n ( const uint8_t  in[],
uint8_t  out[],
size_t  blocks 
) const
overridevirtual

Encrypt one or more blocks

Parameters
inthe input buffer (multiple of block_size())
outthe output buffer (same size as in)
blocksthe number of blocks to process

Implements Botan::BlockCipher.

Definition at line 58 of file serpent.cpp.

References Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::BLOCK_SIZE, BOTAN_PARALLEL_SIMD_FOR, Botan::CPUID::has_simd_32(), key_xor, Botan::load_le(), SBoxE1, SBoxE2, SBoxE3, SBoxE4, SBoxE5, SBoxE6, SBoxE7, SBoxE8, simd_encrypt_4(), Botan::store_le(), and transform.

59  {
60 #if defined(BOTAN_HAS_SERPENT_SIMD)
61  if(CPUID::has_simd_32())
62  {
63  while(blocks >= 4)
64  {
65  simd_encrypt_4(in, out);
66  in += 4 * BLOCK_SIZE;
67  out += 4 * BLOCK_SIZE;
68  blocks -= 4;
69  }
70  }
71 #endif
72 
73  BOTAN_PARALLEL_SIMD_FOR(size_t i = 0; i < blocks; ++i)
74  {
75  uint32_t B0, B1, B2, B3;
76  load_le(in + 16*i, B0, B1, B2, B3);
77 
78  key_xor( 0,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
79  key_xor( 1,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
80  key_xor( 2,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
81  key_xor( 3,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
82  key_xor( 4,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
83  key_xor( 5,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
84  key_xor( 6,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
85  key_xor( 7,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
86  key_xor( 8,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
87  key_xor( 9,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
88  key_xor(10,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
89  key_xor(11,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
90  key_xor(12,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
91  key_xor(13,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
92  key_xor(14,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
93  key_xor(15,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
94  key_xor(16,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
95  key_xor(17,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
96  key_xor(18,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
97  key_xor(19,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
98  key_xor(20,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
99  key_xor(21,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
100  key_xor(22,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
101  key_xor(23,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
102  key_xor(24,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
103  key_xor(25,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
104  key_xor(26,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
105  key_xor(27,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
106  key_xor(28,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
107  key_xor(29,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
108  key_xor(30,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
109  key_xor(31,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); key_xor(32,B0,B1,B2,B3);
110 
111  store_le(out + 16*i, B0, B1, B2, B3);
112  }
113  }
#define SBoxE5(B0, B1, B2, B3)
Definition: serpent_sbox.h:114
#define SBoxE1(B0, B1, B2, B3)
Definition: serpent_sbox.h:14
void simd_encrypt_4(const uint8_t in[64], uint8_t out[64]) const
static bool has_simd_32()
Definition: cpuid.cpp:351
#define SBoxE2(B0, B1, B2, B3)
Definition: serpent_sbox.h:39
#define SBoxE6(B0, B1, B2, B3)
Definition: serpent_sbox.h:141
#define SBoxE7(B0, B1, B2, B3)
Definition: serpent_sbox.h:168
#define SBoxE3(B0, B1, B2, B3)
Definition: serpent_sbox.h:65
T load_le(const uint8_t in[], size_t off)
Definition: loadstor.h:129
#define SBoxE4(B0, B1, B2, B3)
Definition: serpent_sbox.h:88
#define SBoxE8(B0, B1, B2, B3)
Definition: serpent_sbox.h:191
#define key_xor(round, B0, B1, B2, B3)
Definition: serpent.cpp:49
#define transform(B0, B1, B2, B3)
#define BOTAN_PARALLEL_SIMD_FOR
Definition: compiler.h:146
void store_le(uint16_t in, uint8_t out[2])
Definition: loadstor.h:457
const secure_vector<uint32_t>& Botan::Serpent::get_round_keys ( ) const
inlineprotected

For use by subclasses using SIMD, asm, etc

Returns
const reference to the key schedule

Definition at line 49 of file serpent.h.

50  { return m_round_key; }
Key_Length_Specification Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD >::key_spec ( ) const
inlineoverridevirtualinherited
Returns
object describing limits on key size

Implements Botan::SymmetricAlgorithm.

Definition at line 189 of file block_cipher.h.

190  {
191  return Key_Length_Specification(KMIN, KMAX, KMOD);
192  }
size_t Botan::SymmetricAlgorithm::maximum_keylength ( ) const
inlineinherited
Returns
minimum allowed key length

Definition at line 39 of file sym_algo.h.

40  {
41  return key_spec().maximum_keylength();
42  }
size_t maximum_keylength() const
Definition: key_spec.h:69
virtual Key_Length_Specification key_spec() const =0
size_t Botan::SymmetricAlgorithm::minimum_keylength ( ) const
inlineinherited
Returns
maximum allowed key length

Definition at line 47 of file sym_algo.h.

48  {
49  return key_spec().minimum_keylength();
50  }
size_t minimum_keylength() const
Definition: key_spec.h:61
virtual Key_Length_Specification key_spec() const =0
std::string Botan::Serpent::name ( ) const
inlineoverridevirtual
Returns
the algorithm name

Implements Botan::SymmetricAlgorithm.

Definition at line 27 of file serpent.h.

27 { return "Serpent"; }
size_t Botan::BlockCipher::parallel_bytes ( ) const
inlineinherited
Returns
prefererred parallelism of this cipher in bytes

Definition at line 62 of file block_cipher.h.

Referenced by Botan::XTS_Mode::update_granularity(), and Botan::CBC_Mode::update_granularity().

63  {
64  return parallelism() * block_size() * BOTAN_BLOCK_CIPHER_PAR_MULT;
65  }
virtual size_t parallelism() const
Definition: block_cipher.h:57
virtual size_t block_size() const =0
size_t Botan::Serpent::parallelism ( ) const
inlineoverridevirtual
Returns
native parallelism of this cipher in blocks

Reimplemented from Botan::BlockCipher.

Definition at line 30 of file serpent.h.

30 { return 4; }
std::string Botan::Serpent::provider ( ) const
overridevirtual
Returns
provider information about this implementation. Default is "base", might also return "sse2", "avx2", "openssl", or some other arbitrary string.

Reimplemented from Botan::BlockCipher.

Definition at line 247 of file serpent.cpp.

References Botan::CPUID::has_simd_32().

248  {
249 #if defined(BOTAN_HAS_SERPENT_SIMD)
250  if(CPUID::has_simd_32())
251  {
252  return "simd";
253  }
254 #endif
255 
256  return "base";
257  }
static bool has_simd_32()
Definition: cpuid.cpp:351
std::vector< std::string > Botan::BlockCipher::providers ( const std::string &  algo_spec)
staticinherited
Returns
list of available providers for this algorithm, empty if not available
Parameters
algo_specalgorithm name

Definition at line 295 of file block_cipher.cpp.

Referenced by Botan::get_block_cipher_providers().

296  {
297  return probe_providers_of<BlockCipher>(algo, { "base", "openssl" });
298  }
void Botan::SymmetricAlgorithm::set_key ( const SymmetricKey key)
inlineinherited

Set the symmetric key of this object.

Parameters
keythe SymmetricKey to be set.

Definition at line 66 of file sym_algo.h.

References Botan::OctetString::begin(), and Botan::OctetString::length().

Referenced by Botan::aont_package(), Botan::aont_unpackage(), botan_block_cipher_set_key(), botan_mac_set_key(), and Botan::pbkdf2().

67  {
68  set_key(key.begin(), key.length());
69  }
void set_key(const SymmetricKey &key)
Definition: sym_algo.h:66
template<typename Alloc >
void Botan::SymmetricAlgorithm::set_key ( const std::vector< uint8_t, Alloc > &  key)
inlineinherited

Definition at line 72 of file sym_algo.h.

73  {
74  set_key(key.data(), key.size());
75  }
void set_key(const SymmetricKey &key)
Definition: sym_algo.h:66
void Botan::SymmetricAlgorithm::set_key ( const uint8_t  key[],
size_t  length 
)
inlineinherited

Set the symmetric key of this object.

Parameters
keythe to be set as a byte array.
lengthin bytes of key param

Definition at line 82 of file sym_algo.h.

83  {
84  if(!valid_keylength(length))
85  throw Invalid_Key_Length(name(), length);
86  key_schedule(key, length);
87  }
bool valid_keylength(size_t length) const
Definition: sym_algo.h:57
virtual std::string name() const =0
void Botan::Serpent::set_round_keys ( const uint32_t  ks[132])
inlineprotected

For use by subclasses that implement the key schedule

Parameters
ksis the new key schedule value to set

Definition at line 56 of file serpent.h.

57  {
58  m_round_key.assign(&ks[0], &ks[132]);
59  }
void Botan::Serpent::simd_decrypt_4 ( const uint8_t  in[64],
uint8_t  out[64] 
) const
protected

Decrypt 4 blocks in parallel using SSE2 or AltiVec

Definition at line 116 of file serpent_simd.cpp.

References i_transform, key_xor, Botan::SIMD_4x32::load_le(), SBoxD1, SBoxD2, SBoxD3, SBoxD4, SBoxD5, SBoxD6, SBoxD7, SBoxD8, Botan::SIMD_4x32::store_le(), and Botan::SIMD_4x32::transpose().

Referenced by decrypt_n().

117  {
118  SIMD_32 B0 = SIMD_32::load_le(in);
119  SIMD_32 B1 = SIMD_32::load_le(in + 16);
120  SIMD_32 B2 = SIMD_32::load_le(in + 32);
121  SIMD_32 B3 = SIMD_32::load_le(in + 48);
122 
123  SIMD_32::transpose(B0, B1, B2, B3);
124 
125  key_xor(32,B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(31,B0,B1,B2,B3);
126  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(30,B0,B1,B2,B3);
127  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(29,B0,B1,B2,B3);
128  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(28,B0,B1,B2,B3);
129  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(27,B0,B1,B2,B3);
130  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(26,B0,B1,B2,B3);
131  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor(25,B0,B1,B2,B3);
132  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor(24,B0,B1,B2,B3);
133 
134  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(23,B0,B1,B2,B3);
135  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(22,B0,B1,B2,B3);
136  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(21,B0,B1,B2,B3);
137  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(20,B0,B1,B2,B3);
138  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(19,B0,B1,B2,B3);
139  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(18,B0,B1,B2,B3);
140  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor(17,B0,B1,B2,B3);
141  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor(16,B0,B1,B2,B3);
142 
143  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor(15,B0,B1,B2,B3);
144  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor(14,B0,B1,B2,B3);
145  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor(13,B0,B1,B2,B3);
146  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor(12,B0,B1,B2,B3);
147  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor(11,B0,B1,B2,B3);
148  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor(10,B0,B1,B2,B3);
149  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor( 9,B0,B1,B2,B3);
150  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor( 8,B0,B1,B2,B3);
151 
152  i_transform(B0,B1,B2,B3); SBoxD8(B0,B1,B2,B3); key_xor( 7,B0,B1,B2,B3);
153  i_transform(B0,B1,B2,B3); SBoxD7(B0,B1,B2,B3); key_xor( 6,B0,B1,B2,B3);
154  i_transform(B0,B1,B2,B3); SBoxD6(B0,B1,B2,B3); key_xor( 5,B0,B1,B2,B3);
155  i_transform(B0,B1,B2,B3); SBoxD5(B0,B1,B2,B3); key_xor( 4,B0,B1,B2,B3);
156  i_transform(B0,B1,B2,B3); SBoxD4(B0,B1,B2,B3); key_xor( 3,B0,B1,B2,B3);
157  i_transform(B0,B1,B2,B3); SBoxD3(B0,B1,B2,B3); key_xor( 2,B0,B1,B2,B3);
158  i_transform(B0,B1,B2,B3); SBoxD2(B0,B1,B2,B3); key_xor( 1,B0,B1,B2,B3);
159  i_transform(B0,B1,B2,B3); SBoxD1(B0,B1,B2,B3); key_xor( 0,B0,B1,B2,B3);
160 
161  SIMD_32::transpose(B0, B1, B2, B3);
162 
163  B0.store_le(out);
164  B1.store_le(out + 16);
165  B2.store_le(out + 32);
166  B3.store_le(out + 48);
167  }
#define i_transform(B0, B1, B2, B3)
#define SBoxD4(B0, B1, B2, B3)
Definition: serpent_sbox.h:297
static SIMD_4x32 load_le(const void *in)
Definition: simd_32.h:128
#define SBoxD2(B0, B1, B2, B3)
Definition: serpent_sbox.h:244
#define SBoxD6(B0, B1, B2, B3)
Definition: serpent_sbox.h:349
#define key_xor(round, B0, B1, B2, B3)
static void transpose(SIMD_4x32 &B0, SIMD_4x32 &B1, SIMD_4x32 &B2, SIMD_4x32 &B3)
Definition: simd_32.h:564
#define SBoxD1(B0, B1, B2, B3)
Definition: serpent_sbox.h:219
SIMD_4x32 SIMD_32
Definition: simd_32.h:650
#define SBoxD3(B0, B1, B2, B3)
Definition: serpent_sbox.h:272
#define SBoxD8(B0, B1, B2, B3)
Definition: serpent_sbox.h:401
#define SBoxD7(B0, B1, B2, B3)
Definition: serpent_sbox.h:377
#define SBoxD5(B0, B1, B2, B3)
Definition: serpent_sbox.h:323
void Botan::Serpent::simd_encrypt_4 ( const uint8_t  in[64],
uint8_t  out[64] 
) const
protected

Encrypt 4 blocks in parallel using SSE2 or AltiVec

Definition at line 60 of file serpent_simd.cpp.

References key_xor, Botan::SIMD_4x32::load_le(), SBoxE1, SBoxE2, SBoxE3, SBoxE4, SBoxE5, SBoxE6, SBoxE7, SBoxE8, Botan::SIMD_4x32::store_le(), transform, and Botan::SIMD_4x32::transpose().

Referenced by encrypt_n().

61  {
62  SIMD_32 B0 = SIMD_32::load_le(in);
63  SIMD_32 B1 = SIMD_32::load_le(in + 16);
64  SIMD_32 B2 = SIMD_32::load_le(in + 32);
65  SIMD_32 B3 = SIMD_32::load_le(in + 48);
66 
67  SIMD_32::transpose(B0, B1, B2, B3);
68 
69  key_xor( 0,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
70  key_xor( 1,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
71  key_xor( 2,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
72  key_xor( 3,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
73  key_xor( 4,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
74  key_xor( 5,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
75  key_xor( 6,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
76  key_xor( 7,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
77 
78  key_xor( 8,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
79  key_xor( 9,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
80  key_xor(10,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
81  key_xor(11,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
82  key_xor(12,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
83  key_xor(13,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
84  key_xor(14,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
85  key_xor(15,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
86 
87  key_xor(16,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
88  key_xor(17,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
89  key_xor(18,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
90  key_xor(19,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
91  key_xor(20,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
92  key_xor(21,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
93  key_xor(22,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
94  key_xor(23,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); transform(B0,B1,B2,B3);
95 
96  key_xor(24,B0,B1,B2,B3); SBoxE1(B0,B1,B2,B3); transform(B0,B1,B2,B3);
97  key_xor(25,B0,B1,B2,B3); SBoxE2(B0,B1,B2,B3); transform(B0,B1,B2,B3);
98  key_xor(26,B0,B1,B2,B3); SBoxE3(B0,B1,B2,B3); transform(B0,B1,B2,B3);
99  key_xor(27,B0,B1,B2,B3); SBoxE4(B0,B1,B2,B3); transform(B0,B1,B2,B3);
100  key_xor(28,B0,B1,B2,B3); SBoxE5(B0,B1,B2,B3); transform(B0,B1,B2,B3);
101  key_xor(29,B0,B1,B2,B3); SBoxE6(B0,B1,B2,B3); transform(B0,B1,B2,B3);
102  key_xor(30,B0,B1,B2,B3); SBoxE7(B0,B1,B2,B3); transform(B0,B1,B2,B3);
103  key_xor(31,B0,B1,B2,B3); SBoxE8(B0,B1,B2,B3); key_xor(32,B0,B1,B2,B3);
104 
105  SIMD_32::transpose(B0, B1, B2, B3);
106 
107  B0.store_le(out);
108  B1.store_le(out + 16);
109  B2.store_le(out + 32);
110  B3.store_le(out + 48);
111  }
#define SBoxE5(B0, B1, B2, B3)
Definition: serpent_sbox.h:114
static SIMD_4x32 load_le(const void *in)
Definition: simd_32.h:128
#define SBoxE1(B0, B1, B2, B3)
Definition: serpent_sbox.h:14
#define key_xor(round, B0, B1, B2, B3)
static void transpose(SIMD_4x32 &B0, SIMD_4x32 &B1, SIMD_4x32 &B2, SIMD_4x32 &B3)
Definition: simd_32.h:564
#define SBoxE2(B0, B1, B2, B3)
Definition: serpent_sbox.h:39
#define SBoxE6(B0, B1, B2, B3)
Definition: serpent_sbox.h:141
#define SBoxE7(B0, B1, B2, B3)
Definition: serpent_sbox.h:168
#define SBoxE3(B0, B1, B2, B3)
Definition: serpent_sbox.h:65
SIMD_4x32 SIMD_32
Definition: simd_32.h:650
#define SBoxE4(B0, B1, B2, B3)
Definition: serpent_sbox.h:88
#define SBoxE8(B0, B1, B2, B3)
Definition: serpent_sbox.h:191
#define transform(B0, B1, B2, B3)
bool Botan::SymmetricAlgorithm::valid_keylength ( size_t  length) const
inlineinherited

Check whether a given key length is valid for this algorithm.

Parameters
lengththe key length to be checked.
Returns
true if the key length is valid.

Definition at line 57 of file sym_algo.h.

Referenced by Botan::aont_package(), and Botan::aont_unpackage().

58  {
59  return key_spec().valid_keylength(length);
60  }
bool valid_keylength(size_t length) const
Definition: key_spec.h:51
virtual Key_Length_Specification key_spec() const =0

The documentation for this class was generated from the following files: