Botan
2.1.0
Crypto and TLS for C++11
|
#include <serpent.h>
Public Types | |
enum | |
Public Member Functions | |
size_t | block_size () const override |
void | clear () override |
BlockCipher * | clone () 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< BlockCipher > | create (const std::string &algo_spec, const std::string &provider="") |
static std::unique_ptr< BlockCipher > | create_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 |
Serpent is the most conservative of the AES finalists http://www.cl.cam.ac.uk/~rja14/serpent.html
|
inherited |
Definition at line 186 of file block_cipher.h.
|
inlineoverridevirtualinherited |
Implements Botan::BlockCipher.
Definition at line 187 of file block_cipher.h.
|
overridevirtual |
Reset the state.
Implements Botan::SymmetricAlgorithm.
Definition at line 242 of file serpent.cpp.
References Botan::zap().
|
inlineoverridevirtual |
Implements Botan::BlockCipher.
|
staticinherited |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to choose |
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().
|
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().
|
inlineinherited |
Decrypt a block.
in | The ciphertext block to be decypted as a byte array. Must be of length block_size(). |
out | The 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().
|
inlineinherited |
Decrypt a block.
block | the 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.
|
inlineinherited |
Decrypt one or more blocks
block | the input/output buffer (multiple of block_size()) |
Definition at line 124 of file block_cipher.h.
|
inlineinherited |
Decrypt one or more blocks
in | the input buffer (multiple of block_size()) |
out | the output buffer (same size as in) |
Definition at line 147 of file block_cipher.h.
|
overridevirtual |
Decrypt one or more blocks
in | the input buffer (multiple of block_size()) |
out | the output buffer (same size as in) |
blocks | the 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().
|
inlineinherited |
Encrypt a block.
in | The plaintext block to be encrypted as a byte array. Must be of length block_size(). |
out | The 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().
|
inlineinherited |
Encrypt a block.
block | the 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.
|
inlineinherited |
Encrypt one or more blocks
block | the input/output buffer (multiple of block_size()) |
Definition at line 114 of file block_cipher.h.
|
inlineinherited |
Encrypt one or more blocks
in | the input buffer (multiple of block_size()) |
out | the output buffer (same size as in) |
Definition at line 135 of file block_cipher.h.
|
overridevirtual |
Encrypt one or more blocks
in | the input buffer (multiple of block_size()) |
out | the output buffer (same size as in) |
blocks | the 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.
|
inlineprotected |
|
inlineoverridevirtualinherited |
Implements Botan::SymmetricAlgorithm.
Definition at line 189 of file block_cipher.h.
|
inlineinherited |
Definition at line 39 of file sym_algo.h.
|
inlineinherited |
Definition at line 47 of file sym_algo.h.
|
inlineoverridevirtual |
Implements Botan::SymmetricAlgorithm.
|
inlineinherited |
Definition at line 62 of file block_cipher.h.
Referenced by Botan::XTS_Mode::update_granularity(), and Botan::CBC_Mode::update_granularity().
|
inlineoverridevirtual |
Reimplemented from Botan::BlockCipher.
|
overridevirtual |
Reimplemented from Botan::BlockCipher.
Definition at line 247 of file serpent.cpp.
References Botan::CPUID::has_simd_32().
|
staticinherited |
algo_spec | algorithm name |
Definition at line 295 of file block_cipher.cpp.
Referenced by Botan::get_block_cipher_providers().
|
inlineinherited |
Set the symmetric key of this object.
key | the 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().
|
inlineinherited |
Definition at line 72 of file sym_algo.h.
|
inlineinherited |
Set the symmetric key of this object.
key | the to be set as a byte array. |
length | in bytes of key param |
Definition at line 82 of file sym_algo.h.
|
inlineprotected |
|
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().
|
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().
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 57 of file sym_algo.h.
Referenced by Botan::aont_package(), and Botan::aont_unpackage().