created libpts
[strongswan.git] / src / libpts / pts / pts_meas_algo.h
1 /*
2 * Copyright (C) 2011 Sansar Choinyambuu
3 * HSR 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 pts_meas_algo pts_meas_algo
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_MEAS_ALGO_H_
22 #define PTS_MEAS_ALGO_H_
23
24 #include <library.h>
25 #include <crypto/hashers/hasher.h>
26
27 typedef enum pts_meas_algorithms_t pts_meas_algorithms_t;
28
29 /**
30 * PTS Measurement Algorithms
31 */
32 enum pts_meas_algorithms_t {
33 PTS_MEAS_ALGO_SHA1 = (1<<15),
34 PTS_MEAS_ALGO_SHA256 = (1<<14),
35 PTS_MEAS_ALGO_SHA384 = (1<<13),
36 };
37
38 /**
39 * Diffie-Hellman Hash Algorithm Values
40 * see section 3.8.5 of PTS Protocol: Binding to TNC IF-M Specification
41 *
42 * 1
43 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
44 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 * |1|2|3|R|R|R|R|R|R|R|R|R|R|R|R|R|
46 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 *
48 */
49
50 /**
51 * Probe available PTS measurement algorithms
52 *
53 * @param algorithms set of available algorithms
54 * @return TRUE if mandatory algorithms are available
55 */
56 bool pts_meas_probe_algorithms(pts_meas_algorithms_t *algorithms);
57
58 /**
59 * Convert pts_meas_algorithms_t to hash_algorithm_t
60 *
61 * @param algorithm PTS measurement algorithm type
62 * @return libstrongswan hash algorithm type
63 */
64 hash_algorithm_t pts_meas_to_hash_algorithm(pts_meas_algorithms_t algorithm);
65
66 #endif /** PTS_MEAS_ALGO_H_ @}*/