SKE: support for simplified key exchange
[silc.git] / lib / silcske / silcske_groups.h
1 /*
2
3   silcske_groups.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2000 - 2005 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcske/SKE Diffie Hellman Groups
21  *
22  * DESCRIPTION
23  *
24  * This interface defines the Diffie Hellman group management and utility
25  * functions for the SKE.  They can be used find DH groups by group number,
26  * and group name.  These routines are used during the SKE session by the
27  * SKE library. However, application may use these as well if needed.
28  *
29  ***/
30
31 #ifndef SILCSKE_GROUPS_H
32 #define SILCSKE_GROUPS_H
33
34 /****s* silcske/SilcSKEGroups/SilcSKEDiffieHellmanGroup
35  *
36  * NAME
37  *
38  *    typedef struct SilcSKEDiffieHellmanGroupStruct
39  *                     *SilcSKEDiffieHellmanGroup;
40  *
41  * DESCRIPTION
42  *
43  *    This context represents one Diffie Hellman group, and is returned
44  *    by the utility functions for finding correct groups.  The context
45  *    is freed by calling the silc_ske_group_free function.
46  *
47  ***/
48 typedef struct SilcSKEDiffieHellmanGroupStruct *SilcSKEDiffieHellmanGroup;
49
50 /* Prototypes */
51
52 /****f* silcske/SilcSKEGroups/silc_ske_group_get_by_number
53  *
54  * SYNOPSIS
55  *
56  *    SilcSKEStatus
57  *    silc_ske_group_get_by_number(int number,
58  *                                 SilcSKEDiffieHellmanGroup *ret);
59  *
60  * DESCRIPTION
61  *
62  *    Returns the Diffie Hellman group into the `ret' pointer by
63  *    group number indicated by the `number'.  Returns error status
64  *    if the group was not found.
65  *
66  ***/
67 SilcSKEStatus silc_ske_group_get_by_number(int number,
68                                            SilcSKEDiffieHellmanGroup *ret);
69
70 /****f* silcske/SilcSKEGroups/silc_ske_group_get_by_name
71  *
72  * SYNOPSIS
73  *
74  *    SilcSKEStatus
75  *    silc_ske_get_group_by_name(const char *name,
76  *                               SilcSKEDiffieHellmanGroup *ret);
77  *
78  * DESCRIPTION
79  *
80  *    Returns the Diffie Hellman group into the `ret' pointer by
81  *    group name indicated by the `name'.  Returns error status
82  *    if the group was not found.
83  *
84  ***/
85 SilcSKEStatus silc_ske_group_get_by_name(const char *name,
86                                          SilcSKEDiffieHellmanGroup *ret);
87
88 /****f* silcske/SilcSKEGroups/silc_ske_group_free
89  *
90  * SYNOPSIS
91  *
92  *    void silc_ske_group_free(SilcSKEDiffieHellmanGroup group);
93  *
94  * DESCRIPTION
95  *
96  *    Free the Diffie Hellman group indicated by the `group'.
97  *
98  ***/
99 void silc_ske_group_free(SilcSKEDiffieHellmanGroup group);
100
101 /****f* silcske/SilcSKEGroups/silc_ske_get_supported_groups
102  *
103  * SYNOPSIS
104  *
105  *    char *silc_ske_get_supported_groups(SilcUInt32 limit);
106  *
107  * DESCRIPTION
108  *
109  *    Returns a comma separated list of support Diffie Hellman groups.
110  *    This can be used to get the list of supported groups for SKE
111  *    packets.  The `limit' specifies the maximum number of groups
112  *    to return.
113  *
114  ***/
115 char *silc_ske_get_supported_groups(SilcUInt32 limit);
116
117 /****f* silcske/SilcSKEGroups/silc_ske_group_get_number
118  *
119  * SYNOPSIS
120  *
121  *    int silc_ske_group_get_number(SilcSKEDiffieHellmanGroup group);
122  *
123  * DESCRIPTION
124  *
125  *    Return the group number of the group indicated by the `group'.
126  *
127  ***/
128 int silc_ske_group_get_number(SilcSKEDiffieHellmanGroup group);
129
130 /****f* silcske/SilcSKEGroups/silc_ske_group_get_name
131  *
132  * SYNOPSIS
133  *
134  *    const char *silc_ske_group_get_name(SilcSKEDiffieHellmanGroup group);
135  *
136  * DESCRIPTION
137  *
138  *    Return the group name of the group indicated by the `group'.
139  *
140  ***/
141 const char *silc_ske_group_get_name(SilcSKEDiffieHellmanGroup group);
142
143 #endif /* SILCSKE_GROUPS_H */