- let SSL_CTX_set_cipher_list and SSL_set_cipher_list return an
error if the cipher list is empty - fix last commit in ssl_create_cipher_list - clean up ssl_create_cipher_list
This commit is contained in:
@@ -1130,8 +1130,21 @@ int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str)
|
||||
|
||||
sk=ssl_create_cipher_list(ctx->method,&ctx->cipher_list,
|
||||
&ctx->cipher_list_by_id,str);
|
||||
/* XXXX */
|
||||
return((sk == NULL)?0:1);
|
||||
/* ssl_create_cipher_list may return an empty stack if it
|
||||
* was unable to find a cipher matching the given rule string
|
||||
* (for example if the rule string specifies a cipher which
|
||||
* has been disabled). This is not an error as far as
|
||||
* ssl_create_cipher_list is concerned, and hence
|
||||
* ctx->cipher_list and ctx->cipher_list_by_id has been
|
||||
* updated. */
|
||||
if (sk == NULL)
|
||||
return 0;
|
||||
else if (sk_SSL_CIPHER_num(sk) == 0)
|
||||
{
|
||||
SSLerr(SSL_F_SSL_CTX_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** specify the ciphers to be used by the SSL */
|
||||
@@ -1141,8 +1154,15 @@ int SSL_set_cipher_list(SSL *s,const char *str)
|
||||
|
||||
sk=ssl_create_cipher_list(s->ctx->method,&s->cipher_list,
|
||||
&s->cipher_list_by_id,str);
|
||||
/* XXXX */
|
||||
return((sk == NULL)?0:1);
|
||||
/* see comment in SSL_CTX_set_cipher_list */
|
||||
if (sk == NULL)
|
||||
return 0;
|
||||
else if (sk_SSL_CIPHER_num(sk) == 0)
|
||||
{
|
||||
SSLerr(SSL_F_SSL_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* works well for SSLv2, not so good for SSLv3 */
|
||||
|
Reference in New Issue
Block a user