summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_clnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_clnt.c')
-rw-r--r--src/lib/libssl/ssl_clnt.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c
index 865c961db7..ec4a4104fc 100644
--- a/src/lib/libssl/ssl_clnt.c
+++ b/src/lib/libssl/ssl_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_clnt.c,v 1.15 2017/08/12 02:55:22 jsing Exp $ */ 1/* $OpenBSD: ssl_clnt.c,v 1.16 2017/08/12 21:03:08 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 *
@@ -407,14 +407,11 @@ ssl3_connect(SSL *s)
407 case SSL3_ST_CW_CHANGE_A: 407 case SSL3_ST_CW_CHANGE_A:
408 case SSL3_ST_CW_CHANGE_B: 408 case SSL3_ST_CW_CHANGE_B:
409 ret = ssl3_send_change_cipher_spec(s, 409 ret = ssl3_send_change_cipher_spec(s,
410 SSL3_ST_CW_CHANGE_A, SSL3_ST_CW_CHANGE_B); 410 SSL3_ST_CW_CHANGE_A, SSL3_ST_CW_CHANGE_B);
411 if (ret <= 0) 411 if (ret <= 0)
412 goto end; 412 goto end;
413 413
414 if (S3I(s)->next_proto_neg_seen) 414 S3I(s)->hs.state = SSL3_ST_CW_FINISHED_A;
415 S3I(s)->hs.state = SSL3_ST_CW_NEXT_PROTO_A;
416 else
417 S3I(s)->hs.state = SSL3_ST_CW_FINISHED_A;
418 s->internal->init_num = 0; 415 s->internal->init_num = 0;
419 416
420 s->session->cipher = S3I(s)->hs.new_cipher; 417 s->session->cipher = S3I(s)->hs.new_cipher;
@@ -431,14 +428,6 @@ ssl3_connect(SSL *s)
431 428
432 break; 429 break;
433 430
434 case SSL3_ST_CW_NEXT_PROTO_A:
435 case SSL3_ST_CW_NEXT_PROTO_B:
436 ret = ssl3_send_next_proto(s);
437 if (ret <= 0)
438 goto end;
439 S3I(s)->hs.state = SSL3_ST_CW_FINISHED_A;
440 break;
441
442 case SSL3_ST_CW_FINISHED_A: 431 case SSL3_ST_CW_FINISHED_A:
443 case SSL3_ST_CW_FINISHED_B: 432 case SSL3_ST_CW_FINISHED_B:
444 ret = ssl3_send_finished(s, SSL3_ST_CW_FINISHED_A, 433 ret = ssl3_send_finished(s, SSL3_ST_CW_FINISHED_A,
@@ -2599,45 +2588,6 @@ err:
2599 return (0); 2588 return (0);
2600} 2589}
2601 2590
2602int
2603ssl3_send_next_proto(SSL *s)
2604{
2605 CBB cbb, nextproto, npn, padding;
2606 size_t pad_len;
2607 uint8_t *pad;
2608
2609 memset(&cbb, 0, sizeof(cbb));
2610
2611 if (S3I(s)->hs.state == SSL3_ST_CW_NEXT_PROTO_A) {
2612 pad_len = 32 - ((s->internal->next_proto_negotiated_len + 2) % 32);
2613
2614 if (!ssl3_handshake_msg_start_cbb(s, &cbb, &nextproto,
2615 SSL3_MT_NEXT_PROTO))
2616 goto err;
2617 if (!CBB_add_u8_length_prefixed(&nextproto, &npn))
2618 goto err;
2619 if (!CBB_add_bytes(&npn, s->internal->next_proto_negotiated,
2620 s->internal->next_proto_negotiated_len))
2621 goto err;
2622 if (!CBB_add_u8_length_prefixed(&nextproto, &padding))
2623 goto err;
2624 if (!CBB_add_space(&padding, &pad, pad_len))
2625 goto err;
2626 memset(pad, 0, pad_len);
2627 if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
2628 goto err;
2629
2630 S3I(s)->hs.state = SSL3_ST_CW_NEXT_PROTO_B;
2631 }
2632
2633 return (ssl3_handshake_write(s));
2634
2635 err:
2636 CBB_cleanup(&cbb);
2637
2638 return (-1);
2639}
2640
2641/* 2591/*
2642 * Check to see if handshake is full or resumed. Usually this is just a 2592 * Check to see if handshake is full or resumed. Usually this is just a
2643 * case of checking to see if a cache hit has occurred. In the case of 2593 * case of checking to see if a cache hit has occurred. In the case of