rl->d->w_epoch = e;
}
-void DTLS_RECORD_LAYER_resync_write(RECORD_LAYER *rl)
-{
- memcpy(rl->write_sequence, rl->read_sequence, sizeof(rl->write_sequence));
-}
-
void DTLS_RECORD_LAYER_set_write_sequence(RECORD_LAYER *rl, unsigned char *seq)
{
memcpy(rl->write_sequence, seq, SEQ_NUM_SIZE);
* type == SSL3_RT_HANDSHAKE.
*/
-#ifndef OPENSSL_NO_SCTP
- /*
- * Continue handshake if it had to be interrupted to read app data with
- * SCTP.
- */
- if ((!ossl_statem_get_in_handshake(s) && SSL_in_init(s)) ||
- (BIO_dgram_is_sctp(SSL_get_rbio(s))
- && ossl_statem_in_sctp_read_sock(s)
- && s->s3->in_read_app_data != 2))
-#else
if (!ossl_statem_get_in_handshake(s) && SSL_in_init(s))
-#endif
{
/* type == SSL3_RT_APPLICATION_DATA */
i = s->handshake_func(s);
}
}
#ifndef OPENSSL_NO_SCTP
- /*
- * We were about to renegotiate but had to read belated application
- * data first, so retry.
- */
- if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
- SSL3_RECORD_get_type(rr) == SSL3_RT_APPLICATION_DATA &&
- ossl_statem_in_sctp_read_sock(s)) {
- s->rwstate = SSL_READING;
- BIO_clear_retry_flags(SSL_get_rbio(s));
- BIO_set_retry_read(SSL_get_rbio(s));
- }
-
/*
* We might had to delay a close_notify alert because of reordered
* app data. If there was an alert and there is no message to read
* fragmented--don't always expect dest_maxlen bytes
*/
if (SSL3_RECORD_get_length(rr) < dest_maxlen) {
-#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
- /*
- * for normal alerts rr->length is 2, while
- * dest_maxlen is 7 if we were to handle this
- * non-existing alert...
- */
- FIX ME;
-#endif
s->rlayer.rstate = SSL_ST_READ_HEADER;
SSL3_RECORD_set_length(rr, 0);
goto start;
s->shutdown |= SSL_RECEIVED_SHUTDOWN;
return 0;
}
-#if 0
- /* XXX: this is a possible improvement in the future */
- /* now check if it's a missing record */
- if (alert_descr == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) {
- unsigned short seq;
- unsigned int frag_off;
- unsigned char *p = &(s->rlayer.d->alert_fragment[2]);
-
- n2s(p, seq);
- n2l3(p, frag_off);
-
- dtls1_retransmit_message(s,
- dtls1_get_queue_priority
- (frag->msg_header.seq, 0), frag_off,
- &found);
- if (!found && SSL_in_init(s)) {
- /*
- * fprintf( stderr,"in init = %d\n", SSL_in_init(s));
- */
- /*
- * requested a message not yet sent, send an alert
- * ourselves
- */
- ssl3_send_alert(s, SSL3_AL_WARNING,
- DTLS1_AD_MISSING_HANDSHAKE_MESSAGE);
- }
- }
-#endif
} else if (alert_level == SSL3_AL_FATAL) {
char tmp[16];
}
/* record length after mac and block padding */
- /*
- * if (type == SSL3_RT_APPLICATION_DATA || (type == SSL3_RT_ALERT && !
- * SSL_in_init(s)))
- */
/* there's only one epoch between handshake and app data */
s2n(s->rlayer.d->w_epoch, pseq);
- /* XDTLS: ?? */
- /*
- * else s2n(s->d1->handshake_epoch, pseq);
- */
-
memcpy(pseq, &(s->rlayer.write_sequence[2]), 6);
pseq += 6;
s2n(SSL3_RECORD_get_length(&wr), pseq);