summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_pkt.c
diff options
context:
space:
mode:
authorbeck <>2017-01-23 08:48:45 +0000
committerbeck <>2017-01-23 08:48:45 +0000
commit61af17199189570a4400f2757a9e8dab4bb76d2a (patch)
treee1f210556179334ded73129e6e0733758fe22365 /src/lib/libssl/d1_pkt.c
parentc85967e4f9c3e1f3b3217545939f1d44ddf9f103 (diff)
downloadopenbsd-61af17199189570a4400f2757a9e8dab4bb76d2a.tar.gz
openbsd-61af17199189570a4400f2757a9e8dab4bb76d2a.tar.bz2
openbsd-61af17199189570a4400f2757a9e8dab4bb76d2a.zip
send state and rstate from ssl_st into internal. There are accessors
so these should not be diddled with directly ok jsing@
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
-rw-r--r--src/lib/libssl/d1_pkt.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index 2768d7ed9c..1dba3d0c4d 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.55 2017/01/23 08:08:06 beck Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.56 2017/01/23 08:48:44 beck 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.
@@ -495,7 +495,7 @@ again:
495 } 495 }
496 496
497 /* check if we have the header */ 497 /* check if we have the header */
498 if ((s->rstate != SSL_ST_READ_BODY) || 498 if ((s->internal->rstate != SSL_ST_READ_BODY) ||
499 (s->internal->packet_length < DTLS1_RT_HEADER_LENGTH)) { 499 (s->internal->packet_length < DTLS1_RT_HEADER_LENGTH)) {
500 CBS header, seq_no; 500 CBS header, seq_no;
501 uint16_t epoch, len, ssl_version; 501 uint16_t epoch, len, ssl_version;
@@ -510,7 +510,7 @@ again:
510 if (s->internal->packet_length != DTLS1_RT_HEADER_LENGTH) 510 if (s->internal->packet_length != DTLS1_RT_HEADER_LENGTH)
511 goto again; 511 goto again;
512 512
513 s->rstate = SSL_ST_READ_BODY; 513 s->internal->rstate = SSL_ST_READ_BODY;
514 514
515 CBS_init(&header, s->internal->packet, s->internal->packet_length); 515 CBS_init(&header, s->internal->packet, s->internal->packet_length);
516 516
@@ -547,11 +547,11 @@ again:
547 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) 547 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH)
548 goto again; 548 goto again;
549 549
550 /* now s->rstate == SSL_ST_READ_BODY */ 550 /* now s->internal->rstate == SSL_ST_READ_BODY */
551 p = (unsigned char *)CBS_data(&header); 551 p = (unsigned char *)CBS_data(&header);
552 } 552 }
553 553
554 /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ 554 /* s->internal->rstate == SSL_ST_READ_BODY, get and decode the data */
555 555
556 if (rr->length > s->internal->packet_length - DTLS1_RT_HEADER_LENGTH) { 556 if (rr->length > s->internal->packet_length - DTLS1_RT_HEADER_LENGTH) {
557 /* now s->internal->packet_length == DTLS1_RT_HEADER_LENGTH */ 557 /* now s->internal->packet_length == DTLS1_RT_HEADER_LENGTH */
@@ -567,7 +567,7 @@ again:
567 /* now n == rr->length, 567 /* now n == rr->length,
568 * and s->internal->packet_length == DTLS1_RT_HEADER_LENGTH + rr->length */ 568 * and s->internal->packet_length == DTLS1_RT_HEADER_LENGTH + rr->length */
569 } 569 }
570 s->rstate = SSL_ST_READ_HEADER; /* set state for later operations */ 570 s->internal->rstate = SSL_ST_READ_HEADER; /* set state for later operations */
571 571
572 /* match epochs. NULL means the packet is dropped on the floor */ 572 /* match epochs. NULL means the packet is dropped on the floor */
573 bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch); 573 bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch);
@@ -692,7 +692,7 @@ start:
692 * so process data buffered during the last handshake 692 * so process data buffered during the last handshake
693 * in advance, if any. 693 * in advance, if any.
694 */ 694 */
695 if (s->state == SSL_ST_OK && rr->length == 0) { 695 if (s->internal->state == SSL_ST_OK && rr->length == 0) {
696 pitem *item; 696 pitem *item;
697 item = pqueue_pop(D1I(s)->buffered_app_data.q); 697 item = pqueue_pop(D1I(s)->buffered_app_data.q);
698 if (item) { 698 if (item) {
@@ -709,7 +709,7 @@ start:
709 goto start; 709 goto start;
710 710
711 /* get new packet if necessary */ 711 /* get new packet if necessary */
712 if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { 712 if ((rr->length == 0) || (s->internal->rstate == SSL_ST_READ_BODY)) {
713 ret = dtls1_get_record(s); 713 ret = dtls1_get_record(s);
714 if (ret <= 0) { 714 if (ret <= 0) {
715 ret = dtls1_read_failed(s, ret); 715 ret = dtls1_read_failed(s, ret);
@@ -778,7 +778,7 @@ start:
778 rr->length -= n; 778 rr->length -= n;
779 rr->off += n; 779 rr->off += n;
780 if (rr->length == 0) { 780 if (rr->length == 0) {
781 s->rstate = SSL_ST_READ_HEADER; 781 s->internal->rstate = SSL_ST_READ_HEADER;
782 rr->off = 0; 782 rr->off = 0;
783 } 783 }
784 } 784 }
@@ -840,7 +840,7 @@ start:
840 */ 840 */
841 FIX ME 841 FIX ME
842#endif 842#endif
843 s->rstate = SSL_ST_READ_HEADER; 843 s->internal->rstate = SSL_ST_READ_HEADER;
844 rr->length = 0; 844 rr->length = 0;
845 goto start; 845 goto start;
846 } 846 }
@@ -1035,9 +1035,9 @@ start:
1035 goto start; 1035 goto start;
1036 } 1036 }
1037 1037
1038 if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && 1038 if (((s->internal->state&SSL_ST_MASK) == SSL_ST_OK) &&
1039 !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { 1039 !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) {
1040 s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; 1040 s->internal->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT;
1041 s->internal->renegotiate = 1; 1041 s->internal->renegotiate = 1;
1042 s->internal->new_session = 1; 1042 s->internal->new_session = 1;
1043 } 1043 }
@@ -1096,12 +1096,12 @@ start:
1096 */ 1096 */
1097 if (S3I(s)->in_read_app_data && 1097 if (S3I(s)->in_read_app_data &&
1098 (S3I(s)->total_renegotiations != 0) && 1098 (S3I(s)->total_renegotiations != 0) &&
1099 (((s->state & SSL_ST_CONNECT) && 1099 (((s->internal->state & SSL_ST_CONNECT) &&
1100 (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && 1100 (s->internal->state >= SSL3_ST_CW_CLNT_HELLO_A) &&
1101 (s->state <= SSL3_ST_CR_SRVR_HELLO_A)) || ( 1101 (s->internal->state <= SSL3_ST_CR_SRVR_HELLO_A)) || (
1102 (s->state & SSL_ST_ACCEPT) && 1102 (s->internal->state & SSL_ST_ACCEPT) &&
1103 (s->state <= SSL3_ST_SW_HELLO_REQ_A) && 1103 (s->internal->state <= SSL3_ST_SW_HELLO_REQ_A) &&
1104 (s->state >= SSL3_ST_SR_CLNT_HELLO_A)))) { 1104 (s->internal->state >= SSL3_ST_SR_CLNT_HELLO_A)))) {
1105 S3I(s)->in_read_app_data = 2; 1105 S3I(s)->in_read_app_data = 2;
1106 return (-1); 1106 return (-1);
1107 } else { 1107 } else {