summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 631229558f..2bd9a5af86 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -125,7 +125,7 @@
125 125
126const char *SSL_version_str=OPENSSL_VERSION_TEXT; 126const char *SSL_version_str=OPENSSL_VERSION_TEXT;
127 127
128OPENSSL_GLOBAL SSL3_ENC_METHOD ssl3_undef_enc_method={ 128SSL3_ENC_METHOD ssl3_undef_enc_method={
129 /* evil casts, but these functions are only called if there's a library bug */ 129 /* evil casts, but these functions are only called if there's a library bug */
130 (int (*)(SSL *,int))ssl_undefined_function, 130 (int (*)(SSL *,int))ssl_undefined_function,
131 (int (*)(SSL *, unsigned char *, int))ssl_undefined_function, 131 (int (*)(SSL *, unsigned char *, int))ssl_undefined_function,
@@ -1130,8 +1130,21 @@ int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str)
1130 1130
1131 sk=ssl_create_cipher_list(ctx->method,&ctx->cipher_list, 1131 sk=ssl_create_cipher_list(ctx->method,&ctx->cipher_list,
1132 &ctx->cipher_list_by_id,str); 1132 &ctx->cipher_list_by_id,str);
1133/* XXXX */ 1133 /* ssl_create_cipher_list may return an empty stack if it
1134 return((sk == NULL)?0:1); 1134 * was unable to find a cipher matching the given rule string
1135 * (for example if the rule string specifies a cipher which
1136 * has been disabled). This is not an error as far as
1137 * ssl_create_cipher_list is concerned, and hence
1138 * ctx->cipher_list and ctx->cipher_list_by_id has been
1139 * updated. */
1140 if (sk == NULL)
1141 return 0;
1142 else if (sk_SSL_CIPHER_num(sk) == 0)
1143 {
1144 SSLerr(SSL_F_SSL_CTX_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH);
1145 return 0;
1146 }
1147 return 1;
1135 } 1148 }
1136 1149
1137/** specify the ciphers to be used by the SSL */ 1150/** specify the ciphers to be used by the SSL */
@@ -1141,8 +1154,15 @@ int SSL_set_cipher_list(SSL *s,const char *str)
1141 1154
1142 sk=ssl_create_cipher_list(s->ctx->method,&s->cipher_list, 1155 sk=ssl_create_cipher_list(s->ctx->method,&s->cipher_list,
1143 &s->cipher_list_by_id,str); 1156 &s->cipher_list_by_id,str);
1144/* XXXX */ 1157 /* see comment in SSL_CTX_set_cipher_list */
1145 return((sk == NULL)?0:1); 1158 if (sk == NULL)
1159 return 0;
1160 else if (sk_SSL_CIPHER_num(sk) == 0)
1161 {
1162 SSLerr(SSL_F_SSL_SET_CIPHER_LIST, SSL_R_NO_CIPHER_MATCH);
1163 return 0;
1164 }
1165 return 1;
1146 } 1166 }
1147 1167
1148/* works well for SSLv2, not so good for SSLv3 */ 1168/* works well for SSLv2, not so good for SSLv3 */
@@ -1181,7 +1201,8 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len)
1181 return(buf); 1201 return(buf);
1182 } 1202 }
1183 1203
1184int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p) 1204int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p,
1205 int (*put_cb)(const SSL_CIPHER *, unsigned char *))
1185 { 1206 {
1186 int i,j=0; 1207 int i,j=0;
1187 SSL_CIPHER *c; 1208 SSL_CIPHER *c;
@@ -1200,7 +1221,8 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p)
1200 if ((c->algorithms & SSL_KRB5) && nokrb5) 1221 if ((c->algorithms & SSL_KRB5) && nokrb5)
1201 continue; 1222 continue;
1202#endif /* OPENSSL_NO_KRB5 */ 1223#endif /* OPENSSL_NO_KRB5 */
1203 j=ssl_put_cipher_by_char(s,c,p); 1224
1225 j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p);
1204 p+=j; 1226 p+=j;
1205 } 1227 }
1206 return(p-q); 1228 return(p-q);
@@ -1694,7 +1716,7 @@ void ssl_update_cache(SSL *s,int mode)
1694 ?s->ctx->stats.sess_connect_good 1716 ?s->ctx->stats.sess_connect_good
1695 :s->ctx->stats.sess_accept_good) & 0xff) == 0xff) 1717 :s->ctx->stats.sess_accept_good) & 0xff) == 0xff)
1696 { 1718 {
1697 SSL_CTX_flush_sessions(s->ctx,time(NULL)); 1719 SSL_CTX_flush_sessions(s->ctx,(unsigned long)time(NULL));
1698 } 1720 }
1699 } 1721 }
1700 } 1722 }