Botan  2.8.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 */
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 
37  void seek(uint64_t offset) override;
38  private:
39  void key_schedule(const uint8_t key[], size_t key_len) override;
40 
41  void initialize_state();
42 
45  secure_vector<uint8_t> m_buffer;
46  size_t m_position = 0;
47  };
48 
49 }
50 
51 #endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
std::string name
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
const RSA_PrivateKey & m_key
Definition: rsa.cpp:277