Annotation of embedaddon/strongswan/src/libimcv/pts/pts_dh_group.h, revision 1.1
1.1 ! misho 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: * @param mandatory_dh_groups if TRUE enforce mandatory PTS DH groups
! 64: * @return TRUE if mandatory DH groups are available
! 65: * or at least one optional DH group if
! 66: * mandatory_dh_groups is set to FALSE.
! 67: */
! 68: bool pts_dh_group_probe(pts_dh_group_t *dh_groups, bool mandatory_dh_groups);
! 69:
! 70: /**
! 71: * Update supported Diffie-Hellman groups according to configuration
! 72: *
! 73: * modp1024: PTS_DH_GROUP_IKE2
! 74: * modp1536: PTS_DH_GROUP_IKE2 | PTS_DH_GROUP_IKE5
! 75: * modp2048: PTS_DH_GROUP_IKE2 | PTS_DH_GROUP_IKE5 | PTS_DH_GROUP_IKE14
! 76: * ecp256: PTS_DH_GROUP_IKE2 | PTS_DH_GROUP_IKE5 | PTS_DH_GROUP_IKE14 |
! 77: * PTS_DH_GROUP_IKE19
! 78: * ecp384: PTS_DH_GROUP_IKE2 | PTS_DH_GROUP_IKE5 | PTS_DH_GROUP_IKE14 |
! 79: * PTS_DH_GROUP_IKE19 | PTS_DH_GROUP_IKE20
! 80: *
! 81: * The PTS-IMC is expected to select the strongest supported group
! 82: *
! 83: * @param dh_group configured DH group
! 84: * @param dh_groups returns set of available DH groups
! 85: */
! 86: bool pts_dh_group_update(char *dh_group, pts_dh_group_t *dh_groups);
! 87:
! 88: /**
! 89: * Select the strongest supported Diffie-Hellman group
! 90: * among a set of offered DH groups
! 91: *
! 92: * @param supported_groups set of supported DH groups
! 93: * @param offered_groups set of offered DH groups
! 94: * @return selected DH group
! 95: */
! 96: pts_dh_group_t pts_dh_group_select(pts_dh_group_t supported_groups,
! 97: pts_dh_group_t offered_groups);
! 98:
! 99: /**
! 100: * Convert pts_dh_group_t to diffie_hellman_group_t
! 101: *
! 102: * @param dh_group PTS DH group type
! 103: * @return IKE DH group type
! 104: */
! 105: diffie_hellman_group_t pts_dh_group_to_ike(pts_dh_group_t dh_group);
! 106:
! 107: #endif /** PTS_DH_GROUP_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>