4 * @brief Generic interface for integrity 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 diffie hellman exchange
32 typedef struct signer_s signer_t
;
36 * @brief generates pseudo random bytes and writes them
39 * @param this calling signer
40 * @param seed a chunk containing the seed for the next bytes
41 * @param [out]buffer pointer where the generated bytes will be written
43 * - SUCCESS in any case
45 status_t (*get_signature
) (signer_t
*this, chunk_t data
, u_int8_t
*buffer
);
48 * @brief generates pseudo random bytes and allocate space for them
50 * @param this calling signer
51 * @param seed a chunk containing the seed for the next bytes
52 * @param [out]chunk chunk which will hold generated bytes
54 * - SUCCESS in any case
55 * - OUT_OF_RES if space could not be allocated
57 status_t (*allocate_signature
) (signer_t
*this, chunk_t data
, chunk_t
*chunk
);
60 * @brief generates pseudo random bytes and writes them
63 * @param this calling signer
64 * @param seed a chunk containing the seed for the next bytes
65 * @param [out]buffer pointer where the generated bytes will be written
67 * - SUCCESS in any case
69 status_t (*verify_signature
) (signer_t
*this, chunk_t data
, chunk_t signature
, bool *valid
);
72 * @brief get the block size of this signer
74 * @param this calling signer
75 * @return block size in bytes
77 size_t (*get_block_size
) (signer_t
*this);
80 * @brief Set the key for this signer
82 * @param this calling signer
83 * @return block size in bytes
85 status_t (*set_key
) (signer_t
*this, chunk_t key
);
88 * @brief Destroys a signer object.
90 * @param this signer_t object to destroy
94 status_t (*destroy
) (signer_t
*this);
98 * Creates a new signer_t object
100 * @param pseudo_random_function Algorithm to use
102 * - signer_t if successfully
103 * - NULL if out of ressources or signer not supported
105 signer_t
*signer_create(integrity_algorithm_t integrity_algorithm
);