The introduced SHA1_NOFINAL hasher was not sufficient for EAP-AKA,
[strongswan.git] / src / libstrongswan / plugins / sha1 / sha1_hasher.h
1 /*
2 * Copyright (C) 2005-2008 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup sha1_hasher sha1_hasher
19 * @{ @ingroup sha1_p
20 */
21
22 #ifndef SHA1_HASHER_H_
23 #define SHA1_HASHER_H_
24
25 typedef struct sha1_hasher_t sha1_hasher_t;
26 typedef struct sha1_keyed_prf_t sha1_keyed_prf_t;
27
28 #include <crypto/hashers/hasher.h>
29 #include <crypto/prfs/prf.h>
30
31 /**
32 * Implementation of hasher_t interface using the SHA1 algorithm.
33 */
34 struct sha1_hasher_t {
35
36 /**
37 * Implements hasher_t interface.
38 */
39 hasher_t hasher_interface;
40 };
41
42 /**
43 * Implementation of prf_t interface using keyed SHA1 algorithm (used for EAP-AKA).
44 */
45 struct sha1_keyed_prf_t {
46
47 /**
48 * Implements prf_t interface.
49 */
50 prf_t prf_interface;
51 };
52
53 /**
54 * Creates a new sha1_hasher_t.
55 *
56 * @param algo algorithm, must be HASH_SHA1
57 * @return sha1_hasher_t object
58 */
59 sha1_hasher_t *sha1_hasher_create(hash_algorithm_t algo);
60
61 /**
62 * Creates a new sha1_keyed_prf_t.
63 *
64 * @param algo algorithm, must be PRF_KEYED_SHA1
65 * @return sha1_keyed_prf_tobject
66 */
67 sha1_keyed_prf_t *sha1_keyed_prf_create(pseudo_random_function_t algo);
68
69 #endif /*SHA1_HASHER_H_ @}*/