Implemented Diffie Hellman Nonce attributes
[strongswan.git] / src / libpts / tcg / tcg_pts_attr_dh_nonce_params_req.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 tcg_pts_attr_dh_nonce_params_req tcg_pts_attr_dh_nonce_params_req
18 * @{ @ingroup tcg_pts_attr_dh_nonce_params_req
19 */
20
21 #ifndef TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_
22 #define TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_
23
24 typedef struct tcg_pts_attr_dh_nonce_params_req_t tcg_pts_attr_dh_nonce_params_req_t;
25 typedef enum pts_dh_group_t pts_dh_group_t;
26
27 #include "tcg_attr.h"
28 #include "pa_tnc/pa_tnc_attr.h"
29
30 /**
31 * PTS Diffie Hellman Group Values
32 */
33 enum pts_dh_group_t {
34 /** IKE Group 2 */
35 PTS_DH_GROUP_IKE2 = (1<<15),
36 /** IKE Group 5 */
37 PTS_DH_GROUP_IKE5 = (1<<14),
38 /** IKE Group 14 */
39 PTS_DH_GROUP_IKE14 = (1<<13),
40 /** IKE Group 19, Elliptic curves using NIST 256 bit prime modules */
41 PTS_DH_GROUP_IKE19 = (1<<12),
42 /** IKE Group 20, Elliptic curves using NIST 384 bit prime modules */
43 PTS_DH_GROUP_IKE20 = (1<<11),
44 };
45
46 /**
47 * Class implementing the TCG PTS DH Nonce Parameters Request Attribute
48 */
49 struct tcg_pts_attr_dh_nonce_params_req_t {
50
51 /**
52 * Public PA-TNC attribute interface
53 */
54 pa_tnc_attr_t pa_tnc_attribute;
55
56 /**
57 * Get Minimum nonce length
58 *
59 * @return Minimum acceptable length of nonce
60 */
61 u_int8_t (*get_min_nonce_len)(tcg_pts_attr_dh_nonce_params_req_t *this);
62
63 /**
64 * Get supported Diffie Hellman Groups
65 *
66 * @return Supported Diffie Hellman Groups
67 */
68 pts_dh_group_t (*get_dh_groups)(tcg_pts_attr_dh_nonce_params_req_t *this);
69 };
70
71 /**
72 * Creates an tcg_pts_attr_dh_nonce_params_req_t object
73 *
74 * @param min_nonce_len Minimum acceptable length of nonce
75 * @param dh_groups Initiator's supported DH groups
76 */
77 pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_req_create(u_int8_t min_nonce_len,
78 pts_dh_group_t dh_groups);
79
80 /**
81 * Creates an tcg_pts_attr_dh_nonce_params_req_t object from received data
82 *
83 * @param value unparsed attribute value
84 */
85 pa_tnc_attr_t* tcg_pts_attr_dh_nonce_params_req_create_from_data(chunk_t value);
86
87 #endif /** TCG_PTS_ATTR_DH_NONCE_PARAMS_REQ_H_ @}*/