Botan
2.1.0
Crypto and TLS for C++11
|
#include <chacha.h>
Public Member Functions | |
ChaCha (size_t rounds=20) | |
void | cipher (const uint8_t in[], uint8_t out[], size_t length) override |
void | cipher1 (uint8_t buf[], size_t len) |
void | clear () override |
StreamCipher * | clone () const override |
template<typename Alloc > | |
void | decrypt (std::vector< uint8_t, Alloc > &inout) |
template<typename Alloc > | |
void | encipher (std::vector< uint8_t, Alloc > &inout) |
template<typename Alloc > | |
void | encrypt (std::vector< uint8_t, Alloc > &inout) |
Key_Length_Specification | key_spec () const override |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
std::string | name () const override |
std::string | provider () const override |
void | seek (uint64_t offset) override |
void | set_iv (const uint8_t iv[], size_t iv_len) 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_iv_length (size_t iv_len) const override |
bool | valid_keylength (size_t length) const |
Static Public Member Functions | |
static std::unique_ptr< StreamCipher > | create (const std::string &algo_spec, const std::string &provider="") |
static std::unique_ptr< StreamCipher > | create_or_throw (const std::string &algo_spec, const std::string &provider="") |
static std::vector< std::string > | providers (const std::string &algo_spec) |
DJB's ChaCha (http://cr.yp.to/chacha.html)
Botan::ChaCha::ChaCha | ( | size_t | rounds = 20 | ) |
rounds | number of rounds |
Definition at line 14 of file chacha.cpp.
|
overridevirtual |
Encrypt or decrypt a message
in | the plaintext |
out | the byte array to hold the output, i.e. the ciphertext |
len | the length of both in and out in bytes |
Implements Botan::StreamCipher.
Definition at line 117 of file chacha.cpp.
References Botan::xor_buf().
|
inlineinherited |
Encrypt or decrypt a message The message is encrypted/decrypted in place.
buf | the plaintext / ciphertext |
len | the length of buf in bytes |
Definition at line 65 of file stream_cipher.h.
Referenced by Botan::SIV_Encryption::finish().
|
overridevirtual |
Reset the state.
Implements Botan::SymmetricAlgorithm.
Definition at line 209 of file chacha.cpp.
References Botan::zap().
|
inlineoverridevirtual |
Implements Botan::StreamCipher.
Definition at line 21 of file chacha.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 use |
Definition at line 41 of file stream_cipher.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), BOTAN_UNUSED, and Botan::BlockCipher::create().
Referenced by Botan::BlockCipher::create(), Botan::StreamCipher::create_or_throw(), Botan::get_cipher_mode(), and Botan::get_stream_cipher().
|
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 use Throws a Lookup_Error if the algo/provider combination cannot be found |
Definition at line 123 of file stream_cipher.cpp.
References Botan::StreamCipher::create().
Referenced by Botan::make_stream_cipher().
|
inlineinherited |
Decrypt a message in place The message is decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 92 of file stream_cipher.h.
|
inlineinherited |
Encrypt a message The message is encrypted/decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 74 of file stream_cipher.h.
|
inlineinherited |
Encrypt a message The message is encrypted in place.
inout | the plaintext / ciphertext |
Definition at line 83 of file stream_cipher.h.
|
inlineoverridevirtual |
Implements Botan::SymmetricAlgorithm.
|
inlineinherited |
Definition at line 39 of file sym_algo.h.
|
inlineinherited |
Definition at line 47 of file sym_algo.h.
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 216 of file chacha.cpp.
References Botan::ASN1::to_string().
Referenced by set_iv().
|
overridevirtual |
Reimplemented from Botan::StreamCipher.
Definition at line 20 of file chacha.cpp.
|
staticinherited |
Definition at line 133 of file stream_cipher.cpp.
Referenced by Botan::get_stream_cipher_providers().
|
overridevirtual |
Set the offset and the state used later to generate the keystream
offset | the offset where we begin to generate the keystream |
Implements Botan::StreamCipher.
Definition at line 221 of file chacha.cpp.
References Botan::load_le< uint32_t >(), and Botan::store_le().
|
overridevirtual |
Resync the cipher using the IV
iv | the initialization vector |
iv_len | the length of the IV in bytes |
Implements Botan::StreamCipher.
Definition at line 179 of file chacha.cpp.
References Botan::load_le< uint32_t >(), name(), and valid_iv_length().
|
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.
|
overridevirtual |
iv_len | the length of the IV in bytes |
Reimplemented from Botan::StreamCipher.
Definition at line 174 of file chacha.cpp.
Referenced by set_iv().
|
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().