diff options
Diffstat (limited to 'src/daemon/https/tls/gnutls_priority.c')
-rw-r--r-- | src/daemon/https/tls/gnutls_priority.c | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/src/daemon/https/tls/gnutls_priority.c b/src/daemon/https/tls/gnutls_priority.c index 62bf3489..8d7b5269 100644 --- a/src/daemon/https/tls/gnutls_priority.c +++ b/src/daemon/https/tls/gnutls_priority.c | |||
@@ -32,40 +32,6 @@ | |||
32 | 32 | ||
33 | #define MAX_ELEMENTS 48 | 33 | #define MAX_ELEMENTS 48 |
34 | 34 | ||
35 | /** | ||
36 | * MHD__gnutls_cipher_set_priority - Sets the priority on the ciphers supported by gnutls. | ||
37 | * @session: is a #MHD_gtls_session_t structure. | ||
38 | * @list: is a 0 terminated list of enum MHD_GNUTLS_CipherAlgorithm elements. | ||
39 | * | ||
40 | * Sets the priority on the ciphers supported by gnutls. | ||
41 | * Priority is higher for elements specified before others. | ||
42 | * After specifying the ciphers you want, you must append a 0. | ||
43 | * Note that the priority is set on the client. The server does | ||
44 | * not use the algorithm's priority except for disabling | ||
45 | * algorithms that were not specified. | ||
46 | * | ||
47 | * Returns 0 on success. | ||
48 | * | ||
49 | **/ | ||
50 | int | ||
51 | MHD__gnutls_cipher_set_priority (MHD_gtls_session_t session, const int *list) | ||
52 | { | ||
53 | int num = 0, i; | ||
54 | |||
55 | while (list[num] != 0) | ||
56 | num++; | ||
57 | if (num > MAX_ALGOS) | ||
58 | num = MAX_ALGOS; | ||
59 | session->internals.priorities.cipher.num_algorithms = num; | ||
60 | |||
61 | for (i = 0; i < num; i++) | ||
62 | { | ||
63 | session->internals.priorities.cipher.priority[i] = list[i]; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static int | 35 | static int |
70 | _set_priority (MHD_gtls_priority_st * st, const int *list) | 36 | _set_priority (MHD_gtls_priority_st * st, const int *list) |
71 | { | 37 | { |
@@ -78,129 +44,6 @@ _set_priority (MHD_gtls_priority_st * st, const int *list) | |||
78 | return 0; | 44 | return 0; |
79 | } | 45 | } |
80 | 46 | ||
81 | /** | ||
82 | * MHD__gnutls_kx_set_priority - Sets the priority on the key exchange algorithms supported by gnutls. | ||
83 | * @session: is a #MHD_gtls_session_t structure. | ||
84 | * @list: is a 0 terminated list of enum MHD_GNUTLS_KeyExchangeAlgorithm elements. | ||
85 | * | ||
86 | * Sets the priority on the key exchange algorithms supported by gnutls. | ||
87 | * Priority is higher for elements specified before others. | ||
88 | * After specifying the algorithms you want, you must append a 0. | ||
89 | * Note that the priority is set on the client. The server does | ||
90 | * not use the algorithm's priority except for disabling | ||
91 | * algorithms that were not specified. | ||
92 | * | ||
93 | * Returns 0 on success. | ||
94 | * | ||
95 | **/ | ||
96 | int | ||
97 | MHD__gnutls_kx_set_priority (MHD_gtls_session_t session, const int *list) | ||
98 | { | ||
99 | return _set_priority (&session->internals.priorities.kx, list); | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * MHD__gnutls_mac_set_priority - Sets the priority on the mac algorithms supported by gnutls. | ||
104 | * @session: is a #MHD_gtls_session_t structure. | ||
105 | * @list: is a 0 terminated list of enum MHD_GNUTLS_HashAlgorithm elements. | ||
106 | * | ||
107 | * Sets the priority on the mac algorithms supported by gnutls. | ||
108 | * Priority is higher for elements specified before others. | ||
109 | * After specifying the algorithms you want, you must append a 0. | ||
110 | * Note that the priority is set on the client. The server does | ||
111 | * not use the algorithm's priority except for disabling | ||
112 | * algorithms that were not specified. | ||
113 | * | ||
114 | * Returns 0 on success. | ||
115 | * | ||
116 | **/ | ||
117 | int | ||
118 | MHD__gnutls_mac_set_priority (MHD_gtls_session_t session, const int *list) | ||
119 | { | ||
120 | return _set_priority (&session->internals.priorities.mac, list); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * MHD__gnutls_compression_set_priority - Sets the priority on the compression algorithms supported by gnutls. | ||
125 | * @session: is a #MHD_gtls_session_t structure. | ||
126 | * @list: is a 0 terminated list of enum MHD_GNUTLS_CompressionMethod elements. | ||
127 | * | ||
128 | * Sets the priority on the compression algorithms supported by gnutls. | ||
129 | * Priority is higher for elements specified before others. | ||
130 | * After specifying the algorithms you want, you must append a 0. | ||
131 | * Note that the priority is set on the client. The server does | ||
132 | * not use the algorithm's priority except for disabling | ||
133 | * algorithms that were not specified. | ||
134 | * | ||
135 | * TLS 1.0 does not define any compression algorithms except | ||
136 | * NULL. Other compression algorithms are to be considered | ||
137 | * as gnutls extensions. | ||
138 | * | ||
139 | * Returns 0 on success. | ||
140 | * | ||
141 | **/ | ||
142 | int | ||
143 | MHD__gnutls_compression_set_priority (MHD_gtls_session_t session, | ||
144 | const int *list) | ||
145 | { | ||
146 | return _set_priority (&session->internals.priorities.compression, list); | ||
147 | } | ||
148 | |||
149 | /** | ||
150 | * MHD__gnutls_protocol_set_priority - Sets the priority on the protocol versions supported by gnutls. | ||
151 | * @session: is a #MHD_gtls_session_t structure. | ||
152 | * @list: is a 0 terminated list of enum MHD_GNUTLS_Protocol elements. | ||
153 | * | ||
154 | * Sets the priority on the protocol versions supported by gnutls. | ||
155 | * This function actually enables or disables protocols. Newer protocol | ||
156 | * versions always have highest priority. | ||
157 | * | ||
158 | * Returns 0 on success. | ||
159 | * | ||
160 | **/ | ||
161 | int | ||
162 | MHD__gnutls_protocol_set_priority (MHD_gtls_session_t session, | ||
163 | const int *list) | ||
164 | { | ||
165 | int ret; | ||
166 | |||
167 | ret = _set_priority (&session->internals.priorities.protocol, list); | ||
168 | /* set the current version to the first in the chain. | ||
169 | * This will be overridden later. | ||
170 | */ | ||
171 | MHD_gtls_set_current_version (session, list[0]); | ||
172 | |||
173 | return ret; | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * MHD__gnutls_certificate_type_set_priority - Sets the priority on the certificate types supported by gnutls. | ||
178 | * @session: is a #MHD_gtls_session_t structure. | ||
179 | * @list: is a 0 terminated list of enum MHD_GNUTLS_CertificateType elements. | ||
180 | * | ||
181 | * Sets the priority on the certificate types supported by gnutls. | ||
182 | * Priority is higher for elements specified before others. | ||
183 | * After specifying the types you want, you must append a 0. | ||
184 | * Note that the certificate type priority is set on the client. | ||
185 | * The server does not use the cert type priority except for disabling | ||
186 | * types that were not specified. | ||
187 | * | ||
188 | * Returns 0 on success. | ||
189 | * | ||
190 | **/ | ||
191 | int | ||
192 | MHD__gnutls_certificate_type_set_priority (MHD_gtls_session_t session, | ||
193 | const int *list) | ||
194 | { | ||
195 | #if ENABLE_OPENPGP | ||
196 | return _set_priority (&session->internals.priorities.cert_type, list); | ||
197 | #else | ||
198 | |||
199 | return GNUTLS_E_UNIMPLEMENTED_FEATURE; | ||
200 | |||
201 | #endif | ||
202 | } | ||
203 | |||
204 | static const int MHD_gtls_protocol_priority[] = { MHD_GNUTLS_PROTOCOL_TLS1_1, | 47 | static const int MHD_gtls_protocol_priority[] = { MHD_GNUTLS_PROTOCOL_TLS1_1, |
205 | MHD_GNUTLS_PROTOCOL_TLS1_0, | 48 | MHD_GNUTLS_PROTOCOL_TLS1_0, |
206 | MHD_GNUTLS_PROTOCOL_SSL3, | 49 | MHD_GNUTLS_PROTOCOL_SSL3, |