|
Botan 3.13.0
Crypto and TLS for C&
|
#include <serpent.h>
Public Types | |
| enum | |
Public Member Functions | |
| size_t | block_size () const final |
| void | clear () override |
| BlockCipher * | clone () const |
| void | decrypt (const uint8_t in[], uint8_t out[]) const |
| void | decrypt (std::span< const uint8_t > in, std::span< uint8_t > out) const |
| void | decrypt (std::span< uint8_t > block) const |
| void | decrypt (uint8_t block[]) const |
| void | decrypt_n (const uint8_t in[], uint8_t out[], size_t blocks) const override |
| void | decrypt_n_xex (uint8_t data[], const uint8_t mask[], size_t blocks) const |
| void | encrypt (const uint8_t in[], uint8_t out[]) const |
| void | encrypt (std::span< const uint8_t > in, std::span< uint8_t > out) const |
| void | encrypt (std::span< uint8_t > block) const |
| void | encrypt (uint8_t block[]) const |
| void | encrypt_n (const uint8_t in[], uint8_t out[], size_t blocks) const override |
| void | encrypt_n_xex (uint8_t data[], const uint8_t mask[], size_t blocks) const |
| bool | has_keying_material () const override |
| Key_Length_Specification | key_spec () const final |
| size_t | maximum_keylength () const |
| size_t | minimum_keylength () const |
| std::string | name () const override |
| std::unique_ptr< BlockCipher > | new_object () const override |
| size_t | parallel_bytes () const |
| size_t | parallelism () const override |
| std::string | provider () const override |
| void | set_key (const OctetString &key) |
| void | set_key (const uint8_t key[], size_t length) |
| void | set_key (std::span< const uint8_t > key) |
| bool | valid_keylength (size_t length) const |
Static Public Member Functions | |
| static std::unique_ptr< BlockCipher > | create (std::string_view algo_spec, std::string_view provider="") |
| static std::unique_ptr< BlockCipher > | create_or_throw (std::string_view algo_spec, std::string_view provider="") |
| static std::vector< std::string > | providers (std::string_view algo_spec) |
Static Public Attributes | |
| static constexpr size_t | ParallelismMult |
Protected Member Functions | |
| void | assert_key_material_set () const |
| void | assert_key_material_set (bool predicate) const |
Serpent is the most conservative of the AES finalists https://www.cl.cam.ac.uk/~rja14/serpent.html
|
inherited |
Definition at line 234 of file block_cipher.h.
|
inlineprotectedinherited |
Throw Key_Not_Set unless a key has been set on this object
Definition at line 180 of file sym_algo.h.
Referenced by Botan::Serpent::decrypt_n(), Botan::Twofish::decrypt_n(), Botan::Serpent::encrypt_n(), and Botan::Twofish::encrypt_n().
|
inlineprotectedinherited |
Throw Key_Not_Set unless the predicate holds
| predicate | if false, a Key_Not_Set exception is thrown |
Definition at line 186 of file sym_algo.h.
|
inlinefinalvirtualinherited |
Return the block size of this cipher
Implements Botan::BlockCipher.
Definition at line 240 of file block_cipher.h.
|
overridevirtual |
Reset the internal state. This includes not just the key, but any partial message that may have been in process.
Implements Botan::SymmetricAlgorithm.
Definition at line 390 of file serpent.cpp.
References Botan::zap().
|
inlineinherited |
Create a new uninitialized object of the same type
Definition at line 210 of file block_cipher.h.
|
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 31 of file block_cipher.cpp.
|
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 38 of file block_cipher.cpp.
|
inlineinherited |
Decrypt a block.
| in | The ciphertext block to be decrypted 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 96 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 144 of file block_cipher.h.
|
inlineinherited |
Decrypt one or more blocks
| Block Ciphers | the input/output buffer (multiple of block_size()) |
Definition at line 126 of file block_cipher.h.
|
inlineinherited |
Decrypt a block.
| Block Ciphers | the ciphertext block to be decrypted Must be of length block_size(). Will hold the result when the function has finished. |
Definition at line 112 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 174 of file serpent.cpp.
References Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::assert_key_material_set(), Botan::CPUFeature::AVX2, Botan::CPUFeature::AVX512, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::BLOCK_SIZE, Botan::CPUID::has(), Botan::Serpent_F::i_transform(), Botan::load_le(), Botan::Serpent_F::SBoxD0(), Botan::Serpent_F::SBoxD1(), Botan::Serpent_F::SBoxD2(), Botan::Serpent_F::SBoxD3(), Botan::Serpent_F::SBoxD4(), Botan::Serpent_F::SBoxD5(), Botan::Serpent_F::SBoxD6(), Botan::Serpent_F::SBoxD7(), Botan::CPUFeature::SIMD_4X32, and Botan::store_le().
|
inlineinherited |
Decrypt blocks in XEX mode: XOR with the mask, decrypt, then XOR again
| data | the input/output buffer of blocks*block_size() bytes |
| mask | the mask to XOR with, same size as data |
| blocks | the number of blocks to process |
Definition at line 189 of file block_cipher.h.
|
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 87 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.
|
inlineinherited |
Encrypt one or more blocks
| Block Ciphers | the input/output buffer (multiple of block_size()) |
Definition at line 118 of file block_cipher.h.
|
inlineinherited |
Encrypt a block.
| Block Ciphers | the plaintext block to be encrypted Must be of length block_size(). Will hold the result when the function has finished. |
Definition at line 104 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 23 of file serpent.cpp.
References Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::assert_key_material_set(), Botan::CPUFeature::AVX2, Botan::CPUFeature::AVX512, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >::BLOCK_SIZE, Botan::CPUID::has(), Botan::load_le(), Botan::Serpent_F::SBoxE0(), Botan::Serpent_F::SBoxE1(), Botan::Serpent_F::SBoxE2(), Botan::Serpent_F::SBoxE3(), Botan::Serpent_F::SBoxE4(), Botan::Serpent_F::SBoxE5(), Botan::Serpent_F::SBoxE6(), Botan::Serpent_F::SBoxE7(), Botan::CPUFeature::SIMD_4X32, Botan::store_le(), and Botan::Serpent_F::transform().
|
inlineinherited |
Encrypt blocks in XEX mode: XOR with the mask, encrypt, then XOR again
| data | the input/output buffer of blocks*block_size() bytes |
| mask | the mask to XOR with, same size as data |
| blocks | the number of blocks to process |
Definition at line 171 of file block_cipher.h.
|
overridevirtual |
Test whether a key has been set on this object
Implements Botan::SymmetricAlgorithm.
Definition at line 322 of file serpent.cpp.
|
inlinefinalvirtualinherited |
Return the key lengths supported by this cipher
Implements Botan::SymmetricAlgorithm.
Definition at line 246 of file block_cipher.h.
|
inlineinherited |
Return the largest acceptable key length
Definition at line 130 of file sym_algo.h.
|
inlineinherited |
Return the smallest acceptable key length
Definition at line 136 of file sym_algo.h.
|
inlineoverridevirtual |
Return the name of this algorithm
Implements Botan::SymmetricAlgorithm.
Definition at line 28 of file serpent.h.
|
inlineoverridevirtual |
Create a new uninitialized object of the same type
Implements Botan::BlockCipher.
Definition at line 30 of file serpent.h.
|
inlineinherited |
Return the preferred input size for bulk processing
Definition at line 71 of file block_cipher.h.
|
inlineoverridevirtual |
Return how many blocks this cipher processes in parallel
Reimplemented from Botan::BlockCipher.
Definition at line 32 of file serpent.h.
|
overridevirtual |
Return the name of the provider implementing this object
Reimplemented from Botan::BlockCipher.
Definition at line 394 of file serpent.cpp.
References Botan::CPUFeature::AVX2, Botan::CPUFeature::AVX512, Botan::CPUID::check(), and Botan::CPUFeature::SIMD_4X32.
|
staticinherited |
List the providers available for a given block cipher
| algo_spec | algorithm name |
Definition at line 45 of file block_cipher.cpp.
|
inherited |
Set the symmetric key of this object.
| key | the SymmetricKey to be set. |
Definition at line 149 of file sym_algo.cpp.
|
inlineinherited |
|
inherited |
Set the symmetric key of this object.
| key | the contiguous byte range to be set. |
Definition at line 155 of file sym_algo.cpp.
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
| length | the key length to be checked. |
Definition at line 143 of file sym_algo.h.
|
staticconstexprinherited |
Multiplier on a block cipher's native parallelism
Usually notable performance gains come from further loop blocking, at least for 2 or 4x
Definition at line 53 of file block_cipher.h.