added the IMV_ATTESTATION_STATE_NONCE_REQ state
[strongswan.git] / src / libpts / pts / pts_dh_group.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_dh_group pts_dh_group
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_DH_GROUP_H_
22 #define PTS_DH_GROUP_H_
23
24 #include <library.h>
25 #include <crypto/diffie_hellman.h>
26
27 typedef enum pts_dh_group_t pts_dh_group_t;
28
29 /**
30 * PTS Diffie Hellman Group Values
31 */
32 enum pts_dh_group_t {
33 /** No DH Group */
34 PTS_DH_GROUP_NONE = 0,
35 /** IKE Group 2 */
36 PTS_DH_GROUP_IKE2 = (1<<15),
37 /** IKE Group 5 */
38 PTS_DH_GROUP_IKE5 = (1<<14),
39 /** IKE Group 14 */
40 PTS_DH_GROUP_IKE14 = (1<<13),
41 /** IKE Group 19 */
42 PTS_DH_GROUP_IKE19 = (1<<12),
43 /** IKE Group 20 */
44 PTS_DH_GROUP_IKE20 = (1<<11),
45 };
46
47 /**
48 * Diffie-Hellman Group Values
49 * see section 3.8.6 of PTS Protocol: Binding to TNC IF-M Specification
50 *
51 * 1
52 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
54 * |1|2|3|4|5|R|R|R|R|R|R|R|R|R|R|R|
55 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 *
57 */
58
59 /**
60 * Probe available PTS Diffie-Hellman groups
61 *
62 * @param dh_groups returns set of available DH groups
63 * @return TRUE if mandatory DH groups are available
64 */
65 bool pts_dh_group_probe(pts_dh_group_t *dh_groups);
66
67 /**
68 * Update supported Diffie-Hellman groups according to configuration
69 *
70 * @param dh_group configured DH group
71 * @param dh_groups returns set of available DH groups
72 */
73 bool pts_dh_group_update(char *dh_group, pts_dh_group_t *dh_groups);
74
75 /**
76 * Select the strongest supported Diffie-Hellman group
77 * among a set of offered DH groups
78 *
79 * @param supported_groups set of supported DH groups
80 * @param offered_groups set of offered DH groups
81 * @return selected DH group
82 */
83 pts_dh_group_t pts_dh_group_select(pts_dh_group_t supported_dh_groups,
84 pts_dh_group_t offered_dh_groups);
85
86 /**
87 * Convert pts_dh_group_t to diffie_hellman_group_t
88 *
89 * @param dh_group PTS DH group type
90 * @return IKE DH group type
91 */
92 diffie_hellman_group_t pts_dh_group_to_ike(pts_dh_group_t dh_group);
93
94 #endif /** PTS_DH_GROUP_H_ @}*/