4 * @brief Generic interface for encryption algorithms
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 #include "../../payloads/transform_substructure.h"
30 * Object representing a crypter object
32 typedef struct crypter_s crypter_t
;
36 * @brief Encrypt a chunk of data and allocate space for
37 * the encrypted value.
39 * @param this calling crypter
40 * @param data data to encrypt
41 * @param [out]encrypted pointer where the encrypted bytes will be written
43 * - SUCCESS in any case
45 status_t (*encrypt
) (crypter_t
*this, chunk_t data
, chunk_t
*encrypted
);
48 * @brief Decrypt a chunk of data and allocate space for
49 * the decrypted value.
51 * @param this calling crypter
52 * @param data data to decrypt
53 * @param [out]encrypted pointer where the decrypted bytes will be written
55 * - SUCCESS in any case
57 status_t (*decrypt
) (crypter_t
*this, chunk_t data
, chunk_t
*decrypted
);
60 * @brief get the block size of this crypter
62 * @param this calling crypter
63 * @return block size in bytes
65 size_t (*get_block_size
) (crypter_t
*this);
68 * @brief Set the key for this crypter
70 * @param this calling crypter
71 * @return block size in bytes
73 status_t (*set_key
) (crypter_t
*this, chunk_t key
);
76 * @brief Destroys a crypter object.
78 * @param this crypter_t object to destroy
82 status_t (*destroy
) (crypter_t
*this);
86 * Creates a new crypter_t object
88 * @param pseudo_random_function Algorithm to use
90 * - crypter_t if successfully
91 * - NULL if out of ressources or crypter not supported
93 crypter_t
*crypter_create(encryption_algorithm_t encryption_algorithm
);