summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2014-08-10 14:42:56 +0000
committerjsing <>2014-08-10 14:42:56 +0000
commitcdc0e904c0db18d8a94dbc75555c41585f6a7867 (patch)
tree2aa183c3a15875e9ec36793e3cb35c3a765c0fcc
parentf26635d06fdd0bb26d5ee990a796492daaa92b29 (diff)
downloadopenbsd-cdc0e904c0db18d8a94dbc75555c41585f6a7867.tar.gz
openbsd-cdc0e904c0db18d8a94dbc75555c41585f6a7867.tar.bz2
openbsd-cdc0e904c0db18d8a94dbc75555c41585f6a7867.zip
Since we no longer need to support SSLv2-style cipher lists, start
unravelling the maze of function pointers and callbacks by directly calling ssl3_{get,put}_cipher_by_char() and removing the ssl_{get,put}_cipher_by_char macros. Prompted by similar changes in boringssl. ok guenther.
-rw-r--r--src/lib/libssl/d1_clnt.c6
-rw-r--r--src/lib/libssl/d1_meth.c4
-rw-r--r--src/lib/libssl/d1_srvr.c4
-rw-r--r--src/lib/libssl/s23_clnt.c7
-rw-r--r--src/lib/libssl/s23_lib.c17
-rw-r--r--src/lib/libssl/s23_srvr.c4
-rw-r--r--src/lib/libssl/s3_clnt.c12
-rw-r--r--src/lib/libssl/s3_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/d1_clnt.c6
-rw-r--r--src/lib/libssl/src/ssl/d1_meth.c4
-rw-r--r--src/lib/libssl/src/ssl/d1_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/s23_clnt.c7
-rw-r--r--src/lib/libssl/src/ssl/s23_lib.c17
-rw-r--r--src/lib/libssl/src/ssl/s23_meth.c4
-rw-r--r--src/lib/libssl/src/ssl/s23_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_clnt.c12
-rw-r--r--src/lib/libssl/src/ssl/s3_meth.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/ssl.h3
-rw-r--r--src/lib/libssl/src/ssl/ssl_lib.c20
-rw-r--r--src/lib/libssl/src/ssl/ssl_locl.h10
-rw-r--r--src/lib/libssl/src/ssl/ssl_sess.c6
-rw-r--r--src/lib/libssl/src/ssl/t1_clnt.c8
-rw-r--r--src/lib/libssl/src/ssl/t1_meth.c8
-rw-r--r--src/lib/libssl/src/ssl/t1_srvr.c8
-rw-r--r--src/lib/libssl/ssl.h3
-rw-r--r--src/lib/libssl/ssl_lib.c20
-rw-r--r--src/lib/libssl/ssl_locl.h10
-rw-r--r--src/lib/libssl/ssl_sess.c6
-rw-r--r--src/lib/libssl/t1_clnt.c8
-rw-r--r--src/lib/libssl/t1_meth.c8
-rw-r--r--src/lib/libssl/t1_srvr.c8
32 files changed, 68 insertions, 182 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index c9ec32173b..471871ff46 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_clnt.c,v 1.33 2014/08/07 20:02:23 miod Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.34 2014/08/10 14:42:55 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -145,8 +145,6 @@ const SSL_METHOD DTLSv1_client_method_data = {
145 .ssl_dispatch_alert = dtls1_dispatch_alert, 145 .ssl_dispatch_alert = dtls1_dispatch_alert,
146 .ssl_ctrl = dtls1_ctrl, 146 .ssl_ctrl = dtls1_ctrl,
147 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 147 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
148 .get_cipher_by_char = ssl3_get_cipher_by_char,
149 .put_cipher_by_char = ssl3_put_cipher_by_char,
150 .ssl_pending = ssl3_pending, 148 .ssl_pending = ssl3_pending,
151 .num_ciphers = ssl3_num_ciphers, 149 .num_ciphers = ssl3_num_ciphers,
152 .get_cipher = dtls1_get_cipher, 150 .get_cipher = dtls1_get_cipher,
@@ -820,7 +818,7 @@ dtls1_client_hello(SSL *s)
820 p += s->d1->cookie_len; 818 p += s->d1->cookie_len;
821 819
822 /* Ciphers supported */ 820 /* Ciphers supported */
823 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); 821 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
824 if (i == 0) { 822 if (i == 0) {
825 SSLerr(SSL_F_DTLS1_CLIENT_HELLO, 823 SSLerr(SSL_F_DTLS1_CLIENT_HELLO,
826 SSL_R_NO_CIPHERS_AVAILABLE); 824 SSL_R_NO_CIPHERS_AVAILABLE);
diff --git a/src/lib/libssl/d1_meth.c b/src/lib/libssl/d1_meth.c
index 1afd3ef1b2..df4ec9fdf2 100644
--- a/src/lib/libssl/d1_meth.c
+++ b/src/lib/libssl/d1_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_meth.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: d1_meth.c,v 1.6 2014/08/10 14:42:56 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -82,8 +82,6 @@ const SSL_METHOD DTLSv1_method_data = {
82 .ssl_dispatch_alert = dtls1_dispatch_alert, 82 .ssl_dispatch_alert = dtls1_dispatch_alert,
83 .ssl_ctrl = dtls1_ctrl, 83 .ssl_ctrl = dtls1_ctrl,
84 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 84 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
85 .get_cipher_by_char = ssl3_get_cipher_by_char,
86 .put_cipher_by_char = ssl3_put_cipher_by_char,
87 .ssl_pending = ssl3_pending, 85 .ssl_pending = ssl3_pending,
88 .num_ciphers = ssl3_num_ciphers, 86 .num_ciphers = ssl3_num_ciphers,
89 .get_cipher = dtls1_get_cipher, 87 .get_cipher = dtls1_get_cipher,
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index 848bc0f0be..9fdd025e2d 100644
--- a/src/lib/libssl/d1_srvr.c
+++ b/src/lib/libssl/d1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srvr.c,v 1.35 2014/08/06 20:11:09 miod Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.36 2014/08/10 14:42:56 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -146,8 +146,6 @@ const SSL_METHOD DTLSv1_server_method_data = {
146 .ssl_dispatch_alert = dtls1_dispatch_alert, 146 .ssl_dispatch_alert = dtls1_dispatch_alert,
147 .ssl_ctrl = dtls1_ctrl, 147 .ssl_ctrl = dtls1_ctrl,
148 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 148 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
149 .get_cipher_by_char = ssl3_get_cipher_by_char,
150 .put_cipher_by_char = ssl3_put_cipher_by_char,
151 .ssl_pending = ssl3_pending, 149 .ssl_pending = ssl3_pending,
152 .num_ciphers = ssl3_num_ciphers, 150 .num_ciphers = ssl3_num_ciphers,
153 .get_cipher = dtls1_get_cipher, 151 .get_cipher = dtls1_get_cipher,
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c
index 3a72dd3316..81683e5949 100644
--- a/src/lib/libssl/s23_clnt.c
+++ b/src/lib/libssl/s23_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_clnt.c,v 1.31 2014/07/11 08:17:36 miod Exp $ */ 1/* $OpenBSD: s23_clnt.c,v 1.32 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -139,8 +139,6 @@ const SSL_METHOD SSLv23_client_method_data = {
139 .ssl_dispatch_alert = ssl3_dispatch_alert, 139 .ssl_dispatch_alert = ssl3_dispatch_alert,
140 .ssl_ctrl = ssl3_ctrl, 140 .ssl_ctrl = ssl3_ctrl,
141 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 141 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
142 .get_cipher_by_char = ssl3_get_cipher_by_char,
143 .put_cipher_by_char = ssl23_put_cipher_by_char,
144 .ssl_pending = ssl_undefined_const_function, 142 .ssl_pending = ssl_undefined_const_function,
145 .num_ciphers = ssl3_num_ciphers, 143 .num_ciphers = ssl3_num_ciphers,
146 .get_cipher = ssl3_get_cipher, 144 .get_cipher = ssl3_get_cipher,
@@ -360,8 +358,7 @@ ssl23_client_hello(SSL *s)
360 *(p++) = 0; 358 *(p++) = 0;
361 359
362 /* Ciphers supported (using SSL 3.0/TLS 1.0 format) */ 360 /* Ciphers supported (using SSL 3.0/TLS 1.0 format) */
363 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 361 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
364 ssl3_put_cipher_by_char);
365 if (i == 0) { 362 if (i == 0) {
366 SSLerr(SSL_F_SSL23_CLIENT_HELLO, 363 SSLerr(SSL_F_SSL23_CLIENT_HELLO,
367 SSL_R_NO_CIPHERS_AVAILABLE); 364 SSL_R_NO_CIPHERS_AVAILABLE);
diff --git a/src/lib/libssl/s23_lib.c b/src/lib/libssl/s23_lib.c
index 643910be69..3a6d1d598b 100644
--- a/src/lib/libssl/s23_lib.c
+++ b/src/lib/libssl/s23_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_lib.c,v 1.16 2014/07/11 08:17:36 miod Exp $ */ 1/* $OpenBSD: s23_lib.c,v 1.17 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -67,21 +67,6 @@ ssl23_default_timeout(void)
67} 67}
68 68
69int 69int
70ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
71{
72 long l;
73
74 /* We can write SSLv2 and SSLv3 ciphers */
75 if (p != NULL) {
76 l = c->id;
77 p[0] = ((unsigned char)(l >> 16L))&0xFF;
78 p[1] = ((unsigned char)(l >> 8L))&0xFF;
79 p[2] = ((unsigned char)(l ))&0xFF;
80 }
81 return (3);
82}
83
84int
85ssl23_read(SSL *s, void *buf, int len) 70ssl23_read(SSL *s, void *buf, int len)
86{ 71{
87 int n; 72 int n;
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c
index 5f8ffa8eaf..4733fc40a5 100644
--- a/src/lib/libssl/s23_srvr.c
+++ b/src/lib/libssl/s23_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */ 1/* $OpenBSD: s23_srvr.c,v 1.34 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -138,8 +138,6 @@ const SSL_METHOD SSLv23_server_method_data = {
138 .ssl_dispatch_alert = ssl3_dispatch_alert, 138 .ssl_dispatch_alert = ssl3_dispatch_alert,
139 .ssl_ctrl = ssl3_ctrl, 139 .ssl_ctrl = ssl3_ctrl,
140 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 140 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
141 .get_cipher_by_char = ssl3_get_cipher_by_char,
142 .put_cipher_by_char = ssl23_put_cipher_by_char,
143 .ssl_pending = ssl_undefined_const_function, 141 .ssl_pending = ssl_undefined_const_function,
144 .num_ciphers = ssl3_num_ciphers, 142 .num_ciphers = ssl3_num_ciphers,
145 .get_cipher = ssl3_get_cipher, 143 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c
index af6c81dae5..63e8135185 100644
--- a/src/lib/libssl/s3_clnt.c
+++ b/src/lib/libssl/s3_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_clnt.c,v 1.85 2014/08/07 01:24:10 deraadt Exp $ */ 1/* $OpenBSD: s3_clnt.c,v 1.86 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -183,8 +183,6 @@ const SSL_METHOD SSLv3_client_method_data = {
183 .ssl_dispatch_alert = ssl3_dispatch_alert, 183 .ssl_dispatch_alert = ssl3_dispatch_alert,
184 .ssl_ctrl = ssl3_ctrl, 184 .ssl_ctrl = ssl3_ctrl,
185 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 185 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
186 .get_cipher_by_char = ssl3_get_cipher_by_char,
187 .put_cipher_by_char = ssl3_put_cipher_by_char,
188 .ssl_pending = ssl3_pending, 186 .ssl_pending = ssl3_pending,
189 .num_ciphers = ssl3_num_ciphers, 187 .num_ciphers = ssl3_num_ciphers,
190 .get_cipher = ssl3_get_cipher, 188 .get_cipher = ssl3_get_cipher,
@@ -719,7 +717,7 @@ ssl3_client_hello(SSL *s)
719 } 717 }
720 718
721 /* Ciphers supported */ 719 /* Ciphers supported */
722 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); 720 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
723 if (i == 0) { 721 if (i == 0) {
724 SSLerr(SSL_F_SSL3_CLIENT_HELLO, 722 SSLerr(SSL_F_SSL3_CLIENT_HELLO,
725 SSL_R_NO_CIPHERS_AVAILABLE); 723 SSL_R_NO_CIPHERS_AVAILABLE);
@@ -856,7 +854,7 @@ ssl3_get_server_hello(SSL *s)
856 &s->session->master_key_length, NULL, &pref_cipher, 854 &s->session->master_key_length, NULL, &pref_cipher,
857 s->tls_session_secret_cb_arg)) { 855 s->tls_session_secret_cb_arg)) {
858 s->session->cipher = pref_cipher ? 856 s->session->cipher = pref_cipher ?
859 pref_cipher : ssl_get_cipher_by_char(s, p + j); 857 pref_cipher : ssl3_get_cipher_by_char(p + j);
860 s->s3->flags |= SSL3_FLAGS_CCS_OK; 858 s->s3->flags |= SSL3_FLAGS_CCS_OK;
861 } 859 }
862 } 860 }
@@ -890,7 +888,7 @@ ssl3_get_server_hello(SSL *s)
890 memcpy(s->session->session_id,p,j); /* j could be 0 */ 888 memcpy(s->session->session_id,p,j); /* j could be 0 */
891 } 889 }
892 p += j; 890 p += j;
893 c = ssl_get_cipher_by_char(s, p); 891 c = ssl3_get_cipher_by_char(p);
894 if (c == NULL) { 892 if (c == NULL) {
895 /* unknown cipher */ 893 /* unknown cipher */
896 al = SSL_AD_ILLEGAL_PARAMETER; 894 al = SSL_AD_ILLEGAL_PARAMETER;
@@ -906,7 +904,7 @@ ssl3_get_server_hello(SSL *s)
906 SSL_R_WRONG_CIPHER_RETURNED); 904 SSL_R_WRONG_CIPHER_RETURNED);
907 goto f_err; 905 goto f_err;
908 } 906 }
909 p += ssl_put_cipher_by_char(s, NULL, NULL); 907 p += ssl3_put_cipher_by_char(NULL, NULL);
910 908
911 sk = ssl_get_ciphers_by_id(s); 909 sk = ssl_get_ciphers_by_id(s);
912 i = sk_SSL_CIPHER_find(sk, c); 910 i = sk_SSL_CIPHER_find(sk, c);
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index ed2aaf19b5..7b29ec41c8 100644
--- a/src/lib/libssl/s3_srvr.c
+++ b/src/lib/libssl/s3_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_srvr.c,v 1.79 2014/07/28 04:23:12 guenther Exp $ */ 1/* $OpenBSD: s3_srvr.c,v 1.80 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -184,8 +184,6 @@ const SSL_METHOD SSLv3_server_method_data = {
184 .ssl_dispatch_alert = ssl3_dispatch_alert, 184 .ssl_dispatch_alert = ssl3_dispatch_alert,
185 .ssl_ctrl = ssl3_ctrl, 185 .ssl_ctrl = ssl3_ctrl,
186 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 186 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
187 .get_cipher_by_char = ssl3_get_cipher_by_char,
188 .put_cipher_by_char = ssl3_put_cipher_by_char,
189 .ssl_pending = ssl3_pending, 187 .ssl_pending = ssl3_pending,
190 .num_ciphers = ssl3_num_ciphers, 188 .num_ciphers = ssl3_num_ciphers,
191 .get_cipher = ssl3_get_cipher, 189 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c
index c9ec32173b..471871ff46 100644
--- a/src/lib/libssl/src/ssl/d1_clnt.c
+++ b/src/lib/libssl/src/ssl/d1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_clnt.c,v 1.33 2014/08/07 20:02:23 miod Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.34 2014/08/10 14:42:55 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -145,8 +145,6 @@ const SSL_METHOD DTLSv1_client_method_data = {
145 .ssl_dispatch_alert = dtls1_dispatch_alert, 145 .ssl_dispatch_alert = dtls1_dispatch_alert,
146 .ssl_ctrl = dtls1_ctrl, 146 .ssl_ctrl = dtls1_ctrl,
147 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 147 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
148 .get_cipher_by_char = ssl3_get_cipher_by_char,
149 .put_cipher_by_char = ssl3_put_cipher_by_char,
150 .ssl_pending = ssl3_pending, 148 .ssl_pending = ssl3_pending,
151 .num_ciphers = ssl3_num_ciphers, 149 .num_ciphers = ssl3_num_ciphers,
152 .get_cipher = dtls1_get_cipher, 150 .get_cipher = dtls1_get_cipher,
@@ -820,7 +818,7 @@ dtls1_client_hello(SSL *s)
820 p += s->d1->cookie_len; 818 p += s->d1->cookie_len;
821 819
822 /* Ciphers supported */ 820 /* Ciphers supported */
823 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); 821 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
824 if (i == 0) { 822 if (i == 0) {
825 SSLerr(SSL_F_DTLS1_CLIENT_HELLO, 823 SSLerr(SSL_F_DTLS1_CLIENT_HELLO,
826 SSL_R_NO_CIPHERS_AVAILABLE); 824 SSL_R_NO_CIPHERS_AVAILABLE);
diff --git a/src/lib/libssl/src/ssl/d1_meth.c b/src/lib/libssl/src/ssl/d1_meth.c
index 1afd3ef1b2..df4ec9fdf2 100644
--- a/src/lib/libssl/src/ssl/d1_meth.c
+++ b/src/lib/libssl/src/ssl/d1_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_meth.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: d1_meth.c,v 1.6 2014/08/10 14:42:56 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -82,8 +82,6 @@ const SSL_METHOD DTLSv1_method_data = {
82 .ssl_dispatch_alert = dtls1_dispatch_alert, 82 .ssl_dispatch_alert = dtls1_dispatch_alert,
83 .ssl_ctrl = dtls1_ctrl, 83 .ssl_ctrl = dtls1_ctrl,
84 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 84 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
85 .get_cipher_by_char = ssl3_get_cipher_by_char,
86 .put_cipher_by_char = ssl3_put_cipher_by_char,
87 .ssl_pending = ssl3_pending, 85 .ssl_pending = ssl3_pending,
88 .num_ciphers = ssl3_num_ciphers, 86 .num_ciphers = ssl3_num_ciphers,
89 .get_cipher = dtls1_get_cipher, 87 .get_cipher = dtls1_get_cipher,
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c
index 848bc0f0be..9fdd025e2d 100644
--- a/src/lib/libssl/src/ssl/d1_srvr.c
+++ b/src/lib/libssl/src/ssl/d1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srvr.c,v 1.35 2014/08/06 20:11:09 miod Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.36 2014/08/10 14:42:56 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -146,8 +146,6 @@ const SSL_METHOD DTLSv1_server_method_data = {
146 .ssl_dispatch_alert = dtls1_dispatch_alert, 146 .ssl_dispatch_alert = dtls1_dispatch_alert,
147 .ssl_ctrl = dtls1_ctrl, 147 .ssl_ctrl = dtls1_ctrl,
148 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 148 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
149 .get_cipher_by_char = ssl3_get_cipher_by_char,
150 .put_cipher_by_char = ssl3_put_cipher_by_char,
151 .ssl_pending = ssl3_pending, 149 .ssl_pending = ssl3_pending,
152 .num_ciphers = ssl3_num_ciphers, 150 .num_ciphers = ssl3_num_ciphers,
153 .get_cipher = dtls1_get_cipher, 151 .get_cipher = dtls1_get_cipher,
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c
index 3a72dd3316..81683e5949 100644
--- a/src/lib/libssl/src/ssl/s23_clnt.c
+++ b/src/lib/libssl/src/ssl/s23_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_clnt.c,v 1.31 2014/07/11 08:17:36 miod Exp $ */ 1/* $OpenBSD: s23_clnt.c,v 1.32 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -139,8 +139,6 @@ const SSL_METHOD SSLv23_client_method_data = {
139 .ssl_dispatch_alert = ssl3_dispatch_alert, 139 .ssl_dispatch_alert = ssl3_dispatch_alert,
140 .ssl_ctrl = ssl3_ctrl, 140 .ssl_ctrl = ssl3_ctrl,
141 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 141 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
142 .get_cipher_by_char = ssl3_get_cipher_by_char,
143 .put_cipher_by_char = ssl23_put_cipher_by_char,
144 .ssl_pending = ssl_undefined_const_function, 142 .ssl_pending = ssl_undefined_const_function,
145 .num_ciphers = ssl3_num_ciphers, 143 .num_ciphers = ssl3_num_ciphers,
146 .get_cipher = ssl3_get_cipher, 144 .get_cipher = ssl3_get_cipher,
@@ -360,8 +358,7 @@ ssl23_client_hello(SSL *s)
360 *(p++) = 0; 358 *(p++) = 0;
361 359
362 /* Ciphers supported (using SSL 3.0/TLS 1.0 format) */ 360 /* Ciphers supported (using SSL 3.0/TLS 1.0 format) */
363 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 361 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
364 ssl3_put_cipher_by_char);
365 if (i == 0) { 362 if (i == 0) {
366 SSLerr(SSL_F_SSL23_CLIENT_HELLO, 363 SSLerr(SSL_F_SSL23_CLIENT_HELLO,
367 SSL_R_NO_CIPHERS_AVAILABLE); 364 SSL_R_NO_CIPHERS_AVAILABLE);
diff --git a/src/lib/libssl/src/ssl/s23_lib.c b/src/lib/libssl/src/ssl/s23_lib.c
index 643910be69..3a6d1d598b 100644
--- a/src/lib/libssl/src/ssl/s23_lib.c
+++ b/src/lib/libssl/src/ssl/s23_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_lib.c,v 1.16 2014/07/11 08:17:36 miod Exp $ */ 1/* $OpenBSD: s23_lib.c,v 1.17 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -67,21 +67,6 @@ ssl23_default_timeout(void)
67} 67}
68 68
69int 69int
70ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
71{
72 long l;
73
74 /* We can write SSLv2 and SSLv3 ciphers */
75 if (p != NULL) {
76 l = c->id;
77 p[0] = ((unsigned char)(l >> 16L))&0xFF;
78 p[1] = ((unsigned char)(l >> 8L))&0xFF;
79 p[2] = ((unsigned char)(l ))&0xFF;
80 }
81 return (3);
82}
83
84int
85ssl23_read(SSL *s, void *buf, int len) 70ssl23_read(SSL *s, void *buf, int len)
86{ 71{
87 int n; 72 int n;
diff --git a/src/lib/libssl/src/ssl/s23_meth.c b/src/lib/libssl/src/ssl/s23_meth.c
index b7f6551f64..768c526802 100644
--- a/src/lib/libssl/src/ssl/s23_meth.c
+++ b/src/lib/libssl/src/ssl/s23_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_meth.c,v 1.14 2014/07/11 08:17:36 miod Exp $ */ 1/* $OpenBSD: s23_meth.c,v 1.15 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -81,8 +81,6 @@ const SSL_METHOD SSLv23_method_data = {
81 .ssl_dispatch_alert = ssl3_dispatch_alert, 81 .ssl_dispatch_alert = ssl3_dispatch_alert,
82 .ssl_ctrl = ssl3_ctrl, 82 .ssl_ctrl = ssl3_ctrl,
83 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 83 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
84 .get_cipher_by_char = ssl3_get_cipher_by_char,
85 .put_cipher_by_char = ssl23_put_cipher_by_char,
86 .ssl_pending = ssl_undefined_const_function, 84 .ssl_pending = ssl_undefined_const_function,
87 .num_ciphers = ssl3_num_ciphers, 85 .num_ciphers = ssl3_num_ciphers,
88 .get_cipher = ssl3_get_cipher, 86 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c
index 5f8ffa8eaf..4733fc40a5 100644
--- a/src/lib/libssl/src/ssl/s23_srvr.c
+++ b/src/lib/libssl/src/ssl/s23_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */ 1/* $OpenBSD: s23_srvr.c,v 1.34 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -138,8 +138,6 @@ const SSL_METHOD SSLv23_server_method_data = {
138 .ssl_dispatch_alert = ssl3_dispatch_alert, 138 .ssl_dispatch_alert = ssl3_dispatch_alert,
139 .ssl_ctrl = ssl3_ctrl, 139 .ssl_ctrl = ssl3_ctrl,
140 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 140 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
141 .get_cipher_by_char = ssl3_get_cipher_by_char,
142 .put_cipher_by_char = ssl23_put_cipher_by_char,
143 .ssl_pending = ssl_undefined_const_function, 141 .ssl_pending = ssl_undefined_const_function,
144 .num_ciphers = ssl3_num_ciphers, 142 .num_ciphers = ssl3_num_ciphers,
145 .get_cipher = ssl3_get_cipher, 143 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c
index af6c81dae5..63e8135185 100644
--- a/src/lib/libssl/src/ssl/s3_clnt.c
+++ b/src/lib/libssl/src/ssl/s3_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_clnt.c,v 1.85 2014/08/07 01:24:10 deraadt Exp $ */ 1/* $OpenBSD: s3_clnt.c,v 1.86 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -183,8 +183,6 @@ const SSL_METHOD SSLv3_client_method_data = {
183 .ssl_dispatch_alert = ssl3_dispatch_alert, 183 .ssl_dispatch_alert = ssl3_dispatch_alert,
184 .ssl_ctrl = ssl3_ctrl, 184 .ssl_ctrl = ssl3_ctrl,
185 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 185 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
186 .get_cipher_by_char = ssl3_get_cipher_by_char,
187 .put_cipher_by_char = ssl3_put_cipher_by_char,
188 .ssl_pending = ssl3_pending, 186 .ssl_pending = ssl3_pending,
189 .num_ciphers = ssl3_num_ciphers, 187 .num_ciphers = ssl3_num_ciphers,
190 .get_cipher = ssl3_get_cipher, 188 .get_cipher = ssl3_get_cipher,
@@ -719,7 +717,7 @@ ssl3_client_hello(SSL *s)
719 } 717 }
720 718
721 /* Ciphers supported */ 719 /* Ciphers supported */
722 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); 720 i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
723 if (i == 0) { 721 if (i == 0) {
724 SSLerr(SSL_F_SSL3_CLIENT_HELLO, 722 SSLerr(SSL_F_SSL3_CLIENT_HELLO,
725 SSL_R_NO_CIPHERS_AVAILABLE); 723 SSL_R_NO_CIPHERS_AVAILABLE);
@@ -856,7 +854,7 @@ ssl3_get_server_hello(SSL *s)
856 &s->session->master_key_length, NULL, &pref_cipher, 854 &s->session->master_key_length, NULL, &pref_cipher,
857 s->tls_session_secret_cb_arg)) { 855 s->tls_session_secret_cb_arg)) {
858 s->session->cipher = pref_cipher ? 856 s->session->cipher = pref_cipher ?
859 pref_cipher : ssl_get_cipher_by_char(s, p + j); 857 pref_cipher : ssl3_get_cipher_by_char(p + j);
860 s->s3->flags |= SSL3_FLAGS_CCS_OK; 858 s->s3->flags |= SSL3_FLAGS_CCS_OK;
861 } 859 }
862 } 860 }
@@ -890,7 +888,7 @@ ssl3_get_server_hello(SSL *s)
890 memcpy(s->session->session_id,p,j); /* j could be 0 */ 888 memcpy(s->session->session_id,p,j); /* j could be 0 */
891 } 889 }
892 p += j; 890 p += j;
893 c = ssl_get_cipher_by_char(s, p); 891 c = ssl3_get_cipher_by_char(p);
894 if (c == NULL) { 892 if (c == NULL) {
895 /* unknown cipher */ 893 /* unknown cipher */
896 al = SSL_AD_ILLEGAL_PARAMETER; 894 al = SSL_AD_ILLEGAL_PARAMETER;
@@ -906,7 +904,7 @@ ssl3_get_server_hello(SSL *s)
906 SSL_R_WRONG_CIPHER_RETURNED); 904 SSL_R_WRONG_CIPHER_RETURNED);
907 goto f_err; 905 goto f_err;
908 } 906 }
909 p += ssl_put_cipher_by_char(s, NULL, NULL); 907 p += ssl3_put_cipher_by_char(NULL, NULL);
910 908
911 sk = ssl_get_ciphers_by_id(s); 909 sk = ssl_get_ciphers_by_id(s);
912 i = sk_SSL_CIPHER_find(sk, c); 910 i = sk_SSL_CIPHER_find(sk, c);
diff --git a/src/lib/libssl/src/ssl/s3_meth.c b/src/lib/libssl/src/ssl/s3_meth.c
index bab67996cb..a5a63265f3 100644
--- a/src/lib/libssl/src/ssl/s3_meth.c
+++ b/src/lib/libssl/src/ssl/s3_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_meth.c,v 1.9 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: s3_meth.c,v 1.10 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -81,8 +81,6 @@ const SSL_METHOD SSLv3_method_data = {
81 .ssl_dispatch_alert = ssl3_dispatch_alert, 81 .ssl_dispatch_alert = ssl3_dispatch_alert,
82 .ssl_ctrl = ssl3_ctrl, 82 .ssl_ctrl = ssl3_ctrl,
83 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 83 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
84 .get_cipher_by_char = ssl3_get_cipher_by_char,
85 .put_cipher_by_char = ssl3_put_cipher_by_char,
86 .ssl_pending = ssl3_pending, 84 .ssl_pending = ssl3_pending,
87 .num_ciphers = ssl3_num_ciphers, 85 .num_ciphers = ssl3_num_ciphers,
88 .get_cipher = ssl3_get_cipher, 86 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c
index ed2aaf19b5..7b29ec41c8 100644
--- a/src/lib/libssl/src/ssl/s3_srvr.c
+++ b/src/lib/libssl/src/ssl/s3_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_srvr.c,v 1.79 2014/07/28 04:23:12 guenther Exp $ */ 1/* $OpenBSD: s3_srvr.c,v 1.80 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -184,8 +184,6 @@ const SSL_METHOD SSLv3_server_method_data = {
184 .ssl_dispatch_alert = ssl3_dispatch_alert, 184 .ssl_dispatch_alert = ssl3_dispatch_alert,
185 .ssl_ctrl = ssl3_ctrl, 185 .ssl_ctrl = ssl3_ctrl,
186 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 186 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
187 .get_cipher_by_char = ssl3_get_cipher_by_char,
188 .put_cipher_by_char = ssl3_put_cipher_by_char,
189 .ssl_pending = ssl3_pending, 187 .ssl_pending = ssl3_pending,
190 .num_ciphers = ssl3_num_ciphers, 188 .num_ciphers = ssl3_num_ciphers,
191 .get_cipher = ssl3_get_cipher, 189 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/ssl.h b/src/lib/libssl/src/ssl/ssl.h
index 7547d05aa6..857709f7c5 100644
--- a/src/lib/libssl/src/ssl/ssl.h
+++ b/src/lib/libssl/src/ssl/ssl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl.h,v 1.62 2014/07/12 19:45:53 jsing Exp $ */ 1/* $OpenBSD: ssl.h,v 1.63 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -410,6 +410,7 @@ struct ssl_method_st {
410 int (*ssl_dispatch_alert)(SSL *s); 410 int (*ssl_dispatch_alert)(SSL *s);
411 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg); 411 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
412 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg); 412 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
413 /* XXX - remove get_cipher_by_char and put_cipher_by_char. */
413 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); 414 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
414 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr); 415 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
415 int (*ssl_pending)(const SSL *s); 416 int (*ssl_pending)(const SSL *s);
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c
index 6b62713bca..bf94321eea 100644
--- a/src/lib/libssl/src/ssl/ssl_lib.c
+++ b/src/lib/libssl/src/ssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.78 2014/07/12 22:33:39 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.79 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1367,10 +1367,9 @@ SSL_get_shared_ciphers(const SSL *s, char *buf, int len)
1367} 1367}
1368 1368
1369int 1369int
1370ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p, 1370ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
1371 int (*put_cb)(const SSL_CIPHER *, unsigned char *))
1372{ 1371{
1373 int i, j = 0; 1372 int i;
1374 SSL_CIPHER *c; 1373 SSL_CIPHER *c;
1375 unsigned char *q; 1374 unsigned char *q;
1376 1375
@@ -1380,13 +1379,14 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
1380 1379
1381 for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { 1380 for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
1382 c = sk_SSL_CIPHER_value(sk, i); 1381 c = sk_SSL_CIPHER_value(sk, i);
1382
1383 /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */ 1383 /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
1384 if ((c->algorithm_ssl & SSL_TLSV1_2) && 1384 if ((c->algorithm_ssl & SSL_TLSV1_2) &&
1385 (TLS1_get_client_version(s) < TLS1_2_VERSION)) 1385 (TLS1_get_client_version(s) < TLS1_2_VERSION))
1386 continue; 1386 continue;
1387 j = put_cb ? put_cb(c, p) : ssl_put_cipher_by_char(s, c, p); 1387 p += ssl3_put_cipher_by_char(c, p);
1388 p += j;
1389 } 1388 }
1389
1390 /* 1390 /*
1391 * If p == q, no ciphers and caller indicates an error. Otherwise 1391 * If p == q, no ciphers and caller indicates an error. Otherwise
1392 * add SCSV if not renegotiating. 1392 * add SCSV if not renegotiating.
@@ -1395,9 +1395,7 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
1395 static SSL_CIPHER scsv = { 1395 static SSL_CIPHER scsv = {
1396 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 1396 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
1397 }; 1397 };
1398 j = put_cb ? put_cb(&scsv, p) : 1398 p += ssl3_put_cipher_by_char(&scsv, p);
1399 ssl_put_cipher_by_char(s, &scsv, p);
1400 p += j;
1401 } 1399 }
1402 1400
1403 return (p - q); 1401 return (p - q);
@@ -1414,7 +1412,7 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1414 if (s->s3) 1412 if (s->s3)
1415 s->s3->send_connection_binding = 0; 1413 s->s3->send_connection_binding = 0;
1416 1414
1417 n = ssl_put_cipher_by_char(s, NULL, NULL); 1415 n = ssl3_put_cipher_by_char(NULL, NULL);
1418 if ((num % n) != 0) { 1416 if ((num % n) != 0) {
1419 SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, 1417 SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
1420 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); 1418 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
@@ -1446,7 +1444,7 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1446 continue; 1444 continue;
1447 } 1445 }
1448 1446
1449 c = ssl_get_cipher_by_char(s, p); 1447 c = ssl3_get_cipher_by_char(p);
1450 p += n; 1448 p += n;
1451 if (c != NULL) { 1449 if (c != NULL) {
1452 if (!sk_SSL_CIPHER_push(sk, c)) { 1450 if (!sk_SSL_CIPHER_push(sk, c)) {
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h
index 3c1c444cb0..7961c4c06e 100644
--- a/src/lib/libssl/src/ssl/ssl_locl.h
+++ b/src/lib/libssl/src/ssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.63 2014/07/28 04:23:12 guenther Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.64 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -475,11 +475,6 @@ typedef struct sess_cert_st {
475/*#define SSL_DEBUG */ 475/*#define SSL_DEBUG */
476/*#define RSA_DEBUG */ 476/*#define RSA_DEBUG */
477 477
478#define ssl_put_cipher_by_char(ssl,ciph,ptr) \
479 ((ssl)->method->put_cipher_by_char((ciph),(ptr)))
480#define ssl_get_cipher_by_char(ssl,ptr) \
481 ((ssl)->method->get_cipher_by_char(ptr))
482
483/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff 478/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
484 * It is a bit of a mess of functions, but hell, think of it as 479 * It is a bit of a mess of functions, but hell, think of it as
485 * an opaque structure :-) */ 480 * an opaque structure :-) */
@@ -576,7 +571,7 @@ int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
576STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, 571STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
577 int num, STACK_OF(SSL_CIPHER) **skp); 572 int num, STACK_OF(SSL_CIPHER) **skp);
578int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, 573int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
579 unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *)); 574 unsigned char *p);
580STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 575STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
581 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted, 576 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
582 const char *rule_str); 577 const char *rule_str);
@@ -664,7 +659,6 @@ long ssl3_default_timeout(void);
664int ssl23_read(SSL *s, void *buf, int len); 659int ssl23_read(SSL *s, void *buf, int len);
665int ssl23_peek(SSL *s, void *buf, int len); 660int ssl23_peek(SSL *s, void *buf, int len);
666int ssl23_write(SSL *s, const void *buf, int len); 661int ssl23_write(SSL *s, const void *buf, int len);
667int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
668long ssl23_default_timeout(void); 662long ssl23_default_timeout(void);
669 663
670long tls1_default_timeout(void); 664long tls1_default_timeout(void);
diff --git a/src/lib/libssl/src/ssl/ssl_sess.c b/src/lib/libssl/src/ssl/ssl_sess.c
index d1cd418601..d4fa5a618f 100644
--- a/src/lib/libssl/src/ssl/ssl_sess.c
+++ b/src/lib/libssl/src/ssl/ssl_sess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.39 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -566,9 +566,9 @@ ssl_get_prev_session(SSL *s, unsigned char *session_id, int len,
566 l2n(l, p); 566 l2n(l, p);
567 567
568 if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR) 568 if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR)
569 ret->cipher = ssl_get_cipher_by_char(s, &(buf[2])); 569 ret->cipher = ssl3_get_cipher_by_char(&buf[2]);
570 else 570 else
571 ret->cipher = ssl_get_cipher_by_char(s, &(buf[1])); 571 ret->cipher = ssl3_get_cipher_by_char(&buf[1]);
572 572
573 if (ret->cipher == NULL) 573 if (ret->cipher == NULL)
574 goto err; 574 goto err;
diff --git a/src/lib/libssl/src/ssl/t1_clnt.c b/src/lib/libssl/src/ssl/t1_clnt.c
index 15ff91a8c4..3781063eb6 100644
--- a/src/lib/libssl/src/ssl/t1_clnt.c
+++ b/src/lib/libssl/src/ssl/t1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_clnt.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_clnt.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -84,8 +84,6 @@ const SSL_METHOD TLSv1_client_method_data = {
84 .ssl_dispatch_alert = ssl3_dispatch_alert, 84 .ssl_dispatch_alert = ssl3_dispatch_alert,
85 .ssl_ctrl = ssl3_ctrl, 85 .ssl_ctrl = ssl3_ctrl,
86 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 86 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
87 .get_cipher_by_char = ssl3_get_cipher_by_char,
88 .put_cipher_by_char = ssl3_put_cipher_by_char,
89 .ssl_pending = ssl3_pending, 87 .ssl_pending = ssl3_pending,
90 .num_ciphers = ssl3_num_ciphers, 88 .num_ciphers = ssl3_num_ciphers,
91 .get_cipher = ssl3_get_cipher, 89 .get_cipher = ssl3_get_cipher,
@@ -116,8 +114,6 @@ const SSL_METHOD TLSv1_1_client_method_data = {
116 .ssl_dispatch_alert = ssl3_dispatch_alert, 114 .ssl_dispatch_alert = ssl3_dispatch_alert,
117 .ssl_ctrl = ssl3_ctrl, 115 .ssl_ctrl = ssl3_ctrl,
118 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 116 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
119 .get_cipher_by_char = ssl3_get_cipher_by_char,
120 .put_cipher_by_char = ssl3_put_cipher_by_char,
121 .ssl_pending = ssl3_pending, 117 .ssl_pending = ssl3_pending,
122 .num_ciphers = ssl3_num_ciphers, 118 .num_ciphers = ssl3_num_ciphers,
123 .get_cipher = ssl3_get_cipher, 119 .get_cipher = ssl3_get_cipher,
@@ -148,8 +144,6 @@ const SSL_METHOD TLSv1_2_client_method_data = {
148 .ssl_dispatch_alert = ssl3_dispatch_alert, 144 .ssl_dispatch_alert = ssl3_dispatch_alert,
149 .ssl_ctrl = ssl3_ctrl, 145 .ssl_ctrl = ssl3_ctrl,
150 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 146 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
151 .get_cipher_by_char = ssl3_get_cipher_by_char,
152 .put_cipher_by_char = ssl3_put_cipher_by_char,
153 .ssl_pending = ssl3_pending, 147 .ssl_pending = ssl3_pending,
154 .num_ciphers = ssl3_num_ciphers, 148 .num_ciphers = ssl3_num_ciphers,
155 .get_cipher = ssl3_get_cipher, 149 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/t1_meth.c b/src/lib/libssl/src/ssl/t1_meth.c
index 71ddc101e1..de066322f4 100644
--- a/src/lib/libssl/src/ssl/t1_meth.c
+++ b/src/lib/libssl/src/ssl/t1_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_meth.c,v 1.12 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_meth.c,v 1.13 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -81,8 +81,6 @@ const SSL_METHOD TLSv1_method_data = {
81 .ssl_dispatch_alert = ssl3_dispatch_alert, 81 .ssl_dispatch_alert = ssl3_dispatch_alert,
82 .ssl_ctrl = ssl3_ctrl, 82 .ssl_ctrl = ssl3_ctrl,
83 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 83 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
84 .get_cipher_by_char = ssl3_get_cipher_by_char,
85 .put_cipher_by_char = ssl3_put_cipher_by_char,
86 .ssl_pending = ssl3_pending, 84 .ssl_pending = ssl3_pending,
87 .num_ciphers = ssl3_num_ciphers, 85 .num_ciphers = ssl3_num_ciphers,
88 .get_cipher = ssl3_get_cipher, 86 .get_cipher = ssl3_get_cipher,
@@ -113,8 +111,6 @@ const SSL_METHOD TLSv1_1_method_data = {
113 .ssl_dispatch_alert = ssl3_dispatch_alert, 111 .ssl_dispatch_alert = ssl3_dispatch_alert,
114 .ssl_ctrl = ssl3_ctrl, 112 .ssl_ctrl = ssl3_ctrl,
115 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 113 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
116 .get_cipher_by_char = ssl3_get_cipher_by_char,
117 .put_cipher_by_char = ssl3_put_cipher_by_char,
118 .ssl_pending = ssl3_pending, 114 .ssl_pending = ssl3_pending,
119 .num_ciphers = ssl3_num_ciphers, 115 .num_ciphers = ssl3_num_ciphers,
120 .get_cipher = ssl3_get_cipher, 116 .get_cipher = ssl3_get_cipher,
@@ -145,8 +141,6 @@ const SSL_METHOD TLSv1_2_method_data = {
145 .ssl_dispatch_alert = ssl3_dispatch_alert, 141 .ssl_dispatch_alert = ssl3_dispatch_alert,
146 .ssl_ctrl = ssl3_ctrl, 142 .ssl_ctrl = ssl3_ctrl,
147 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 143 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
148 .get_cipher_by_char = ssl3_get_cipher_by_char,
149 .put_cipher_by_char = ssl3_put_cipher_by_char,
150 .ssl_pending = ssl3_pending, 144 .ssl_pending = ssl3_pending,
151 .num_ciphers = ssl3_num_ciphers, 145 .num_ciphers = ssl3_num_ciphers,
152 .get_cipher = ssl3_get_cipher, 146 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/src/ssl/t1_srvr.c b/src/lib/libssl/src/ssl/t1_srvr.c
index 0986f96ca9..99712b6fb6 100644
--- a/src/lib/libssl/src/ssl/t1_srvr.c
+++ b/src/lib/libssl/src/ssl/t1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_srvr.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_srvr.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -85,8 +85,6 @@ const SSL_METHOD TLSv1_server_method_data = {
85 .ssl_dispatch_alert = ssl3_dispatch_alert, 85 .ssl_dispatch_alert = ssl3_dispatch_alert,
86 .ssl_ctrl = ssl3_ctrl, 86 .ssl_ctrl = ssl3_ctrl,
87 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 87 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
88 .get_cipher_by_char = ssl3_get_cipher_by_char,
89 .put_cipher_by_char = ssl3_put_cipher_by_char,
90 .ssl_pending = ssl3_pending, 88 .ssl_pending = ssl3_pending,
91 .num_ciphers = ssl3_num_ciphers, 89 .num_ciphers = ssl3_num_ciphers,
92 .get_cipher = ssl3_get_cipher, 90 .get_cipher = ssl3_get_cipher,
@@ -117,8 +115,6 @@ const SSL_METHOD TLSv1_1_server_method_data = {
117 .ssl_dispatch_alert = ssl3_dispatch_alert, 115 .ssl_dispatch_alert = ssl3_dispatch_alert,
118 .ssl_ctrl = ssl3_ctrl, 116 .ssl_ctrl = ssl3_ctrl,
119 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 117 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
120 .get_cipher_by_char = ssl3_get_cipher_by_char,
121 .put_cipher_by_char = ssl3_put_cipher_by_char,
122 .ssl_pending = ssl3_pending, 118 .ssl_pending = ssl3_pending,
123 .num_ciphers = ssl3_num_ciphers, 119 .num_ciphers = ssl3_num_ciphers,
124 .get_cipher = ssl3_get_cipher, 120 .get_cipher = ssl3_get_cipher,
@@ -149,8 +145,6 @@ const SSL_METHOD TLSv1_2_server_method_data = {
149 .ssl_dispatch_alert = ssl3_dispatch_alert, 145 .ssl_dispatch_alert = ssl3_dispatch_alert,
150 .ssl_ctrl = ssl3_ctrl, 146 .ssl_ctrl = ssl3_ctrl,
151 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 147 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
152 .get_cipher_by_char = ssl3_get_cipher_by_char,
153 .put_cipher_by_char = ssl3_put_cipher_by_char,
154 .ssl_pending = ssl3_pending, 148 .ssl_pending = ssl3_pending,
155 .num_ciphers = ssl3_num_ciphers, 149 .num_ciphers = ssl3_num_ciphers,
156 .get_cipher = ssl3_get_cipher, 150 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h
index 7547d05aa6..857709f7c5 100644
--- a/src/lib/libssl/ssl.h
+++ b/src/lib/libssl/ssl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl.h,v 1.62 2014/07/12 19:45:53 jsing Exp $ */ 1/* $OpenBSD: ssl.h,v 1.63 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -410,6 +410,7 @@ struct ssl_method_st {
410 int (*ssl_dispatch_alert)(SSL *s); 410 int (*ssl_dispatch_alert)(SSL *s);
411 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg); 411 long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
412 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg); 412 long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
413 /* XXX - remove get_cipher_by_char and put_cipher_by_char. */
413 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); 414 const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
414 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr); 415 int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
415 int (*ssl_pending)(const SSL *s); 416 int (*ssl_pending)(const SSL *s);
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 6b62713bca..bf94321eea 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.78 2014/07/12 22:33:39 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.79 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1367,10 +1367,9 @@ SSL_get_shared_ciphers(const SSL *s, char *buf, int len)
1367} 1367}
1368 1368
1369int 1369int
1370ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p, 1370ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
1371 int (*put_cb)(const SSL_CIPHER *, unsigned char *))
1372{ 1371{
1373 int i, j = 0; 1372 int i;
1374 SSL_CIPHER *c; 1373 SSL_CIPHER *c;
1375 unsigned char *q; 1374 unsigned char *q;
1376 1375
@@ -1380,13 +1379,14 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
1380 1379
1381 for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { 1380 for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
1382 c = sk_SSL_CIPHER_value(sk, i); 1381 c = sk_SSL_CIPHER_value(sk, i);
1382
1383 /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */ 1383 /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
1384 if ((c->algorithm_ssl & SSL_TLSV1_2) && 1384 if ((c->algorithm_ssl & SSL_TLSV1_2) &&
1385 (TLS1_get_client_version(s) < TLS1_2_VERSION)) 1385 (TLS1_get_client_version(s) < TLS1_2_VERSION))
1386 continue; 1386 continue;
1387 j = put_cb ? put_cb(c, p) : ssl_put_cipher_by_char(s, c, p); 1387 p += ssl3_put_cipher_by_char(c, p);
1388 p += j;
1389 } 1388 }
1389
1390 /* 1390 /*
1391 * If p == q, no ciphers and caller indicates an error. Otherwise 1391 * If p == q, no ciphers and caller indicates an error. Otherwise
1392 * add SCSV if not renegotiating. 1392 * add SCSV if not renegotiating.
@@ -1395,9 +1395,7 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
1395 static SSL_CIPHER scsv = { 1395 static SSL_CIPHER scsv = {
1396 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 1396 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
1397 }; 1397 };
1398 j = put_cb ? put_cb(&scsv, p) : 1398 p += ssl3_put_cipher_by_char(&scsv, p);
1399 ssl_put_cipher_by_char(s, &scsv, p);
1400 p += j;
1401 } 1399 }
1402 1400
1403 return (p - q); 1401 return (p - q);
@@ -1414,7 +1412,7 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1414 if (s->s3) 1412 if (s->s3)
1415 s->s3->send_connection_binding = 0; 1413 s->s3->send_connection_binding = 0;
1416 1414
1417 n = ssl_put_cipher_by_char(s, NULL, NULL); 1415 n = ssl3_put_cipher_by_char(NULL, NULL);
1418 if ((num % n) != 0) { 1416 if ((num % n) != 0) {
1419 SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, 1417 SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
1420 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); 1418 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
@@ -1446,7 +1444,7 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1446 continue; 1444 continue;
1447 } 1445 }
1448 1446
1449 c = ssl_get_cipher_by_char(s, p); 1447 c = ssl3_get_cipher_by_char(p);
1450 p += n; 1448 p += n;
1451 if (c != NULL) { 1449 if (c != NULL) {
1452 if (!sk_SSL_CIPHER_push(sk, c)) { 1450 if (!sk_SSL_CIPHER_push(sk, c)) {
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 3c1c444cb0..7961c4c06e 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.63 2014/07/28 04:23:12 guenther Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.64 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -475,11 +475,6 @@ typedef struct sess_cert_st {
475/*#define SSL_DEBUG */ 475/*#define SSL_DEBUG */
476/*#define RSA_DEBUG */ 476/*#define RSA_DEBUG */
477 477
478#define ssl_put_cipher_by_char(ssl,ciph,ptr) \
479 ((ssl)->method->put_cipher_by_char((ciph),(ptr)))
480#define ssl_get_cipher_by_char(ssl,ptr) \
481 ((ssl)->method->get_cipher_by_char(ptr))
482
483/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff 478/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
484 * It is a bit of a mess of functions, but hell, think of it as 479 * It is a bit of a mess of functions, but hell, think of it as
485 * an opaque structure :-) */ 480 * an opaque structure :-) */
@@ -576,7 +571,7 @@ int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
576STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, 571STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
577 int num, STACK_OF(SSL_CIPHER) **skp); 572 int num, STACK_OF(SSL_CIPHER) **skp);
578int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, 573int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
579 unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *)); 574 unsigned char *p);
580STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, 575STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
581 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted, 576 STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
582 const char *rule_str); 577 const char *rule_str);
@@ -664,7 +659,6 @@ long ssl3_default_timeout(void);
664int ssl23_read(SSL *s, void *buf, int len); 659int ssl23_read(SSL *s, void *buf, int len);
665int ssl23_peek(SSL *s, void *buf, int len); 660int ssl23_peek(SSL *s, void *buf, int len);
666int ssl23_write(SSL *s, const void *buf, int len); 661int ssl23_write(SSL *s, const void *buf, int len);
667int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
668long ssl23_default_timeout(void); 662long ssl23_default_timeout(void);
669 663
670long tls1_default_timeout(void); 664long tls1_default_timeout(void);
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c
index d1cd418601..d4fa5a618f 100644
--- a/src/lib/libssl/ssl_sess.c
+++ b/src/lib/libssl/ssl_sess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.39 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -566,9 +566,9 @@ ssl_get_prev_session(SSL *s, unsigned char *session_id, int len,
566 l2n(l, p); 566 l2n(l, p);
567 567
568 if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR) 568 if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR)
569 ret->cipher = ssl_get_cipher_by_char(s, &(buf[2])); 569 ret->cipher = ssl3_get_cipher_by_char(&buf[2]);
570 else 570 else
571 ret->cipher = ssl_get_cipher_by_char(s, &(buf[1])); 571 ret->cipher = ssl3_get_cipher_by_char(&buf[1]);
572 572
573 if (ret->cipher == NULL) 573 if (ret->cipher == NULL)
574 goto err; 574 goto err;
diff --git a/src/lib/libssl/t1_clnt.c b/src/lib/libssl/t1_clnt.c
index 15ff91a8c4..3781063eb6 100644
--- a/src/lib/libssl/t1_clnt.c
+++ b/src/lib/libssl/t1_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_clnt.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_clnt.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -84,8 +84,6 @@ const SSL_METHOD TLSv1_client_method_data = {
84 .ssl_dispatch_alert = ssl3_dispatch_alert, 84 .ssl_dispatch_alert = ssl3_dispatch_alert,
85 .ssl_ctrl = ssl3_ctrl, 85 .ssl_ctrl = ssl3_ctrl,
86 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 86 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
87 .get_cipher_by_char = ssl3_get_cipher_by_char,
88 .put_cipher_by_char = ssl3_put_cipher_by_char,
89 .ssl_pending = ssl3_pending, 87 .ssl_pending = ssl3_pending,
90 .num_ciphers = ssl3_num_ciphers, 88 .num_ciphers = ssl3_num_ciphers,
91 .get_cipher = ssl3_get_cipher, 89 .get_cipher = ssl3_get_cipher,
@@ -116,8 +114,6 @@ const SSL_METHOD TLSv1_1_client_method_data = {
116 .ssl_dispatch_alert = ssl3_dispatch_alert, 114 .ssl_dispatch_alert = ssl3_dispatch_alert,
117 .ssl_ctrl = ssl3_ctrl, 115 .ssl_ctrl = ssl3_ctrl,
118 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 116 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
119 .get_cipher_by_char = ssl3_get_cipher_by_char,
120 .put_cipher_by_char = ssl3_put_cipher_by_char,
121 .ssl_pending = ssl3_pending, 117 .ssl_pending = ssl3_pending,
122 .num_ciphers = ssl3_num_ciphers, 118 .num_ciphers = ssl3_num_ciphers,
123 .get_cipher = ssl3_get_cipher, 119 .get_cipher = ssl3_get_cipher,
@@ -148,8 +144,6 @@ const SSL_METHOD TLSv1_2_client_method_data = {
148 .ssl_dispatch_alert = ssl3_dispatch_alert, 144 .ssl_dispatch_alert = ssl3_dispatch_alert,
149 .ssl_ctrl = ssl3_ctrl, 145 .ssl_ctrl = ssl3_ctrl,
150 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 146 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
151 .get_cipher_by_char = ssl3_get_cipher_by_char,
152 .put_cipher_by_char = ssl3_put_cipher_by_char,
153 .ssl_pending = ssl3_pending, 147 .ssl_pending = ssl3_pending,
154 .num_ciphers = ssl3_num_ciphers, 148 .num_ciphers = ssl3_num_ciphers,
155 .get_cipher = ssl3_get_cipher, 149 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/t1_meth.c b/src/lib/libssl/t1_meth.c
index 71ddc101e1..de066322f4 100644
--- a/src/lib/libssl/t1_meth.c
+++ b/src/lib/libssl/t1_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_meth.c,v 1.12 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_meth.c,v 1.13 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -81,8 +81,6 @@ const SSL_METHOD TLSv1_method_data = {
81 .ssl_dispatch_alert = ssl3_dispatch_alert, 81 .ssl_dispatch_alert = ssl3_dispatch_alert,
82 .ssl_ctrl = ssl3_ctrl, 82 .ssl_ctrl = ssl3_ctrl,
83 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 83 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
84 .get_cipher_by_char = ssl3_get_cipher_by_char,
85 .put_cipher_by_char = ssl3_put_cipher_by_char,
86 .ssl_pending = ssl3_pending, 84 .ssl_pending = ssl3_pending,
87 .num_ciphers = ssl3_num_ciphers, 85 .num_ciphers = ssl3_num_ciphers,
88 .get_cipher = ssl3_get_cipher, 86 .get_cipher = ssl3_get_cipher,
@@ -113,8 +111,6 @@ const SSL_METHOD TLSv1_1_method_data = {
113 .ssl_dispatch_alert = ssl3_dispatch_alert, 111 .ssl_dispatch_alert = ssl3_dispatch_alert,
114 .ssl_ctrl = ssl3_ctrl, 112 .ssl_ctrl = ssl3_ctrl,
115 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 113 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
116 .get_cipher_by_char = ssl3_get_cipher_by_char,
117 .put_cipher_by_char = ssl3_put_cipher_by_char,
118 .ssl_pending = ssl3_pending, 114 .ssl_pending = ssl3_pending,
119 .num_ciphers = ssl3_num_ciphers, 115 .num_ciphers = ssl3_num_ciphers,
120 .get_cipher = ssl3_get_cipher, 116 .get_cipher = ssl3_get_cipher,
@@ -145,8 +141,6 @@ const SSL_METHOD TLSv1_2_method_data = {
145 .ssl_dispatch_alert = ssl3_dispatch_alert, 141 .ssl_dispatch_alert = ssl3_dispatch_alert,
146 .ssl_ctrl = ssl3_ctrl, 142 .ssl_ctrl = ssl3_ctrl,
147 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 143 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
148 .get_cipher_by_char = ssl3_get_cipher_by_char,
149 .put_cipher_by_char = ssl3_put_cipher_by_char,
150 .ssl_pending = ssl3_pending, 144 .ssl_pending = ssl3_pending,
151 .num_ciphers = ssl3_num_ciphers, 145 .num_ciphers = ssl3_num_ciphers,
152 .get_cipher = ssl3_get_cipher, 146 .get_cipher = ssl3_get_cipher,
diff --git a/src/lib/libssl/t1_srvr.c b/src/lib/libssl/t1_srvr.c
index 0986f96ca9..99712b6fb6 100644
--- a/src/lib/libssl/t1_srvr.c
+++ b/src/lib/libssl/t1_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_srvr.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: t1_srvr.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -85,8 +85,6 @@ const SSL_METHOD TLSv1_server_method_data = {
85 .ssl_dispatch_alert = ssl3_dispatch_alert, 85 .ssl_dispatch_alert = ssl3_dispatch_alert,
86 .ssl_ctrl = ssl3_ctrl, 86 .ssl_ctrl = ssl3_ctrl,
87 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 87 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
88 .get_cipher_by_char = ssl3_get_cipher_by_char,
89 .put_cipher_by_char = ssl3_put_cipher_by_char,
90 .ssl_pending = ssl3_pending, 88 .ssl_pending = ssl3_pending,
91 .num_ciphers = ssl3_num_ciphers, 89 .num_ciphers = ssl3_num_ciphers,
92 .get_cipher = ssl3_get_cipher, 90 .get_cipher = ssl3_get_cipher,
@@ -117,8 +115,6 @@ const SSL_METHOD TLSv1_1_server_method_data = {
117 .ssl_dispatch_alert = ssl3_dispatch_alert, 115 .ssl_dispatch_alert = ssl3_dispatch_alert,
118 .ssl_ctrl = ssl3_ctrl, 116 .ssl_ctrl = ssl3_ctrl,
119 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 117 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
120 .get_cipher_by_char = ssl3_get_cipher_by_char,
121 .put_cipher_by_char = ssl3_put_cipher_by_char,
122 .ssl_pending = ssl3_pending, 118 .ssl_pending = ssl3_pending,
123 .num_ciphers = ssl3_num_ciphers, 119 .num_ciphers = ssl3_num_ciphers,
124 .get_cipher = ssl3_get_cipher, 120 .get_cipher = ssl3_get_cipher,
@@ -149,8 +145,6 @@ const SSL_METHOD TLSv1_2_server_method_data = {
149 .ssl_dispatch_alert = ssl3_dispatch_alert, 145 .ssl_dispatch_alert = ssl3_dispatch_alert,
150 .ssl_ctrl = ssl3_ctrl, 146 .ssl_ctrl = ssl3_ctrl,
151 .ssl_ctx_ctrl = ssl3_ctx_ctrl, 147 .ssl_ctx_ctrl = ssl3_ctx_ctrl,
152 .get_cipher_by_char = ssl3_get_cipher_by_char,
153 .put_cipher_by_char = ssl3_put_cipher_by_char,
154 .ssl_pending = ssl3_pending, 148 .ssl_pending = ssl3_pending,
155 .num_ciphers = ssl3_num_ciphers, 149 .num_ciphers = ssl3_num_ciphers,
156 .get_cipher = ssl3_get_cipher, 150 .get_cipher = ssl3_get_cipher,