@@ -144,6 +144,7 @@ static pthread_mutex_t cyassl_ctx_mutex = PTHREAD_MUTEX_INITIALIZER;
144
144
static CYASSL_CTX *
145
145
get_cyassl_ctx (void )
146
146
{
147
+ int err ;
147
148
CYASSL_CTX * ret ;
148
149
s_config * config = config_get_config ();
149
150
@@ -152,16 +153,26 @@ get_cyassl_ctx(void)
152
153
if (NULL == cyassl_ctx ) {
153
154
CyaSSL_Init ();
154
155
/* Create the CYASSL_CTX */
155
- /* Allow SSLv3 up to TLSv1.2 */
156
- if ( (cyassl_ctx = CyaSSL_CTX_new (CyaSSLv23_client_method ())) == NULL ){
156
+ /* Allow TLSv1.0 up to TLSv1.2 */
157
+ if ( (cyassl_ctx = CyaSSL_CTX_new (CyaTLSv1_client_method ())) == NULL ){
157
158
debug (LOG_ERR , "Could not create CYASSL context." );
158
159
return NULL ;
159
160
}
160
161
162
+ if (config -> ssl_cipher_list ) {
163
+ debug (LOG_INFO , "Setting SSL cipher list to [%s]" , config -> ssl_cipher_list );
164
+ err = CyaSSL_CTX_set_cipher_list (cyassl_ctx , config -> ssl_cipher_list );
165
+ if (SSL_SUCCESS != err ) {
166
+ debug (LOG_ERR , "Could not load SSL cipher list (error %d)" , err );
167
+ return NULL ;
168
+ }
169
+ }
170
+
161
171
if (config -> ssl_verify ) {
162
172
/* Use trusted certs */
163
173
/* Note: CyaSSL requires that the certificates are named by their hash values */
164
- int err = CyaSSL_CTX_load_verify_locations (cyassl_ctx , NULL , config -> ssl_certs );
174
+ debug (LOG_INFO , "Loading SSL certificates from %s" , config -> ssl_certs );
175
+ err = CyaSSL_CTX_load_verify_locations (cyassl_ctx , NULL , config -> ssl_certs );
165
176
if (err != SSL_SUCCESS ) {
166
177
debug (LOG_ERR , "Could not load SSL certificates (error %d)" , err );
167
178
if (err == ASN_UNKNOWN_OID_E ) {
@@ -170,9 +181,8 @@ get_cyassl_ctx(void)
170
181
debug (LOG_ERR , "Make sure that SSLCertPath points to the correct path in the config file" );
171
182
debug (LOG_ERR , "Or disable certificate loading with 'SSLPeerVerification No'." );
172
183
}
173
- return NULL ;;
184
+ return NULL ;
174
185
}
175
- debug (LOG_INFO , "Loading SSL certificates from %s" , config -> ssl_certs );
176
186
} else {
177
187
CyaSSL_CTX_set_verify (cyassl_ctx , SSL_VERIFY_NONE , 0 );
178
188
debug (LOG_INFO , "Disabling SSL certificate verification!" );
0 commit comments