blob: 3d509f02cb70658d0b132cb67862ce09fcbecb4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* CTR Mode
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_COUNTER_MODE_H__
#define BOTAN_COUNTER_MODE_H__
#include <botan/basefilt.h>
#include <botan/block_cipher.h>
namespace Botan {
/*
* CTR-BE Mode
*/
class BOTAN_DLL CTR_BE : public Keyed_Filter
{
public:
std::string name() const;
void set_iv(const InitializationVector&);
CTR_BE(BlockCipher*);
CTR_BE(BlockCipher*, const SymmetricKey&, const InitializationVector&);
~CTR_BE();
private:
static const u32bit CTR_BLOCKS_PARALLEL = 8;
void write(const byte[], u32bit);
void increment_counter();
BlockCipher* cipher;
SecureVector<byte> counter, enc_buffer;
u32bit position;
};
}
#endif
|