| Disk ARchive 2.8.5 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
crypto_module.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2026 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
27
28#ifndef CRYPTO_MODULE_HPP
29#define CRYPTO_MODULE_HPP
30
31#include "../my_config.h"
32#include <string>
33#include <memory>
34
35#include "infinint.hpp"
36#include "integers.hpp"
37
38 namespace libdar
39{
40
43
44 class crypto_module
45 {
46 public:
47 crypto_module() {};
48 crypto_module(const crypto_module & ref) = default;
49 crypto_module(crypto_module && ref) noexcept = default;
50 crypto_module & operator = (const crypto_module & ref) = default;
51 crypto_module & operator = (crypto_module && ref) noexcept = default;
52 virtual ~crypto_module() noexcept = default;
53
55
61 virtual U_32 encrypted_block_size_for(U_32 clear_block_size) = 0;
62
64
71 virtual U_32 clear_block_allocated_size_for(U_32 clear_block_size) = 0;
72
74
83 virtual U_32 encrypt_data(const infinint & block_num,
84 const char *clear_buf,
85 const U_32 clear_size,
86 const U_32 clear_allocated,
87 char *crypt_buf,
88 U_32 crypt_size) = 0;
89
91
98 virtual U_32 decrypt_data(const infinint & block_num,
99 const char *crypt_buf,
100 const U_32 crypt_size,
101 char *clear_buf,
102 U_32 clear_size) = 0;
103
104
105 virtual std::unique_ptr<crypto_module> clone() const = 0;
106 };
108
109} // end of namespace
110
111#endif
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
integers.hpp
are defined here basic integer types that tend to be portable
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47