updated Doxyfile
[strongswan.git] / src / libstrongswan / plugins / xcbc / xcbc.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup xcbc xcbc
18 * @{ @ingroup xcbc_p
19 */
20
21 #ifndef XCBC_H_
22 #define XCBC_H_
23
24 typedef struct xcbc_t xcbc_t;
25
26 #include <crypto/hashers/hasher.h>
27
28 /**
29 * Message authentication using CBC crypter.
30 *
31 * This class implements the message authenticaion algorithm
32 * described in RFC3566.
33 */
34 struct xcbc_t {
35
36 /**
37 * Generate message authentication code.
38 *
39 * If buffer is NULL, no result is given back. A next call will
40 * append the data to already supplied data. If buffer is not NULL,
41 * the mac of all apended data is calculated, returned and the
42 * state of the xcbc_t is reseted.
43 *
44 * @param data chunk of data to authenticate
45 * @param buffer pointer where the generated bytes will be written
46 */
47 void (*get_mac) (xcbc_t *this, chunk_t data, u_int8_t *buffer);
48
49 /**
50 * Get the block size of this xcbc_t object.
51 *
52 * @return block size in bytes
53 */
54 size_t (*get_block_size) (xcbc_t *this);
55
56 /**
57 * Set the key for this xcbc_t object.
58 *
59 * @param key key to set
60 */
61 void (*set_key) (xcbc_t *this, chunk_t key);
62
63 /**
64 * Destroys a xcbc_t object.
65 */
66 void (*destroy) (xcbc_t *this);
67 };
68
69 /**
70 * Creates a new xcbc_t object.
71 *
72 * @param algo underlying crypto algorithm
73 * @param key_size key size to use, if required for algorithm
74 * @return xcbc_t object, NULL if not supported
75 */
76 xcbc_t *xcbc_create(encryption_algorithm_t algo, size_t key_size);
77
78 #endif /** XCBC_H_ @}*/