2
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
2
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4
5
* Author: Nikos Mavrogiannopoulos
39
* gnutls_cipher_set_priority - Sets the priority on the ciphers supported by gnutls.
40
* @session: is a #gnutls_session_t structure.
41
* @list: is a 0 terminated list of gnutls_cipher_algorithm_t elements.
43
* Sets the priority on the ciphers supported by gnutls.
44
* Priority is higher for elements specified before others.
45
* After specifying the ciphers you want, you must append a 0.
46
* Note that the priority is set on the client. The server does
47
* not use the algorithm's priority except for disabling
48
* algorithms that were not specified.
50
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
40
* gnutls_cipher_set_priority:
41
* @session: is a #gnutls_session_t structure.
42
* @list: is a 0 terminated list of gnutls_cipher_algorithm_t elements.
44
* Sets the priority on the ciphers supported by gnutls. Priority is
45
* higher for elements specified before others. After specifying the
46
* ciphers you want, you must append a 0. Note that the priority is
47
* set on the client. The server does not use the algorithm's
48
* priority except for disabling algorithms that were not specified.
50
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
53
53
gnutls_cipher_set_priority (gnutls_session_t session, const int *list)
92
* gnutls_kx_set_priority - Sets the priority on the key exchange algorithms supported by gnutls.
93
* @session: is a #gnutls_session_t structure.
94
* @list: is a 0 terminated list of gnutls_kx_algorithm_t elements.
96
* Sets the priority on the key exchange algorithms supported by gnutls.
97
* Priority is higher for elements specified before others.
98
* After specifying the algorithms you want, you must append a 0.
99
* Note that the priority is set on the client. The server does
100
* not use the algorithm's priority except for disabling
101
* algorithms that were not specified.
103
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
92
* gnutls_kx_set_priority:
93
* @session: is a #gnutls_session_t structure.
94
* @list: is a 0 terminated list of gnutls_kx_algorithm_t elements.
96
* Sets the priority on the key exchange algorithms supported by
97
* gnutls. Priority is higher for elements specified before others.
98
* After specifying the algorithms you want, you must append a 0.
99
* Note that the priority is set on the client. The server does not
100
* use the algorithm's priority except for disabling algorithms that
101
* were not specified.
103
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
106
106
gnutls_kx_set_priority (gnutls_session_t session, const int *list)
112
* gnutls_mac_set_priority - Sets the priority on the mac algorithms supported by gnutls.
113
* @session: is a #gnutls_session_t structure.
114
* @list: is a 0 terminated list of gnutls_mac_algorithm_t elements.
116
* Sets the priority on the mac algorithms supported by gnutls.
117
* Priority is higher for elements specified before others.
118
* After specifying the algorithms you want, you must append a 0.
119
* Note that the priority is set on the client. The server does
120
* not use the algorithm's priority except for disabling
121
* algorithms that were not specified.
123
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
112
* gnutls_mac_set_priority:
113
* @session: is a #gnutls_session_t structure.
114
* @list: is a 0 terminated list of gnutls_mac_algorithm_t elements.
116
* Sets the priority on the mac algorithms supported by gnutls.
117
* Priority is higher for elements specified before others. After
118
* specifying the algorithms you want, you must append a 0. Note
119
* that the priority is set on the client. The server does not use
120
* the algorithm's priority except for disabling algorithms that were
123
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
126
126
gnutls_mac_set_priority (gnutls_session_t session, const int *list)
132
* gnutls_compression_set_priority - Sets the priority on the compression algorithms supported by gnutls.
133
* @session: is a #gnutls_session_t structure.
134
* @list: is a 0 terminated list of gnutls_compression_method_t elements.
136
* Sets the priority on the compression algorithms supported by gnutls.
137
* Priority is higher for elements specified before others.
138
* After specifying the algorithms you want, you must append a 0.
139
* Note that the priority is set on the client. The server does
140
* not use the algorithm's priority except for disabling
141
* algorithms that were not specified.
143
* TLS 1.0 does not define any compression algorithms except
144
* NULL. Other compression algorithms are to be considered
145
* as gnutls extensions.
147
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
132
* gnutls_compression_set_priority:
133
* @session: is a #gnutls_session_t structure.
134
* @list: is a 0 terminated list of gnutls_compression_method_t elements.
136
* Sets the priority on the compression algorithms supported by
137
* gnutls. Priority is higher for elements specified before others.
138
* After specifying the algorithms you want, you must append a 0.
139
* Note that the priority is set on the client. The server does not
140
* use the algorithm's priority except for disabling algorithms that
141
* were not specified.
143
* TLS 1.0 does not define any compression algorithms except
144
* NULL. Other compression algorithms are to be considered as gnutls
147
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
150
150
gnutls_compression_set_priority (gnutls_session_t session, const int *list)
156
* gnutls_protocol_set_priority - Sets the priority on the protocol versions supported by gnutls.
157
* @session: is a #gnutls_session_t structure.
158
* @list: is a 0 terminated list of gnutls_protocol_t elements.
160
* Sets the priority on the protocol versions supported by gnutls.
161
* This function actually enables or disables protocols. Newer protocol
162
* versions always have highest priority.
164
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
156
* gnutls_protocol_set_priority:
157
* @session: is a #gnutls_session_t structure.
158
* @list: is a 0 terminated list of gnutls_protocol_t elements.
160
* Sets the priority on the protocol versions supported by gnutls.
161
* This function actually enables or disables protocols. Newer protocol
162
* versions always have highest priority.
164
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
167
167
gnutls_protocol_set_priority (gnutls_session_t session, const int *list)
183
* gnutls_certificate_type_set_priority - Sets the priority on the certificate types supported by gnutls.
184
* @session: is a #gnutls_session_t structure.
185
* @list: is a 0 terminated list of gnutls_certificate_type_t elements.
187
* Sets the priority on the certificate types supported by gnutls.
188
* Priority is higher for elements specified before others.
189
* After specifying the types you want, you must append a 0.
190
* Note that the certificate type priority is set on the client.
191
* The server does not use the cert type priority except for disabling
192
* types that were not specified.
194
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
183
* gnutls_certificate_type_set_priority:
184
* @session: is a #gnutls_session_t structure.
185
* @list: is a 0 terminated list of gnutls_certificate_type_t elements.
187
* Sets the priority on the certificate types supported by gnutls.
188
* Priority is higher for elements specified before others.
189
* After specifying the types you want, you must append a 0.
190
* Note that the certificate type priority is set on the client.
191
* The server does not use the cert type priority except for disabling
192
* types that were not specified.
194
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
197
197
gnutls_certificate_type_set_priority (gnutls_session_t session,
454
454
if (session->internals.priorities.protocol.algorithms > 0)
455
455
_gnutls_set_current_version (session,
456
session->internals.priorities.
457
protocol.priority[0]);
456
session->internals.priorities.protocol.
463
463
#define MAX_ELEMENTS 48
466
* gnutls_priority_init - Sets priorities for the cipher suites supported by gnutls.
466
* gnutls_priority_init:
467
467
* @priority_cache: is a #gnutls_prioritity_t structure.
468
468
* @priorities: is a string describing priorities
469
469
* @err_pos: In case of an error this will have the position in the string the error occured
472
472
* compression methods. This is to avoid using the
473
473
* gnutls_*_priority() functions.
475
* The #priorities option allows you to specify a semi-colon
475
* The #priorities option allows you to specify a colon
476
476
* separated list of the cipher priorities to enable.
478
478
* Unless the first keyword is "NONE" the defaults (in preference
480
480
* compression NULL; for certificate types X.509, OpenPGP.
482
482
* For key exchange algorithms when in NORMAL or SECURE levels the
483
* perfect forward secrecy algorithms take precendence of the other
483
* perfect forward secrecy algorithms take precedence of the other
484
484
* protocols. In all cases all the supported key exchange algorithms
485
485
* are enabled (except for the RSA-EXPORT which is only enabled in
523
523
* "%COMPAT" will enable compatibility features for a server.
525
* "%UNSAFE_RENEGOTIATION" will allow unsafe renegotiation (this is now
526
* the default, but will change once more servers support the safe renegotiation
529
* "%SAFE_RENEGOTIATION" will allow safe renegotiation only.
531
* "%INITIAL_SAFE_RENEGOTIATION" will force initial safe negotiation even if
532
* renegotiation wasn't requested. Only valid for server side and implies
533
* "%SAFE_RENEGOTIATION".
535
* "%DISABLE_SAFE_RENEGOTIATION" will disable safe renegotiation completely. Do not use
536
* unless you know what you are doing. Testing purposes only.
525
538
* "%SSL3_RECORD_VERSION" will use SSL3.0 record version in client hello.
527
540
* "%VERIFY_ALLOW_SIGN_RSA_MD5" will allow RSA-MD5 signatures in
552
565
const char *priorities, const char **err_pos)
554
567
char *broken_list[MAX_ELEMENTS];
555
int broken_list_size, i, j;
568
int broken_list_size = 0, i = 0, j;
711
725
"VERIFY_ALLOW_X509_V1_CA_CRT") == 0)
712
726
(*priority_cache)->additional_verify_flags |=
713
727
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT;
728
else if (strcasecmp (&broken_list[i][1],
729
"UNSAFE_RENEGOTIATION") == 0)
730
(*priority_cache)->unsafe_renegotiation = 1;
731
else if (strcasecmp (&broken_list[i][1], "SAFE_RENEGOTIATION") == 0)
732
(*priority_cache)->unsafe_renegotiation = 0;
733
else if (strcasecmp (&broken_list[i][1],
734
"INITIAL_SAFE_RENEGOTIATION") == 0)
736
(*priority_cache)->unsafe_renegotiation = 0;
737
(*priority_cache)->initial_safe_renegotiation = 1;
739
else if (strcasecmp (&broken_list[i][1],
740
"DISABLE_SAFE_RENEGOTIATION") == 0)
741
(*priority_cache)->disable_safe_renegotiation = 1;
733
761
gnutls_free (darg);
762
gnutls_free (*priority_cache);
735
764
return GNUTLS_E_INVALID_REQUEST;
740
* gnutls_priority_deinit - deinitialize the priorities cache
769
* gnutls_priority_deinit:
741
770
* @priority_cache: is a #gnutls_prioritity_t structure.
743
772
* Deinitializes the priority cache.
753
* gnutls_priority_set_direct - Sets priorities for the cipher suites supported by gnutls.
782
* gnutls_priority_set_direct:
754
783
* @session: is a #gnutls_session_t structure.
755
784
* @priorities: is a string describing priorities
756
785
* @err_pos: In case of an error this will have the position in the string the error occured
827
* gnutls_set_default_priority - Sets some default priority on the cipher suites supported by gnutls.
856
* gnutls_set_default_priority:
828
857
* @session: is a #gnutls_session_t structure.
830
859
* Sets some default priority on the ciphers, key exchange methods,
852
* gnutls_set_default_export_priority - Sets some default priority on the cipher suites supported by gnutls.
881
* gnutls_set_default_export_priority:
853
882
* @session: is a #gnutls_session_t structure.
855
884
* Sets some default priority on the ciphers, key exchange methods, macs