Botan  2.11.0
Crypto and TLS for C++11
ctr.h
Go to the documentation of this file.
1 /*
2 * CTR-BE Mode
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_CTR_BE_H_
9 #define BOTAN_CTR_BE_H_
10 
11 #include <botan/block_cipher.h>
12 #include <botan/stream_cipher.h>
13 
14 namespace Botan {
15 
16 /**
17 * CTR-BE (Counter mode, big-endian)
18 */
19 class BOTAN_PUBLIC_API(2,0) CTR_BE final : public StreamCipher
20  {
21  public:
22  void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
23 
24  void set_iv(const uint8_t iv[], size_t iv_len) override;
25 
26  size_t default_iv_length() const override;
27 
28  bool valid_iv_length(size_t iv_len) const override;
29 
30  Key_Length_Specification key_spec() const override;
31 
32  std::string name() const override;
33 
34  CTR_BE* clone() const override;
35 
36  void clear() override;
37 
38  /**
39  * @param cipher the block cipher to use
40  */
41  explicit CTR_BE(BlockCipher* cipher);
42 
43  CTR_BE(BlockCipher* cipher, size_t ctr_size);
44 
45  void seek(uint64_t offset) override;
46  private:
47  void key_schedule(const uint8_t key[], size_t key_len) override;
48  void add_counter(const uint64_t counter);
49 
50  std::unique_ptr<BlockCipher> m_cipher;
51 
52  const size_t m_block_size;
53  const size_t m_ctr_size;
54  const size_t m_ctr_blocks;
55 
56  secure_vector<uint8_t> m_counter, m_pad;
57  std::vector<uint8_t> m_iv;
58  size_t m_pad_pos;
59  };
60 
61 }
62 
63 #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
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