Botan
1.11.4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
filters
modes
xts
xts.h
Go to the documentation of this file.
1
/*
2
* XTS mode, from IEEE P1619
3
* (C) 2009 Jack Lloyd
4
*
5
* Distributed under the terms of the Botan license
6
*/
7
8
#ifndef BOTAN_XTS_H__
9
#define BOTAN_XTS_H__
10
11
#include <botan/block_cipher.h>
12
#include <botan/key_filt.h>
13
#include <botan/buf_filt.h>
14
15
namespace
Botan {
16
17
/**
18
* IEEE P1619 XTS Encryption
19
*/
20
class
BOTAN_DLL
XTS_Encryption
:
public
Keyed_Filter
,
21
private
Buffered_Filter
22
{
23
public
:
24
void
set_key(
const
SymmetricKey
& key);
25
void
set_iv(
const
InitializationVector
& iv);
26
27
Key_Length_Specification
key_spec()
const override
;
28
29
bool
valid_iv_length(
size_t
iv_len)
const
30
{
return
(iv_len == cipher->block_size()); }
31
32
std::string name()
const
;
33
34
XTS_Encryption
(
BlockCipher
* ciph);
35
36
XTS_Encryption
(
BlockCipher
* ciph,
37
const
SymmetricKey
& key,
38
const
InitializationVector
& iv);
39
40
~XTS_Encryption
() {
delete
cipher;
delete
cipher2; }
41
private
:
42
void
write(
const
byte
[],
size_t
);
43
void
end_msg();
44
45
void
buffered_block(
const
byte
input[],
size_t
input_length);
46
void
buffered_final(
const
byte
input[],
size_t
input_length);
47
48
BlockCipher
* cipher;
49
BlockCipher
* cipher2;
50
secure_vector<byte>
tweak;
51
};
52
53
/**
54
* IEEE P1619 XTS Encryption
55
*/
56
class
BOTAN_DLL
XTS_Decryption
:
public
Keyed_Filter
,
57
private
Buffered_Filter
58
{
59
public
:
60
void
set_key(
const
SymmetricKey
& key);
61
void
set_iv(
const
InitializationVector
& iv);
62
63
Key_Length_Specification
key_spec()
const override
;
64
65
bool
valid_iv_length(
size_t
iv_len)
const
66
{
return
(iv_len == cipher->block_size()); }
67
68
std::string name()
const
;
69
70
XTS_Decryption
(
BlockCipher
* ciph);
71
72
XTS_Decryption
(
BlockCipher
* ciph,
73
const
SymmetricKey
& key,
74
const
InitializationVector
& iv);
75
76
~XTS_Decryption
() {
delete
cipher;
delete
cipher2; }
77
private
:
78
void
write(
const
byte
[],
size_t
);
79
void
end_msg();
80
81
void
buffered_block(
const
byte
input[],
size_t
input_length);
82
void
buffered_final(
const
byte
input[],
size_t
input_length);
83
84
BlockCipher
* cipher;
85
BlockCipher
* cipher2;
86
secure_vector<byte>
tweak;
87
};
88
89
}
90
91
#endif
Generated on Wed May 1 2013 08:42:15 for Botan by
1.8.3.1