06ba52240efb1ca2221100d6fe0fad768d15ecd4
[platform/upstream/cryptsetup.git] / lib / luks1 / af.h
1 /*
2  * AFsplitter - Anti forensic information splitter
3  *
4  * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org>
5  * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
6  *
7  * AFsplitter diffuses information over a large stripe of data,
8  * therefore supporting secure data destruction.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 #ifndef INCLUDED_CRYPTSETUP_LUKS_AF_H
25 #define INCLUDED_CRYPTSETUP_LUKS_AF_H
26
27 #include <stddef.h>
28
29 /*
30  * AF_split operates on src and produces information split data in
31  * dst. src is assumed to be of the length blocksize. The data stripe
32  * dst points to must be capable of storing blocksize*blocknumbers.
33  * blocknumbers is the data multiplication factor.
34  *
35  * AF_merge does just the opposite: reproduces the information stored in
36  * src of the length blocksize*blocknumbers into dst of the length
37  * blocksize.
38  *
39  * On error, both functions return -1, 0 otherwise.
40  */
41
42 int AF_split(struct crypt_device *ctx, const char *src, char *dst,
43              size_t blocksize, unsigned int blocknumbers, const char *hash);
44 int AF_merge(struct crypt_device *ctx, const char *src, char *dst, size_t blocksize,
45              unsigned int blocknumbers, const char *hash);
46 size_t AF_split_sectors(size_t blocksize, unsigned int blocknumbers);
47
48 int LUKS_encrypt_to_storage(
49         char *src, size_t srcLength,
50         const char *cipher,
51         const char *cipher_mode,
52         struct volume_key *vk,
53         unsigned int sector,
54         struct crypt_device *ctx);
55
56 int LUKS_decrypt_from_storage(
57         char *dst, size_t dstLength,
58         const char *cipher,
59         const char *cipher_mode,
60         struct volume_key *vk,
61         unsigned int sector,
62         struct crypt_device *ctx);
63
64 #endif