diff options
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 377696deac..b2765ba801 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
@@ -811,6 +811,14 @@ start: | |||
811 | * may be fragmented--don't always expect dest_maxlen bytes */ | 811 | * may be fragmented--don't always expect dest_maxlen bytes */ |
812 | if ( rr->length < dest_maxlen) | 812 | if ( rr->length < dest_maxlen) |
813 | { | 813 | { |
814 | #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE | ||
815 | /* | ||
816 | * for normal alerts rr->length is 2, while | ||
817 | * dest_maxlen is 7 if we were to handle this | ||
818 | * non-existing alert... | ||
819 | */ | ||
820 | FIX ME | ||
821 | #endif | ||
814 | s->rstate=SSL_ST_READ_HEADER; | 822 | s->rstate=SSL_ST_READ_HEADER; |
815 | rr->length = 0; | 823 | rr->length = 0; |
816 | goto start; | 824 | goto start; |
@@ -1251,7 +1259,7 @@ int dtls1_write_bytes(SSL *s, int type, const void *buf_, int len) | |||
1251 | else | 1259 | else |
1252 | s->s3->wnum += i; | 1260 | s->s3->wnum += i; |
1253 | 1261 | ||
1254 | return tot + i; | 1262 | return i; |
1255 | } | 1263 | } |
1256 | 1264 | ||
1257 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) | 1265 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) |
@@ -1576,7 +1584,7 @@ int dtls1_dispatch_alert(SSL *s) | |||
1576 | { | 1584 | { |
1577 | int i,j; | 1585 | int i,j; |
1578 | void (*cb)(const SSL *ssl,int type,int val)=NULL; | 1586 | void (*cb)(const SSL *ssl,int type,int val)=NULL; |
1579 | unsigned char buf[2 + 2 + 3]; /* alert level + alert desc + message seq +frag_off */ | 1587 | unsigned char buf[DTLS1_AL_HEADER_LENGTH]; |
1580 | unsigned char *ptr = &buf[0]; | 1588 | unsigned char *ptr = &buf[0]; |
1581 | 1589 | ||
1582 | s->s3->alert_dispatch=0; | 1590 | s->s3->alert_dispatch=0; |
@@ -1585,6 +1593,7 @@ int dtls1_dispatch_alert(SSL *s) | |||
1585 | *ptr++ = s->s3->send_alert[0]; | 1593 | *ptr++ = s->s3->send_alert[0]; |
1586 | *ptr++ = s->s3->send_alert[1]; | 1594 | *ptr++ = s->s3->send_alert[1]; |
1587 | 1595 | ||
1596 | #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE | ||
1588 | if (s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) | 1597 | if (s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) |
1589 | { | 1598 | { |
1590 | s2n(s->d1->handshake_read_seq, ptr); | 1599 | s2n(s->d1->handshake_read_seq, ptr); |
@@ -1600,6 +1609,7 @@ int dtls1_dispatch_alert(SSL *s) | |||
1600 | #endif | 1609 | #endif |
1601 | l2n3(s->d1->r_msg_hdr.frag_off, ptr); | 1610 | l2n3(s->d1->r_msg_hdr.frag_off, ptr); |
1602 | } | 1611 | } |
1612 | #endif | ||
1603 | 1613 | ||
1604 | i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0); | 1614 | i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0); |
1605 | if (i <= 0) | 1615 | if (i <= 0) |
@@ -1609,8 +1619,11 @@ int dtls1_dispatch_alert(SSL *s) | |||
1609 | } | 1619 | } |
1610 | else | 1620 | else |
1611 | { | 1621 | { |
1612 | if ( s->s3->send_alert[0] == SSL3_AL_FATAL || | 1622 | if (s->s3->send_alert[0] == SSL3_AL_FATAL |
1613 | s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) | 1623 | #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE |
1624 | || s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE | ||
1625 | #endif | ||
1626 | ) | ||
1614 | (void)BIO_flush(s->wbio); | 1627 | (void)BIO_flush(s->wbio); |
1615 | 1628 | ||
1616 | if (s->msg_callback) | 1629 | if (s->msg_callback) |