summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2015-09-11 18:08:21 +0000
committerjsing <>2015-09-11 18:08:21 +0000
commitc42e261f37ac3f2934dd92296a095be3cbe461c1 (patch)
tree378accab3864084b0135769f8d9117e86df41845 /src/lib
parent63eec788b454a03bda0826cf41f02edb6771089c (diff)
downloadopenbsd-c42e261f37ac3f2934dd92296a095be3cbe461c1.tar.gz
openbsd-c42e261f37ac3f2934dd92296a095be3cbe461c1.tar.bz2
openbsd-c42e261f37ac3f2934dd92296a095be3cbe461c1.zip
Rename functions that moved to t1_enc.c, with a tls1_ prefix instead of a
ssl3_ prefix. ok beck@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/d1_both.c6
-rw-r--r--src/lib/libssl/d1_clnt.c6
-rw-r--r--src/lib/libssl/d1_pkt.c4
-rw-r--r--src/lib/libssl/d1_srvr.c10
-rw-r--r--src/lib/libssl/s23_clnt.c6
-rw-r--r--src/lib/libssl/s23_srvr.c6
-rw-r--r--src/lib/libssl/s3_both.c6
-rw-r--r--src/lib/libssl/s3_clnt.c14
-rw-r--r--src/lib/libssl/s3_lib.c10
-rw-r--r--src/lib/libssl/s3_srvr.c18
-rw-r--r--src/lib/libssl/src/ssl/d1_both.c6
-rw-r--r--src/lib/libssl/src/ssl/d1_clnt.c6
-rw-r--r--src/lib/libssl/src/ssl/d1_pkt.c4
-rw-r--r--src/lib/libssl/src/ssl/d1_srvr.c10
-rw-r--r--src/lib/libssl/src/ssl/s23_clnt.c6
-rw-r--r--src/lib/libssl/src/ssl/s23_srvr.c6
-rw-r--r--src/lib/libssl/src/ssl/s3_both.c6
-rw-r--r--src/lib/libssl/src/ssl/s3_clnt.c14
-rw-r--r--src/lib/libssl/src/ssl/s3_lib.c10
-rw-r--r--src/lib/libssl/src/ssl/s3_srvr.c18
-rw-r--r--src/lib/libssl/src/ssl/ssl_locl.h14
-rw-r--r--src/lib/libssl/src/ssl/t1_enc.c30
-rw-r--r--src/lib/libssl/ssl_locl.h14
-rw-r--r--src/lib/libssl/t1_enc.c30
24 files changed, 130 insertions, 130 deletions
diff --git a/src/lib/libssl/d1_both.c b/src/lib/libssl/d1_both.c
index dd67028a38..448bd76fd0 100644
--- a/src/lib/libssl/d1_both.c
+++ b/src/lib/libssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.37 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.38 2015/09/11 18:08:21 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.
@@ -363,7 +363,7 @@ dtls1_do_write(SSL *s, int type)
363 xlen = ret - DTLS1_HM_HEADER_LENGTH; 363 xlen = ret - DTLS1_HM_HEADER_LENGTH;
364 } 364 }
365 365
366 ssl3_finish_mac(s, p, xlen); 366 tls1_finish_mac(s, p, xlen);
367 } 367 }
368 368
369 if (ret == s->init_num) { 369 if (ret == s->init_num) {
@@ -444,7 +444,7 @@ again:
444 p -= DTLS1_HM_HEADER_LENGTH; 444 p -= DTLS1_HM_HEADER_LENGTH;
445 msg_len += DTLS1_HM_HEADER_LENGTH; 445 msg_len += DTLS1_HM_HEADER_LENGTH;
446 446
447 ssl3_finish_mac(s, p, msg_len); 447 tls1_finish_mac(s, p, msg_len);
448 if (s->msg_callback) 448 if (s->msg_callback)
449 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, p, msg_len, 449 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, p, msg_len,
450 s, s->msg_callback_arg); 450 s, s->msg_callback_arg);
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index f5745b1e7d..f45ef939ed 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.51 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.52 2015/09/11 18:08:21 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.
@@ -256,7 +256,7 @@ dtls1_connect(SSL *s)
256 s->shutdown = 0; 256 s->shutdown = 0;
257 257
258 /* every DTLS ClientHello resets Finished MAC */ 258 /* every DTLS ClientHello resets Finished MAC */
259 if (!ssl3_init_finished_mac(s)) { 259 if (!tls1_init_finished_mac(s)) {
260 ret = -1; 260 ret = -1;
261 goto end; 261 goto end;
262 } 262 }
@@ -541,7 +541,7 @@ dtls1_connect(SSL *s)
541 541
542 case SSL_ST_OK: 542 case SSL_ST_OK:
543 /* clean a few things up */ 543 /* clean a few things up */
544 ssl3_cleanup_key_block(s); 544 tls1_cleanup_key_block(s);
545 545
546 /* If we are not 'joining' the last two packets, 546 /* If we are not 'joining' the last two packets,
547 * remove the buffering now */ 547 * remove the buffering now */
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index ca716a2222..5326a2c3d0 100644
--- a/src/lib/libssl/d1_pkt.c
+++ b/src/lib/libssl/d1_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_pkt.c,v 1.47 2015/09/10 17:57:50 jsing Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.48 2015/09/11 18:08:21 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.
@@ -1319,7 +1319,7 @@ do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len)
1319 wr->type=type; /* not needed but helps for debugging */ 1319 wr->type=type; /* not needed but helps for debugging */
1320 wr->length += DTLS1_RT_HEADER_LENGTH; 1320 wr->length += DTLS1_RT_HEADER_LENGTH;
1321 1321
1322 ssl3_record_sequence_increment(s->s3->write_sequence); 1322 tls1_record_sequence_increment(s->s3->write_sequence);
1323 1323
1324 /* now let's set up wb */ 1324 /* now let's set up wb */
1325 wb->left = prefix_len + wr->length; 1325 wb->left = prefix_len + wr->length;
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index 66f79c3953..c0489adfa4 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.57 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.58 2015/09/11 18:08:21 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.
@@ -249,7 +249,7 @@ dtls1_accept(SSL *s)
249 goto end; 249 goto end;
250 } 250 }
251 251
252 if (!ssl3_init_finished_mac(s)) { 252 if (!tls1_init_finished_mac(s)) {
253 ret = -1; 253 ret = -1;
254 goto end; 254 goto end;
255 } 255 }
@@ -278,7 +278,7 @@ dtls1_accept(SSL *s)
278 s->state = SSL3_ST_SW_FLUSH; 278 s->state = SSL3_ST_SW_FLUSH;
279 s->init_num = 0; 279 s->init_num = 0;
280 280
281 if (!ssl3_init_finished_mac(s)) { 281 if (!tls1_init_finished_mac(s)) {
282 ret = -1; 282 ret = -1;
283 goto end; 283 goto end;
284 } 284 }
@@ -335,7 +335,7 @@ dtls1_accept(SSL *s)
335 s->s3->tmp.next_state = SSL3_ST_SR_CLNT_HELLO_A; 335 s->s3->tmp.next_state = SSL3_ST_SR_CLNT_HELLO_A;
336 336
337 /* HelloVerifyRequest resets Finished MAC */ 337 /* HelloVerifyRequest resets Finished MAC */
338 if (!ssl3_init_finished_mac(s)) { 338 if (!tls1_init_finished_mac(s)) {
339 ret = -1; 339 ret = -1;
340 goto end; 340 goto end;
341 } 341 }
@@ -602,7 +602,7 @@ dtls1_accept(SSL *s)
602 602
603 case SSL_ST_OK: 603 case SSL_ST_OK:
604 /* clean a few things up */ 604 /* clean a few things up */
605 ssl3_cleanup_key_block(s); 605 tls1_cleanup_key_block(s);
606 606
607 /* remove buffering on output */ 607 /* remove buffering on output */
608 ssl_free_wbio_buffer(s); 608 ssl_free_wbio_buffer(s);
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c
index 1078bc0155..c6920e2b34 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.45 2015/09/11 14:39:05 jsing Exp $ */ 1/* $OpenBSD: s23_clnt.c,v 1.46 2015/09/11 18:08:21 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 *
@@ -168,7 +168,7 @@ ssl23_connect(SSL *s)
168 ret = -1; 168 ret = -1;
169 goto end; 169 goto end;
170 } 170 }
171 if (!ssl3_init_finished_mac(s)) { 171 if (!tls1_init_finished_mac(s)) {
172 ret = -1; 172 ret = -1;
173 goto end; 173 goto end;
174 } 174 }
@@ -348,7 +348,7 @@ ssl23_client_hello(SSL *s)
348 s->init_num = p - buf; 348 s->init_num = p - buf;
349 s->init_off = 0; 349 s->init_off = 0;
350 350
351 ssl3_finish_mac(s, &(buf[SSL3_RT_HEADER_LENGTH]), 351 tls1_finish_mac(s, &(buf[SSL3_RT_HEADER_LENGTH]),
352 s->init_num - SSL3_RT_HEADER_LENGTH); 352 s->init_num - SSL3_RT_HEADER_LENGTH);
353 353
354 s->state = SSL23_ST_CW_CLNT_HELLO_B; 354 s->state = SSL23_ST_CW_CLNT_HELLO_B;
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c
index d0699a55d7..08b416cab8 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.44 2015/09/11 14:47:56 jsing Exp $ */ 1/* $OpenBSD: s23_srvr.c,v 1.45 2015/09/11 18:08:21 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 *
@@ -158,7 +158,7 @@ ssl23_accept(SSL *s)
158 ret = -1; 158 ret = -1;
159 goto end; 159 goto end;
160 } 160 }
161 if (!ssl3_init_finished_mac(s)) { 161 if (!tls1_init_finished_mac(s)) {
162 ret = -1; 162 ret = -1;
163 goto end; 163 goto end;
164 } 164 }
@@ -383,7 +383,7 @@ ssl23_get_client_hello(SSL *s)
383 if (j != n + 2) 383 if (j != n + 2)
384 return -1; 384 return -1;
385 385
386 ssl3_finish_mac(s, s->packet + 2, s->packet_length - 2); 386 tls1_finish_mac(s, s->packet + 2, s->packet_length - 2);
387 if (s->msg_callback) 387 if (s->msg_callback)
388 s->msg_callback(0, SSL2_VERSION, 0, s->packet + 2, 388 s->msg_callback(0, SSL2_VERSION, 0, s->packet + 2,
389 s->packet_length - 2, s, s->msg_callback_arg); 389 s->packet_length - 2, s, s->msg_callback_arg);
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c
index cd8afd1946..49b1e50659 100644
--- a/src/lib/libssl/s3_both.c
+++ b/src/lib/libssl/s3_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_both.c,v 1.46 2015/09/11 16:41:05 jsing Exp $ */ 1/* $OpenBSD: s3_both.c,v 1.47 2015/09/11 18:08:21 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 *
@@ -146,7 +146,7 @@ ssl3_do_write(SSL *s, int type)
146 * Should not be done for 'Hello Request's, but in that case 146 * Should not be done for 'Hello Request's, but in that case
147 * we'll ignore the result anyway. 147 * we'll ignore the result anyway.
148 */ 148 */
149 ssl3_finish_mac(s, 149 tls1_finish_mac(s,
150 (unsigned char *)&s->init_buf->data[s->init_off], ret); 150 (unsigned char *)&s->init_buf->data[s->init_off], ret);
151 151
152 if (ret == s->init_num) { 152 if (ret == s->init_num) {
@@ -524,7 +524,7 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
524 ssl3_take_mac(s); 524 ssl3_take_mac(s);
525 525
526 /* Feed this message into MAC computation. */ 526 /* Feed this message into MAC computation. */
527 ssl3_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4); 527 tls1_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4);
528 if (s->msg_callback) 528 if (s->msg_callback)
529 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, 529 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
530 s->init_buf->data, (size_t)s->init_num + 4, s, 530 s->init_buf->data, (size_t)s->init_num + 4, s,
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c
index e4ce8163ac..eed359450f 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.126 2015/09/10 15:56:26 jsing Exp $ */ 1/* $OpenBSD: s3_clnt.c,v 1.127 2015/09/11 18:08:21 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 *
@@ -234,7 +234,7 @@ ssl3_connect(SSL *s)
234 234
235 /* don't push the buffering BIO quite yet */ 235 /* don't push the buffering BIO quite yet */
236 236
237 if (!ssl3_init_finished_mac(s)) { 237 if (!tls1_init_finished_mac(s)) {
238 ret = -1; 238 ret = -1;
239 goto end; 239 goto end;
240 } 240 }
@@ -517,7 +517,7 @@ ssl3_connect(SSL *s)
517 517
518 case SSL_ST_OK: 518 case SSL_ST_OK:
519 /* clean a few things up */ 519 /* clean a few things up */
520 ssl3_cleanup_key_block(s); 520 tls1_cleanup_key_block(s);
521 521
522 if (s->init_buf != NULL) { 522 if (s->init_buf != NULL) {
523 BUF_MEM_free(s->init_buf); 523 BUF_MEM_free(s->init_buf);
@@ -885,7 +885,7 @@ ssl3_get_server_hello(SSL *s)
885 */ 885 */
886 alg_k = s->s3->tmp.new_cipher->algorithm_mkey; 886 alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
887 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) && 887 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) &&
888 !ssl3_digest_cached_records(s)) { 888 !tls1_digest_cached_records(s)) {
889 al = SSL_AD_INTERNAL_ERROR; 889 al = SSL_AD_INTERNAL_ERROR;
890 goto f_err; 890 goto f_err;
891 } 891 }
@@ -1524,7 +1524,7 @@ ssl3_get_certificate_request(SSL *s)
1524 * as we wont be doing client auth. 1524 * as we wont be doing client auth.
1525 */ 1525 */
1526 if (s->s3->handshake_buffer) { 1526 if (s->s3->handshake_buffer) {
1527 if (!ssl3_digest_cached_records(s)) 1527 if (!tls1_digest_cached_records(s))
1528 goto err; 1528 goto err;
1529 } 1529 }
1530 return (1); 1530 return (1);
@@ -2309,7 +2309,7 @@ ssl3_send_client_verify(SSL *s)
2309 } 2309 }
2310 s2n(u, p); 2310 s2n(u, p);
2311 n = u + 4; 2311 n = u + 4;
2312 if (!ssl3_digest_cached_records(s)) 2312 if (!tls1_digest_cached_records(s))
2313 goto err; 2313 goto err;
2314 } else if (pkey->type == EVP_PKEY_RSA) { 2314 } else if (pkey->type == EVP_PKEY_RSA) {
2315 s->method->ssl3_enc->cert_verify_mac( 2315 s->method->ssl3_enc->cert_verify_mac(
@@ -2381,7 +2381,7 @@ ssl3_send_client_verify(SSL *s)
2381 ERR_R_EVP_LIB); 2381 ERR_R_EVP_LIB);
2382 goto err; 2382 goto err;
2383 } 2383 }
2384 if (!ssl3_digest_cached_records(s)) 2384 if (!tls1_digest_cached_records(s))
2385 goto err; 2385 goto err;
2386 j = sigsize; 2386 j = sigsize;
2387 s2n(j, p); 2387 s2n(j, p);
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 984e343c95..1a619e3d30 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.103 2015/09/11 17:32:23 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.104 2015/09/11 18:08:21 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 *
@@ -2023,7 +2023,7 @@ ssl3_free(SSL *s)
2023 if (s == NULL) 2023 if (s == NULL)
2024 return; 2024 return;
2025 2025
2026 ssl3_cleanup_key_block(s); 2026 tls1_cleanup_key_block(s);
2027 ssl3_release_read_buffer(s); 2027 ssl3_release_read_buffer(s);
2028 ssl3_release_write_buffer(s); 2028 ssl3_release_write_buffer(s);
2029 2029
@@ -2033,7 +2033,7 @@ ssl3_free(SSL *s)
2033 if (s->s3->tmp.ca_names != NULL) 2033 if (s->s3->tmp.ca_names != NULL)
2034 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); 2034 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
2035 BIO_free(s->s3->handshake_buffer); 2035 BIO_free(s->s3->handshake_buffer);
2036 ssl3_free_digest_list(s); 2036 tls1_free_digest_list(s);
2037 free(s->s3->alpn_selected); 2037 free(s->s3->alpn_selected);
2038 2038
2039 explicit_bzero(s->s3, sizeof *s->s3); 2039 explicit_bzero(s->s3, sizeof *s->s3);
@@ -2047,7 +2047,7 @@ ssl3_clear(SSL *s)
2047 unsigned char *rp, *wp; 2047 unsigned char *rp, *wp;
2048 size_t rlen, wlen; 2048 size_t rlen, wlen;
2049 2049
2050 ssl3_cleanup_key_block(s); 2050 tls1_cleanup_key_block(s);
2051 if (s->s3->tmp.ca_names != NULL) 2051 if (s->s3->tmp.ca_names != NULL)
2052 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); 2052 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
2053 2053
@@ -2064,7 +2064,7 @@ ssl3_clear(SSL *s)
2064 BIO_free(s->s3->handshake_buffer); 2064 BIO_free(s->s3->handshake_buffer);
2065 s->s3->handshake_buffer = NULL; 2065 s->s3->handshake_buffer = NULL;
2066 2066
2067 ssl3_free_digest_list(s); 2067 tls1_free_digest_list(s);
2068 2068
2069 free(s->s3->alpn_selected); 2069 free(s->s3->alpn_selected);
2070 s->s3->alpn_selected = NULL; 2070 s->s3->alpn_selected = NULL;
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index 4bbc160d58..da7f6d71cd 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.117 2015/09/10 17:57:50 jsing Exp $ */ 1/* $OpenBSD: s3_srvr.c,v 1.118 2015/09/11 18:08:21 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 *
@@ -239,7 +239,7 @@ ssl3_accept(SSL *s)
239 goto end; 239 goto end;
240 } 240 }
241 241
242 if (!ssl3_init_finished_mac(s)) { 242 if (!tls1_init_finished_mac(s)) {
243 ret = -1; 243 ret = -1;
244 goto end; 244 goto end;
245 } 245 }
@@ -279,7 +279,7 @@ ssl3_accept(SSL *s)
279 s->state = SSL3_ST_SW_FLUSH; 279 s->state = SSL3_ST_SW_FLUSH;
280 s->init_num = 0; 280 s->init_num = 0;
281 281
282 if (!ssl3_init_finished_mac(s)) { 282 if (!tls1_init_finished_mac(s)) {
283 ret = -1; 283 ret = -1;
284 goto end; 284 goto end;
285 } 285 }
@@ -393,7 +393,7 @@ ssl3_accept(SSL *s)
393 s->s3->tmp.cert_request = 0; 393 s->s3->tmp.cert_request = 0;
394 s->state = SSL3_ST_SW_SRVR_DONE_A; 394 s->state = SSL3_ST_SW_SRVR_DONE_A;
395 if (s->s3->handshake_buffer) 395 if (s->s3->handshake_buffer)
396 if (!ssl3_digest_cached_records(s)) 396 if (!tls1_digest_cached_records(s))
397 return (-1); 397 return (-1);
398 } else { 398 } else {
399 s->s3->tmp.cert_request = 1; 399 s->s3->tmp.cert_request = 1;
@@ -485,7 +485,7 @@ ssl3_accept(SSL *s)
485 return (-1); 485 return (-1);
486 } 486 }
487 s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE; 487 s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE;
488 if (!ssl3_digest_cached_records(s)) 488 if (!tls1_digest_cached_records(s))
489 return (-1); 489 return (-1);
490 } else { 490 } else {
491 int offset = 0; 491 int offset = 0;
@@ -502,7 +502,7 @@ ssl3_accept(SSL *s)
502 * But it is next step 502 * But it is next step
503 */ 503 */
504 if (s->s3->handshake_buffer) 504 if (s->s3->handshake_buffer)
505 if (!ssl3_digest_cached_records(s)) 505 if (!tls1_digest_cached_records(s))
506 return (-1); 506 return (-1);
507 for (dgst_num = 0; dgst_num < SSL_MAX_DIGEST; 507 for (dgst_num = 0; dgst_num < SSL_MAX_DIGEST;
508 dgst_num++) 508 dgst_num++)
@@ -633,7 +633,7 @@ ssl3_accept(SSL *s)
633 633
634 case SSL_ST_OK: 634 case SSL_ST_OK:
635 /* clean a few things up */ 635 /* clean a few things up */
636 ssl3_cleanup_key_block(s); 636 tls1_cleanup_key_block(s);
637 637
638 BUF_MEM_free(s->init_buf); 638 BUF_MEM_free(s->init_buf);
639 s->init_buf = NULL; 639 s->init_buf = NULL;
@@ -1035,7 +1035,7 @@ ssl3_get_client_hello(SSL *s)
1035 alg_k = s->s3->tmp.new_cipher->algorithm_mkey; 1035 alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
1036 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) || 1036 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) ||
1037 !(s->verify_mode & SSL_VERIFY_PEER)) { 1037 !(s->verify_mode & SSL_VERIFY_PEER)) {
1038 if (!ssl3_digest_cached_records(s)) { 1038 if (!tls1_digest_cached_records(s)) {
1039 al = SSL_AD_INTERNAL_ERROR; 1039 al = SSL_AD_INTERNAL_ERROR;
1040 goto f_err; 1040 goto f_err;
1041 } 1041 }
@@ -2384,7 +2384,7 @@ ssl3_get_client_certificate(SSL *s)
2384 goto f_err; 2384 goto f_err;
2385 } 2385 }
2386 /* No client certificate so digest cached records */ 2386 /* No client certificate so digest cached records */
2387 if (s->s3->handshake_buffer && !ssl3_digest_cached_records(s)) { 2387 if (s->s3->handshake_buffer && !tls1_digest_cached_records(s)) {
2388 al = SSL_AD_INTERNAL_ERROR; 2388 al = SSL_AD_INTERNAL_ERROR;
2389 goto f_err; 2389 goto f_err;
2390 } 2390 }
diff --git a/src/lib/libssl/src/ssl/d1_both.c b/src/lib/libssl/src/ssl/d1_both.c
index dd67028a38..448bd76fd0 100644
--- a/src/lib/libssl/src/ssl/d1_both.c
+++ b/src/lib/libssl/src/ssl/d1_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_both.c,v 1.37 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_both.c,v 1.38 2015/09/11 18:08:21 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.
@@ -363,7 +363,7 @@ dtls1_do_write(SSL *s, int type)
363 xlen = ret - DTLS1_HM_HEADER_LENGTH; 363 xlen = ret - DTLS1_HM_HEADER_LENGTH;
364 } 364 }
365 365
366 ssl3_finish_mac(s, p, xlen); 366 tls1_finish_mac(s, p, xlen);
367 } 367 }
368 368
369 if (ret == s->init_num) { 369 if (ret == s->init_num) {
@@ -444,7 +444,7 @@ again:
444 p -= DTLS1_HM_HEADER_LENGTH; 444 p -= DTLS1_HM_HEADER_LENGTH;
445 msg_len += DTLS1_HM_HEADER_LENGTH; 445 msg_len += DTLS1_HM_HEADER_LENGTH;
446 446
447 ssl3_finish_mac(s, p, msg_len); 447 tls1_finish_mac(s, p, msg_len);
448 if (s->msg_callback) 448 if (s->msg_callback)
449 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, p, msg_len, 449 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, p, msg_len,
450 s, s->msg_callback_arg); 450 s, s->msg_callback_arg);
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c
index f5745b1e7d..f45ef939ed 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.51 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_clnt.c,v 1.52 2015/09/11 18:08:21 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.
@@ -256,7 +256,7 @@ dtls1_connect(SSL *s)
256 s->shutdown = 0; 256 s->shutdown = 0;
257 257
258 /* every DTLS ClientHello resets Finished MAC */ 258 /* every DTLS ClientHello resets Finished MAC */
259 if (!ssl3_init_finished_mac(s)) { 259 if (!tls1_init_finished_mac(s)) {
260 ret = -1; 260 ret = -1;
261 goto end; 261 goto end;
262 } 262 }
@@ -541,7 +541,7 @@ dtls1_connect(SSL *s)
541 541
542 case SSL_ST_OK: 542 case SSL_ST_OK:
543 /* clean a few things up */ 543 /* clean a few things up */
544 ssl3_cleanup_key_block(s); 544 tls1_cleanup_key_block(s);
545 545
546 /* If we are not 'joining' the last two packets, 546 /* If we are not 'joining' the last two packets,
547 * remove the buffering now */ 547 * remove the buffering now */
diff --git a/src/lib/libssl/src/ssl/d1_pkt.c b/src/lib/libssl/src/ssl/d1_pkt.c
index ca716a2222..5326a2c3d0 100644
--- a/src/lib/libssl/src/ssl/d1_pkt.c
+++ b/src/lib/libssl/src/ssl/d1_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_pkt.c,v 1.47 2015/09/10 17:57:50 jsing Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.48 2015/09/11 18:08:21 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.
@@ -1319,7 +1319,7 @@ do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len)
1319 wr->type=type; /* not needed but helps for debugging */ 1319 wr->type=type; /* not needed but helps for debugging */
1320 wr->length += DTLS1_RT_HEADER_LENGTH; 1320 wr->length += DTLS1_RT_HEADER_LENGTH;
1321 1321
1322 ssl3_record_sequence_increment(s->s3->write_sequence); 1322 tls1_record_sequence_increment(s->s3->write_sequence);
1323 1323
1324 /* now let's set up wb */ 1324 /* now let's set up wb */
1325 wb->left = prefix_len + wr->length; 1325 wb->left = prefix_len + wr->length;
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c
index 66f79c3953..c0489adfa4 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.57 2015/09/11 16:28:37 jsing Exp $ */ 1/* $OpenBSD: d1_srvr.c,v 1.58 2015/09/11 18:08:21 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.
@@ -249,7 +249,7 @@ dtls1_accept(SSL *s)
249 goto end; 249 goto end;
250 } 250 }
251 251
252 if (!ssl3_init_finished_mac(s)) { 252 if (!tls1_init_finished_mac(s)) {
253 ret = -1; 253 ret = -1;
254 goto end; 254 goto end;
255 } 255 }
@@ -278,7 +278,7 @@ dtls1_accept(SSL *s)
278 s->state = SSL3_ST_SW_FLUSH; 278 s->state = SSL3_ST_SW_FLUSH;
279 s->init_num = 0; 279 s->init_num = 0;
280 280
281 if (!ssl3_init_finished_mac(s)) { 281 if (!tls1_init_finished_mac(s)) {
282 ret = -1; 282 ret = -1;
283 goto end; 283 goto end;
284 } 284 }
@@ -335,7 +335,7 @@ dtls1_accept(SSL *s)
335 s->s3->tmp.next_state = SSL3_ST_SR_CLNT_HELLO_A; 335 s->s3->tmp.next_state = SSL3_ST_SR_CLNT_HELLO_A;
336 336
337 /* HelloVerifyRequest resets Finished MAC */ 337 /* HelloVerifyRequest resets Finished MAC */
338 if (!ssl3_init_finished_mac(s)) { 338 if (!tls1_init_finished_mac(s)) {
339 ret = -1; 339 ret = -1;
340 goto end; 340 goto end;
341 } 341 }
@@ -602,7 +602,7 @@ dtls1_accept(SSL *s)
602 602
603 case SSL_ST_OK: 603 case SSL_ST_OK:
604 /* clean a few things up */ 604 /* clean a few things up */
605 ssl3_cleanup_key_block(s); 605 tls1_cleanup_key_block(s);
606 606
607 /* remove buffering on output */ 607 /* remove buffering on output */
608 ssl_free_wbio_buffer(s); 608 ssl_free_wbio_buffer(s);
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c
index 1078bc0155..c6920e2b34 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.45 2015/09/11 14:39:05 jsing Exp $ */ 1/* $OpenBSD: s23_clnt.c,v 1.46 2015/09/11 18:08:21 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 *
@@ -168,7 +168,7 @@ ssl23_connect(SSL *s)
168 ret = -1; 168 ret = -1;
169 goto end; 169 goto end;
170 } 170 }
171 if (!ssl3_init_finished_mac(s)) { 171 if (!tls1_init_finished_mac(s)) {
172 ret = -1; 172 ret = -1;
173 goto end; 173 goto end;
174 } 174 }
@@ -348,7 +348,7 @@ ssl23_client_hello(SSL *s)
348 s->init_num = p - buf; 348 s->init_num = p - buf;
349 s->init_off = 0; 349 s->init_off = 0;
350 350
351 ssl3_finish_mac(s, &(buf[SSL3_RT_HEADER_LENGTH]), 351 tls1_finish_mac(s, &(buf[SSL3_RT_HEADER_LENGTH]),
352 s->init_num - SSL3_RT_HEADER_LENGTH); 352 s->init_num - SSL3_RT_HEADER_LENGTH);
353 353
354 s->state = SSL23_ST_CW_CLNT_HELLO_B; 354 s->state = SSL23_ST_CW_CLNT_HELLO_B;
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c
index d0699a55d7..08b416cab8 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.44 2015/09/11 14:47:56 jsing Exp $ */ 1/* $OpenBSD: s23_srvr.c,v 1.45 2015/09/11 18:08:21 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 *
@@ -158,7 +158,7 @@ ssl23_accept(SSL *s)
158 ret = -1; 158 ret = -1;
159 goto end; 159 goto end;
160 } 160 }
161 if (!ssl3_init_finished_mac(s)) { 161 if (!tls1_init_finished_mac(s)) {
162 ret = -1; 162 ret = -1;
163 goto end; 163 goto end;
164 } 164 }
@@ -383,7 +383,7 @@ ssl23_get_client_hello(SSL *s)
383 if (j != n + 2) 383 if (j != n + 2)
384 return -1; 384 return -1;
385 385
386 ssl3_finish_mac(s, s->packet + 2, s->packet_length - 2); 386 tls1_finish_mac(s, s->packet + 2, s->packet_length - 2);
387 if (s->msg_callback) 387 if (s->msg_callback)
388 s->msg_callback(0, SSL2_VERSION, 0, s->packet + 2, 388 s->msg_callback(0, SSL2_VERSION, 0, s->packet + 2,
389 s->packet_length - 2, s, s->msg_callback_arg); 389 s->packet_length - 2, s, s->msg_callback_arg);
diff --git a/src/lib/libssl/src/ssl/s3_both.c b/src/lib/libssl/src/ssl/s3_both.c
index cd8afd1946..49b1e50659 100644
--- a/src/lib/libssl/src/ssl/s3_both.c
+++ b/src/lib/libssl/src/ssl/s3_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_both.c,v 1.46 2015/09/11 16:41:05 jsing Exp $ */ 1/* $OpenBSD: s3_both.c,v 1.47 2015/09/11 18:08:21 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 *
@@ -146,7 +146,7 @@ ssl3_do_write(SSL *s, int type)
146 * Should not be done for 'Hello Request's, but in that case 146 * Should not be done for 'Hello Request's, but in that case
147 * we'll ignore the result anyway. 147 * we'll ignore the result anyway.
148 */ 148 */
149 ssl3_finish_mac(s, 149 tls1_finish_mac(s,
150 (unsigned char *)&s->init_buf->data[s->init_off], ret); 150 (unsigned char *)&s->init_buf->data[s->init_off], ret);
151 151
152 if (ret == s->init_num) { 152 if (ret == s->init_num) {
@@ -524,7 +524,7 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
524 ssl3_take_mac(s); 524 ssl3_take_mac(s);
525 525
526 /* Feed this message into MAC computation. */ 526 /* Feed this message into MAC computation. */
527 ssl3_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4); 527 tls1_finish_mac(s, (unsigned char *)s->init_buf->data, s->init_num + 4);
528 if (s->msg_callback) 528 if (s->msg_callback)
529 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, 529 s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE,
530 s->init_buf->data, (size_t)s->init_num + 4, s, 530 s->init_buf->data, (size_t)s->init_num + 4, s,
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c
index e4ce8163ac..eed359450f 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.126 2015/09/10 15:56:26 jsing Exp $ */ 1/* $OpenBSD: s3_clnt.c,v 1.127 2015/09/11 18:08:21 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 *
@@ -234,7 +234,7 @@ ssl3_connect(SSL *s)
234 234
235 /* don't push the buffering BIO quite yet */ 235 /* don't push the buffering BIO quite yet */
236 236
237 if (!ssl3_init_finished_mac(s)) { 237 if (!tls1_init_finished_mac(s)) {
238 ret = -1; 238 ret = -1;
239 goto end; 239 goto end;
240 } 240 }
@@ -517,7 +517,7 @@ ssl3_connect(SSL *s)
517 517
518 case SSL_ST_OK: 518 case SSL_ST_OK:
519 /* clean a few things up */ 519 /* clean a few things up */
520 ssl3_cleanup_key_block(s); 520 tls1_cleanup_key_block(s);
521 521
522 if (s->init_buf != NULL) { 522 if (s->init_buf != NULL) {
523 BUF_MEM_free(s->init_buf); 523 BUF_MEM_free(s->init_buf);
@@ -885,7 +885,7 @@ ssl3_get_server_hello(SSL *s)
885 */ 885 */
886 alg_k = s->s3->tmp.new_cipher->algorithm_mkey; 886 alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
887 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) && 887 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) &&
888 !ssl3_digest_cached_records(s)) { 888 !tls1_digest_cached_records(s)) {
889 al = SSL_AD_INTERNAL_ERROR; 889 al = SSL_AD_INTERNAL_ERROR;
890 goto f_err; 890 goto f_err;
891 } 891 }
@@ -1524,7 +1524,7 @@ ssl3_get_certificate_request(SSL *s)
1524 * as we wont be doing client auth. 1524 * as we wont be doing client auth.
1525 */ 1525 */
1526 if (s->s3->handshake_buffer) { 1526 if (s->s3->handshake_buffer) {
1527 if (!ssl3_digest_cached_records(s)) 1527 if (!tls1_digest_cached_records(s))
1528 goto err; 1528 goto err;
1529 } 1529 }
1530 return (1); 1530 return (1);
@@ -2309,7 +2309,7 @@ ssl3_send_client_verify(SSL *s)
2309 } 2309 }
2310 s2n(u, p); 2310 s2n(u, p);
2311 n = u + 4; 2311 n = u + 4;
2312 if (!ssl3_digest_cached_records(s)) 2312 if (!tls1_digest_cached_records(s))
2313 goto err; 2313 goto err;
2314 } else if (pkey->type == EVP_PKEY_RSA) { 2314 } else if (pkey->type == EVP_PKEY_RSA) {
2315 s->method->ssl3_enc->cert_verify_mac( 2315 s->method->ssl3_enc->cert_verify_mac(
@@ -2381,7 +2381,7 @@ ssl3_send_client_verify(SSL *s)
2381 ERR_R_EVP_LIB); 2381 ERR_R_EVP_LIB);
2382 goto err; 2382 goto err;
2383 } 2383 }
2384 if (!ssl3_digest_cached_records(s)) 2384 if (!tls1_digest_cached_records(s))
2385 goto err; 2385 goto err;
2386 j = sigsize; 2386 j = sigsize;
2387 s2n(j, p); 2387 s2n(j, p);
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c
index 984e343c95..1a619e3d30 100644
--- a/src/lib/libssl/src/ssl/s3_lib.c
+++ b/src/lib/libssl/src/ssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.103 2015/09/11 17:32:23 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.104 2015/09/11 18:08:21 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 *
@@ -2023,7 +2023,7 @@ ssl3_free(SSL *s)
2023 if (s == NULL) 2023 if (s == NULL)
2024 return; 2024 return;
2025 2025
2026 ssl3_cleanup_key_block(s); 2026 tls1_cleanup_key_block(s);
2027 ssl3_release_read_buffer(s); 2027 ssl3_release_read_buffer(s);
2028 ssl3_release_write_buffer(s); 2028 ssl3_release_write_buffer(s);
2029 2029
@@ -2033,7 +2033,7 @@ ssl3_free(SSL *s)
2033 if (s->s3->tmp.ca_names != NULL) 2033 if (s->s3->tmp.ca_names != NULL)
2034 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); 2034 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
2035 BIO_free(s->s3->handshake_buffer); 2035 BIO_free(s->s3->handshake_buffer);
2036 ssl3_free_digest_list(s); 2036 tls1_free_digest_list(s);
2037 free(s->s3->alpn_selected); 2037 free(s->s3->alpn_selected);
2038 2038
2039 explicit_bzero(s->s3, sizeof *s->s3); 2039 explicit_bzero(s->s3, sizeof *s->s3);
@@ -2047,7 +2047,7 @@ ssl3_clear(SSL *s)
2047 unsigned char *rp, *wp; 2047 unsigned char *rp, *wp;
2048 size_t rlen, wlen; 2048 size_t rlen, wlen;
2049 2049
2050 ssl3_cleanup_key_block(s); 2050 tls1_cleanup_key_block(s);
2051 if (s->s3->tmp.ca_names != NULL) 2051 if (s->s3->tmp.ca_names != NULL)
2052 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free); 2052 sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
2053 2053
@@ -2064,7 +2064,7 @@ ssl3_clear(SSL *s)
2064 BIO_free(s->s3->handshake_buffer); 2064 BIO_free(s->s3->handshake_buffer);
2065 s->s3->handshake_buffer = NULL; 2065 s->s3->handshake_buffer = NULL;
2066 2066
2067 ssl3_free_digest_list(s); 2067 tls1_free_digest_list(s);
2068 2068
2069 free(s->s3->alpn_selected); 2069 free(s->s3->alpn_selected);
2070 s->s3->alpn_selected = NULL; 2070 s->s3->alpn_selected = NULL;
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c
index 4bbc160d58..da7f6d71cd 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.117 2015/09/10 17:57:50 jsing Exp $ */ 1/* $OpenBSD: s3_srvr.c,v 1.118 2015/09/11 18:08:21 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 *
@@ -239,7 +239,7 @@ ssl3_accept(SSL *s)
239 goto end; 239 goto end;
240 } 240 }
241 241
242 if (!ssl3_init_finished_mac(s)) { 242 if (!tls1_init_finished_mac(s)) {
243 ret = -1; 243 ret = -1;
244 goto end; 244 goto end;
245 } 245 }
@@ -279,7 +279,7 @@ ssl3_accept(SSL *s)
279 s->state = SSL3_ST_SW_FLUSH; 279 s->state = SSL3_ST_SW_FLUSH;
280 s->init_num = 0; 280 s->init_num = 0;
281 281
282 if (!ssl3_init_finished_mac(s)) { 282 if (!tls1_init_finished_mac(s)) {
283 ret = -1; 283 ret = -1;
284 goto end; 284 goto end;
285 } 285 }
@@ -393,7 +393,7 @@ ssl3_accept(SSL *s)
393 s->s3->tmp.cert_request = 0; 393 s->s3->tmp.cert_request = 0;
394 s->state = SSL3_ST_SW_SRVR_DONE_A; 394 s->state = SSL3_ST_SW_SRVR_DONE_A;
395 if (s->s3->handshake_buffer) 395 if (s->s3->handshake_buffer)
396 if (!ssl3_digest_cached_records(s)) 396 if (!tls1_digest_cached_records(s))
397 return (-1); 397 return (-1);
398 } else { 398 } else {
399 s->s3->tmp.cert_request = 1; 399 s->s3->tmp.cert_request = 1;
@@ -485,7 +485,7 @@ ssl3_accept(SSL *s)
485 return (-1); 485 return (-1);
486 } 486 }
487 s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE; 487 s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE;
488 if (!ssl3_digest_cached_records(s)) 488 if (!tls1_digest_cached_records(s))
489 return (-1); 489 return (-1);
490 } else { 490 } else {
491 int offset = 0; 491 int offset = 0;
@@ -502,7 +502,7 @@ ssl3_accept(SSL *s)
502 * But it is next step 502 * But it is next step
503 */ 503 */
504 if (s->s3->handshake_buffer) 504 if (s->s3->handshake_buffer)
505 if (!ssl3_digest_cached_records(s)) 505 if (!tls1_digest_cached_records(s))
506 return (-1); 506 return (-1);
507 for (dgst_num = 0; dgst_num < SSL_MAX_DIGEST; 507 for (dgst_num = 0; dgst_num < SSL_MAX_DIGEST;
508 dgst_num++) 508 dgst_num++)
@@ -633,7 +633,7 @@ ssl3_accept(SSL *s)
633 633
634 case SSL_ST_OK: 634 case SSL_ST_OK:
635 /* clean a few things up */ 635 /* clean a few things up */
636 ssl3_cleanup_key_block(s); 636 tls1_cleanup_key_block(s);
637 637
638 BUF_MEM_free(s->init_buf); 638 BUF_MEM_free(s->init_buf);
639 s->init_buf = NULL; 639 s->init_buf = NULL;
@@ -1035,7 +1035,7 @@ ssl3_get_client_hello(SSL *s)
1035 alg_k = s->s3->tmp.new_cipher->algorithm_mkey; 1035 alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
1036 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) || 1036 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) ||
1037 !(s->verify_mode & SSL_VERIFY_PEER)) { 1037 !(s->verify_mode & SSL_VERIFY_PEER)) {
1038 if (!ssl3_digest_cached_records(s)) { 1038 if (!tls1_digest_cached_records(s)) {
1039 al = SSL_AD_INTERNAL_ERROR; 1039 al = SSL_AD_INTERNAL_ERROR;
1040 goto f_err; 1040 goto f_err;
1041 } 1041 }
@@ -2384,7 +2384,7 @@ ssl3_get_client_certificate(SSL *s)
2384 goto f_err; 2384 goto f_err;
2385 } 2385 }
2386 /* No client certificate so digest cached records */ 2386 /* No client certificate so digest cached records */
2387 if (s->s3->handshake_buffer && !ssl3_digest_cached_records(s)) { 2387 if (s->s3->handshake_buffer && !tls1_digest_cached_records(s)) {
2388 al = SSL_AD_INTERNAL_ERROR; 2388 al = SSL_AD_INTERNAL_ERROR;
2389 goto f_err; 2389 goto f_err;
2390 } 2390 }
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h
index 976bd27618..f9be29b241 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.118 2015/09/11 17:37:47 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.119 2015/09/11 18:08:21 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 *
@@ -595,13 +595,11 @@ void ssl_load_ciphers(void);
595 595
596const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 596const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
597int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); 597int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
598int ssl3_init_finished_mac(SSL *s);
599int ssl3_send_server_certificate(SSL *s); 598int ssl3_send_server_certificate(SSL *s);
600int ssl3_send_newsession_ticket(SSL *s); 599int ssl3_send_newsession_ticket(SSL *s);
601int ssl3_send_cert_status(SSL *s); 600int ssl3_send_cert_status(SSL *s);
602int ssl3_get_finished(SSL *s, int state_a, int state_b); 601int ssl3_get_finished(SSL *s, int state_a, int state_b);
603int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b); 602int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
604void ssl3_cleanup_key_block(SSL *s);
605int ssl3_do_write(SSL *s, int type); 603int ssl3_do_write(SSL *s, int type);
606int ssl3_send_alert(SSL *s, int level, int desc); 604int ssl3_send_alert(SSL *s, int level, int desc);
607int ssl3_get_req_cert_type(SSL *s, unsigned char *p); 605int ssl3_get_req_cert_type(SSL *s, unsigned char *p);
@@ -619,8 +617,6 @@ int ssl3_renegotiate_check(SSL *ssl);
619int ssl3_dispatch_alert(SSL *s); 617int ssl3_dispatch_alert(SSL *s);
620int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 618int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
621int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 619int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
622void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
623void ssl3_free_digest_list(SSL *s);
624unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 620unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
625SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, 621SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
626 STACK_OF(SSL_CIPHER) *srvr); 622 STACK_OF(SSL_CIPHER) *srvr);
@@ -630,7 +626,6 @@ int ssl3_setup_read_buffer(SSL *s);
630int ssl3_setup_write_buffer(SSL *s); 626int ssl3_setup_write_buffer(SSL *s);
631int ssl3_release_read_buffer(SSL *s); 627int ssl3_release_read_buffer(SSL *s);
632int ssl3_release_write_buffer(SSL *s); 628int ssl3_release_write_buffer(SSL *s);
633int ssl3_digest_cached_records(SSL *s);
634int ssl3_new(SSL *s); 629int ssl3_new(SSL *s);
635void ssl3_free(SSL *s); 630void ssl3_free(SSL *s);
636int ssl3_accept(SSL *s); 631int ssl3_accept(SSL *s);
@@ -650,7 +645,7 @@ unsigned char *ssl3_handshake_msg_start(SSL *s, uint8_t htype);
650void ssl3_handshake_msg_finish(SSL *s, unsigned int len); 645void ssl3_handshake_msg_finish(SSL *s, unsigned int len);
651int ssl3_handshake_write(SSL *s); 646int ssl3_handshake_write(SSL *s);
652 647
653void ssl3_record_sequence_increment(unsigned char *seq); 648void tls1_record_sequence_increment(unsigned char *seq);
654int ssl3_do_change_cipher_spec(SSL *ssl); 649int ssl3_do_change_cipher_spec(SSL *ssl);
655 650
656int ssl23_read(SSL *s, void *buf, int len); 651int ssl23_read(SSL *s, void *buf, int len);
@@ -767,6 +762,11 @@ int dtls1_enc(SSL *s, int snd);
767int ssl_init_wbio_buffer(SSL *s, int push); 762int ssl_init_wbio_buffer(SSL *s, int push);
768void ssl_free_wbio_buffer(SSL *s); 763void ssl_free_wbio_buffer(SSL *s);
769 764
765int tls1_init_finished_mac(SSL *s);
766void tls1_finish_mac(SSL *s, const unsigned char *buf, int len);
767void tls1_free_digest_list(SSL *s);
768void tls1_cleanup_key_block(SSL *s);
769int tls1_digest_cached_records(SSL *s);
770int tls1_change_cipher_state(SSL *s, int which); 770int tls1_change_cipher_state(SSL *s, int which);
771int tls1_setup_key_block(SSL *s); 771int tls1_setup_key_block(SSL *s);
772int tls1_enc(SSL *s, int snd); 772int tls1_enc(SSL *s, int snd);
diff --git a/src/lib/libssl/src/ssl/t1_enc.c b/src/lib/libssl/src/ssl/t1_enc.c
index 892fc31796..1c96abb378 100644
--- a/src/lib/libssl/src/ssl/t1_enc.c
+++ b/src/lib/libssl/src/ssl/t1_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_enc.c,v 1.82 2015/09/11 17:54:23 jsing Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.83 2015/09/11 18:08:21 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 *
@@ -144,7 +144,7 @@
144#include <openssl/md5.h> 144#include <openssl/md5.h>
145 145
146void 146void
147ssl3_cleanup_key_block(SSL *s) 147tls1_cleanup_key_block(SSL *s)
148{ 148{
149 if (s->s3->tmp.key_block != NULL) { 149 if (s->s3->tmp.key_block != NULL) {
150 explicit_bzero(s->s3->tmp.key_block, 150 explicit_bzero(s->s3->tmp.key_block,
@@ -156,10 +156,10 @@ ssl3_cleanup_key_block(SSL *s)
156} 156}
157 157
158int 158int
159ssl3_init_finished_mac(SSL *s) 159tls1_init_finished_mac(SSL *s)
160{ 160{
161 BIO_free(s->s3->handshake_buffer); 161 BIO_free(s->s3->handshake_buffer);
162 ssl3_free_digest_list(s); 162 tls1_free_digest_list(s);
163 163
164 s->s3->handshake_buffer = BIO_new(BIO_s_mem()); 164 s->s3->handshake_buffer = BIO_new(BIO_s_mem());
165 if (s->s3->handshake_buffer == NULL) 165 if (s->s3->handshake_buffer == NULL)
@@ -171,7 +171,7 @@ ssl3_init_finished_mac(SSL *s)
171} 171}
172 172
173void 173void
174ssl3_free_digest_list(SSL *s) 174tls1_free_digest_list(SSL *s)
175{ 175{
176 int i; 176 int i;
177 177
@@ -189,7 +189,7 @@ ssl3_free_digest_list(SSL *s)
189} 189}
190 190
191void 191void
192ssl3_finish_mac(SSL *s, const unsigned char *buf, int len) 192tls1_finish_mac(SSL *s, const unsigned char *buf, int len)
193{ 193{
194 if (s->s3->handshake_buffer && 194 if (s->s3->handshake_buffer &&
195 !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) { 195 !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) {
@@ -204,7 +204,7 @@ ssl3_finish_mac(SSL *s, const unsigned char *buf, int len)
204} 204}
205 205
206int 206int
207ssl3_digest_cached_records(SSL *s) 207tls1_digest_cached_records(SSL *s)
208{ 208{
209 int i; 209 int i;
210 long mask; 210 long mask;
@@ -212,7 +212,7 @@ ssl3_digest_cached_records(SSL *s)
212 long hdatalen; 212 long hdatalen;
213 void *hdata; 213 void *hdata;
214 214
215 ssl3_free_digest_list(s); 215 tls1_free_digest_list(s);
216 216
217 s->s3->handshake_dgst = calloc(SSL_MAX_DIGEST, sizeof(EVP_MD_CTX *)); 217 s->s3->handshake_dgst = calloc(SSL_MAX_DIGEST, sizeof(EVP_MD_CTX *));
218 if (s->s3->handshake_dgst == NULL) { 218 if (s->s3->handshake_dgst == NULL) {
@@ -255,7 +255,7 @@ ssl3_digest_cached_records(SSL *s)
255} 255}
256 256
257void 257void
258ssl3_record_sequence_increment(unsigned char *seq) 258tls1_record_sequence_increment(unsigned char *seq)
259{ 259{
260 int i; 260 int i;
261 261
@@ -738,7 +738,7 @@ tls1_setup_key_block(SSL *s)
738 s->s3->tmp.new_mac_pkey_type = mac_type; 738 s->s3->tmp.new_mac_pkey_type = mac_type;
739 s->s3->tmp.new_mac_secret_size = mac_secret_size; 739 s->s3->tmp.new_mac_secret_size = mac_secret_size;
740 740
741 ssl3_cleanup_key_block(s); 741 tls1_cleanup_key_block(s);
742 742
743 if ((key_block = reallocarray(NULL, mac_secret_size + key_len + iv_len, 743 if ((key_block = reallocarray(NULL, mac_secret_size + key_len + iv_len,
744 2)) == NULL) { 744 2)) == NULL) {
@@ -827,7 +827,7 @@ tls1_enc(SSL *s, int send)
827 send ? s->d1->w_epoch : s->d1->r_epoch); 827 send ? s->d1->w_epoch : s->d1->r_epoch);
828 } else { 828 } else {
829 memcpy(ad, seq, SSL3_SEQUENCE_SIZE); 829 memcpy(ad, seq, SSL3_SEQUENCE_SIZE);
830 ssl3_record_sequence_increment(seq); 830 tls1_record_sequence_increment(seq);
831 } 831 }
832 832
833 ad[8] = rec->type; 833 ad[8] = rec->type;
@@ -975,7 +975,7 @@ tls1_enc(SSL *s, int send)
975 send ? s->d1->w_epoch : s->d1->r_epoch); 975 send ? s->d1->w_epoch : s->d1->r_epoch);
976 } else { 976 } else {
977 memcpy(buf, seq, SSL3_SEQUENCE_SIZE); 977 memcpy(buf, seq, SSL3_SEQUENCE_SIZE);
978 ssl3_record_sequence_increment(seq); 978 tls1_record_sequence_increment(seq);
979 } 979 }
980 980
981 buf[8] = rec->type; 981 buf[8] = rec->type;
@@ -1035,7 +1035,7 @@ tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out)
1035 int i; 1035 int i;
1036 1036
1037 if (s->s3->handshake_buffer) 1037 if (s->s3->handshake_buffer)
1038 if (!ssl3_digest_cached_records(s)) 1038 if (!tls1_digest_cached_records(s))
1039 return 0; 1039 return 0;
1040 1040
1041 for (i = 0; i < SSL_MAX_DIGEST; i++) { 1041 for (i = 0; i < SSL_MAX_DIGEST; i++) {
@@ -1074,7 +1074,7 @@ tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *out)
1074 q = buf; 1074 q = buf;
1075 1075
1076 if (s->s3->handshake_buffer) 1076 if (s->s3->handshake_buffer)
1077 if (!ssl3_digest_cached_records(s)) 1077 if (!tls1_digest_cached_records(s))
1078 return 0; 1078 return 0;
1079 1079
1080 EVP_MD_CTX_init(&ctx); 1080 EVP_MD_CTX_init(&ctx);
@@ -1188,7 +1188,7 @@ tls1_mac(SSL *ssl, unsigned char *md, int send)
1188 EVP_MD_CTX_cleanup(&hmac); 1188 EVP_MD_CTX_cleanup(&hmac);
1189 1189
1190 if (!SSL_IS_DTLS(ssl)) 1190 if (!SSL_IS_DTLS(ssl))
1191 ssl3_record_sequence_increment(seq); 1191 tls1_record_sequence_increment(seq);
1192 1192
1193 return (md_size); 1193 return (md_size);
1194} 1194}
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 976bd27618..f9be29b241 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.118 2015/09/11 17:37:47 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.119 2015/09/11 18:08:21 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 *
@@ -595,13 +595,11 @@ void ssl_load_ciphers(void);
595 595
596const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); 596const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
597int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); 597int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
598int ssl3_init_finished_mac(SSL *s);
599int ssl3_send_server_certificate(SSL *s); 598int ssl3_send_server_certificate(SSL *s);
600int ssl3_send_newsession_ticket(SSL *s); 599int ssl3_send_newsession_ticket(SSL *s);
601int ssl3_send_cert_status(SSL *s); 600int ssl3_send_cert_status(SSL *s);
602int ssl3_get_finished(SSL *s, int state_a, int state_b); 601int ssl3_get_finished(SSL *s, int state_a, int state_b);
603int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b); 602int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b);
604void ssl3_cleanup_key_block(SSL *s);
605int ssl3_do_write(SSL *s, int type); 603int ssl3_do_write(SSL *s, int type);
606int ssl3_send_alert(SSL *s, int level, int desc); 604int ssl3_send_alert(SSL *s, int level, int desc);
607int ssl3_get_req_cert_type(SSL *s, unsigned char *p); 605int ssl3_get_req_cert_type(SSL *s, unsigned char *p);
@@ -619,8 +617,6 @@ int ssl3_renegotiate_check(SSL *ssl);
619int ssl3_dispatch_alert(SSL *s); 617int ssl3_dispatch_alert(SSL *s);
620int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); 618int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
621int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); 619int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
622void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
623void ssl3_free_digest_list(SSL *s);
624unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); 620unsigned long ssl3_output_cert_chain(SSL *s, X509 *x);
625SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, 621SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt,
626 STACK_OF(SSL_CIPHER) *srvr); 622 STACK_OF(SSL_CIPHER) *srvr);
@@ -630,7 +626,6 @@ int ssl3_setup_read_buffer(SSL *s);
630int ssl3_setup_write_buffer(SSL *s); 626int ssl3_setup_write_buffer(SSL *s);
631int ssl3_release_read_buffer(SSL *s); 627int ssl3_release_read_buffer(SSL *s);
632int ssl3_release_write_buffer(SSL *s); 628int ssl3_release_write_buffer(SSL *s);
633int ssl3_digest_cached_records(SSL *s);
634int ssl3_new(SSL *s); 629int ssl3_new(SSL *s);
635void ssl3_free(SSL *s); 630void ssl3_free(SSL *s);
636int ssl3_accept(SSL *s); 631int ssl3_accept(SSL *s);
@@ -650,7 +645,7 @@ unsigned char *ssl3_handshake_msg_start(SSL *s, uint8_t htype);
650void ssl3_handshake_msg_finish(SSL *s, unsigned int len); 645void ssl3_handshake_msg_finish(SSL *s, unsigned int len);
651int ssl3_handshake_write(SSL *s); 646int ssl3_handshake_write(SSL *s);
652 647
653void ssl3_record_sequence_increment(unsigned char *seq); 648void tls1_record_sequence_increment(unsigned char *seq);
654int ssl3_do_change_cipher_spec(SSL *ssl); 649int ssl3_do_change_cipher_spec(SSL *ssl);
655 650
656int ssl23_read(SSL *s, void *buf, int len); 651int ssl23_read(SSL *s, void *buf, int len);
@@ -767,6 +762,11 @@ int dtls1_enc(SSL *s, int snd);
767int ssl_init_wbio_buffer(SSL *s, int push); 762int ssl_init_wbio_buffer(SSL *s, int push);
768void ssl_free_wbio_buffer(SSL *s); 763void ssl_free_wbio_buffer(SSL *s);
769 764
765int tls1_init_finished_mac(SSL *s);
766void tls1_finish_mac(SSL *s, const unsigned char *buf, int len);
767void tls1_free_digest_list(SSL *s);
768void tls1_cleanup_key_block(SSL *s);
769int tls1_digest_cached_records(SSL *s);
770int tls1_change_cipher_state(SSL *s, int which); 770int tls1_change_cipher_state(SSL *s, int which);
771int tls1_setup_key_block(SSL *s); 771int tls1_setup_key_block(SSL *s);
772int tls1_enc(SSL *s, int snd); 772int tls1_enc(SSL *s, int snd);
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c
index 892fc31796..1c96abb378 100644
--- a/src/lib/libssl/t1_enc.c
+++ b/src/lib/libssl/t1_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_enc.c,v 1.82 2015/09/11 17:54:23 jsing Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.83 2015/09/11 18:08:21 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 *
@@ -144,7 +144,7 @@
144#include <openssl/md5.h> 144#include <openssl/md5.h>
145 145
146void 146void
147ssl3_cleanup_key_block(SSL *s) 147tls1_cleanup_key_block(SSL *s)
148{ 148{
149 if (s->s3->tmp.key_block != NULL) { 149 if (s->s3->tmp.key_block != NULL) {
150 explicit_bzero(s->s3->tmp.key_block, 150 explicit_bzero(s->s3->tmp.key_block,
@@ -156,10 +156,10 @@ ssl3_cleanup_key_block(SSL *s)
156} 156}
157 157
158int 158int
159ssl3_init_finished_mac(SSL *s) 159tls1_init_finished_mac(SSL *s)
160{ 160{
161 BIO_free(s->s3->handshake_buffer); 161 BIO_free(s->s3->handshake_buffer);
162 ssl3_free_digest_list(s); 162 tls1_free_digest_list(s);
163 163
164 s->s3->handshake_buffer = BIO_new(BIO_s_mem()); 164 s->s3->handshake_buffer = BIO_new(BIO_s_mem());
165 if (s->s3->handshake_buffer == NULL) 165 if (s->s3->handshake_buffer == NULL)
@@ -171,7 +171,7 @@ ssl3_init_finished_mac(SSL *s)
171} 171}
172 172
173void 173void
174ssl3_free_digest_list(SSL *s) 174tls1_free_digest_list(SSL *s)
175{ 175{
176 int i; 176 int i;
177 177
@@ -189,7 +189,7 @@ ssl3_free_digest_list(SSL *s)
189} 189}
190 190
191void 191void
192ssl3_finish_mac(SSL *s, const unsigned char *buf, int len) 192tls1_finish_mac(SSL *s, const unsigned char *buf, int len)
193{ 193{
194 if (s->s3->handshake_buffer && 194 if (s->s3->handshake_buffer &&
195 !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) { 195 !(s->s3->flags & TLS1_FLAGS_KEEP_HANDSHAKE)) {
@@ -204,7 +204,7 @@ ssl3_finish_mac(SSL *s, const unsigned char *buf, int len)
204} 204}
205 205
206int 206int
207ssl3_digest_cached_records(SSL *s) 207tls1_digest_cached_records(SSL *s)
208{ 208{
209 int i; 209 int i;
210 long mask; 210 long mask;
@@ -212,7 +212,7 @@ ssl3_digest_cached_records(SSL *s)
212 long hdatalen; 212 long hdatalen;
213 void *hdata; 213 void *hdata;
214 214
215 ssl3_free_digest_list(s); 215 tls1_free_digest_list(s);
216 216
217 s->s3->handshake_dgst = calloc(SSL_MAX_DIGEST, sizeof(EVP_MD_CTX *)); 217 s->s3->handshake_dgst = calloc(SSL_MAX_DIGEST, sizeof(EVP_MD_CTX *));
218 if (s->s3->handshake_dgst == NULL) { 218 if (s->s3->handshake_dgst == NULL) {
@@ -255,7 +255,7 @@ ssl3_digest_cached_records(SSL *s)
255} 255}
256 256
257void 257void
258ssl3_record_sequence_increment(unsigned char *seq) 258tls1_record_sequence_increment(unsigned char *seq)
259{ 259{
260 int i; 260 int i;
261 261
@@ -738,7 +738,7 @@ tls1_setup_key_block(SSL *s)
738 s->s3->tmp.new_mac_pkey_type = mac_type; 738 s->s3->tmp.new_mac_pkey_type = mac_type;
739 s->s3->tmp.new_mac_secret_size = mac_secret_size; 739 s->s3->tmp.new_mac_secret_size = mac_secret_size;
740 740
741 ssl3_cleanup_key_block(s); 741 tls1_cleanup_key_block(s);
742 742
743 if ((key_block = reallocarray(NULL, mac_secret_size + key_len + iv_len, 743 if ((key_block = reallocarray(NULL, mac_secret_size + key_len + iv_len,
744 2)) == NULL) { 744 2)) == NULL) {
@@ -827,7 +827,7 @@ tls1_enc(SSL *s, int send)
827 send ? s->d1->w_epoch : s->d1->r_epoch); 827 send ? s->d1->w_epoch : s->d1->r_epoch);
828 } else { 828 } else {
829 memcpy(ad, seq, SSL3_SEQUENCE_SIZE); 829 memcpy(ad, seq, SSL3_SEQUENCE_SIZE);
830 ssl3_record_sequence_increment(seq); 830 tls1_record_sequence_increment(seq);
831 } 831 }
832 832
833 ad[8] = rec->type; 833 ad[8] = rec->type;
@@ -975,7 +975,7 @@ tls1_enc(SSL *s, int send)
975 send ? s->d1->w_epoch : s->d1->r_epoch); 975 send ? s->d1->w_epoch : s->d1->r_epoch);
976 } else { 976 } else {
977 memcpy(buf, seq, SSL3_SEQUENCE_SIZE); 977 memcpy(buf, seq, SSL3_SEQUENCE_SIZE);
978 ssl3_record_sequence_increment(seq); 978 tls1_record_sequence_increment(seq);
979 } 979 }
980 980
981 buf[8] = rec->type; 981 buf[8] = rec->type;
@@ -1035,7 +1035,7 @@ tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out)
1035 int i; 1035 int i;
1036 1036
1037 if (s->s3->handshake_buffer) 1037 if (s->s3->handshake_buffer)
1038 if (!ssl3_digest_cached_records(s)) 1038 if (!tls1_digest_cached_records(s))
1039 return 0; 1039 return 0;
1040 1040
1041 for (i = 0; i < SSL_MAX_DIGEST; i++) { 1041 for (i = 0; i < SSL_MAX_DIGEST; i++) {
@@ -1074,7 +1074,7 @@ tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *out)
1074 q = buf; 1074 q = buf;
1075 1075
1076 if (s->s3->handshake_buffer) 1076 if (s->s3->handshake_buffer)
1077 if (!ssl3_digest_cached_records(s)) 1077 if (!tls1_digest_cached_records(s))
1078 return 0; 1078 return 0;
1079 1079
1080 EVP_MD_CTX_init(&ctx); 1080 EVP_MD_CTX_init(&ctx);
@@ -1188,7 +1188,7 @@ tls1_mac(SSL *ssl, unsigned char *md, int send)
1188 EVP_MD_CTX_cleanup(&hmac); 1188 EVP_MD_CTX_cleanup(&hmac);
1189 1189
1190 if (!SSL_IS_DTLS(ssl)) 1190 if (!SSL_IS_DTLS(ssl))
1191 ssl3_record_sequence_increment(seq); 1191 tls1_record_sequence_increment(seq);
1192 1192
1193 return (md_size); 1193 return (md_size);
1194} 1194}