Botan  2.11.0
Crypto and TLS for C++11
salsa20.h
Go to the documentation of this file.
1 /*
2 * Salsa20 / XSalsa20
3 * (C) 1999-2010 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_SALSA20_H_
9 #define BOTAN_SALSA20_H_
10 
11 #include <botan/stream_cipher.h>
12 
13 namespace Botan {
14 
15 /**
16 * DJB's Salsa20 (and XSalsa20)
17 */
18 class BOTAN_PUBLIC_API(2,0) Salsa20 final : public StreamCipher
19  {
20  public:
21  void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
22 
23  void set_iv(const uint8_t iv[], size_t iv_len) override;
24 
25  bool valid_iv_length(size_t iv_len) const override;
26 
27  size_t default_iv_length() const override;
28 
29  Key_Length_Specification key_spec() const override;
30 
31  void clear() override;
32  std::string name() const override;
33  StreamCipher* clone() const override;
34 
35  static void salsa_core(uint8_t output[64], const uint32_t input[16], size_t rounds);
36  static void hsalsa20(uint32_t output[8], const uint32_t input[16]);
37 
38  void seek(uint64_t offset) override;
39  private:
40  void key_schedule(const uint8_t key[], size_t key_len) override;
41 
42  void initialize_state();
43 
44  secure_vector<uint32_t> m_key;
45  secure_vector<uint32_t> m_state;
46  secure_vector<uint8_t> m_buffer;
47  size_t m_position = 0;
48  };
49 
50 }
51 
52 #endif
bool BigInt BigInt size_t size_t const std::vector< uint8_t > size_t offset
Definition: numthry.h:271
int(* final)(unsigned char *, CTX *)
void const uint8_t in[]
Definition: mgf1.h:26
char * name
Definition: ffi.h:330
void BlockCipher * cipher
Definition: package.h:29
class BOTAN_PUBLIC_API(2, 11) Argon2 final class BOTAN_PUBLIC_API(2, 11) Argon2_Family final void size_t const char size_t const uint8_t size_t const uint8_t key[]
Definition: argon2.h:87
Definition: alg_id.cpp:13
uint8_t out[]
Definition: pbkdf2.h:19
class BOTAN_PUBLIC_API(2, 0) AlgorithmIdentifier final bool BOTAN_PUBLIC_API(2, 0) operator
Name Constraints.
Definition: asn1_obj.h:66
size_t const uint8_t input[]
Definition: base32.h:30
void BlockCipher const uint8_t size_t uint8_t output[]
Definition: package.h:29
class BOTAN_PUBLIC_API(2, 11) Argon2 final class BOTAN_PUBLIC_API(2, 11) Argon2_Family final void size_t const char size_t const uint8_t size_t const uint8_t size_t key_len
Definition: argon2.h:87
const RSA_PrivateKey & m_key
Definition: rsa.cpp:296