*/
if (enc_err == 0) {
ERR_pop_to_mark();
- if (rl->alert != 0) {
- /* SSLfatal() got called */
+ if (rl->alert != SSL_AD_NO_ALERT) {
+ /* RLAYERfatal() already called */
goto end;
}
/* For DTLS we simply ignore bad packets. */
rret = rl->funcs->read_n(rl, more, more, 1, 1, &n);
/* this packet contained a partial record, dump it */
if (rret < OSSL_RECORD_RETURN_SUCCESS || n != more) {
- if (rl->alert != 0) {
+ if (rl->alert != SSL_AD_NO_ALERT) {
/* read_n() called RLAYERfatal() */
return OSSL_RECORD_RETURN_FATAL;
}
}
if (!dtls_process_record(rl, bitmap)) {
- if (rl->alert != 0) {
+ if (rl->alert != SSL_AD_NO_ALERT) {
/* dtls_process_record() called RLAYERfatal */
return OSSL_RECORD_RETURN_FATAL;
}
while ((item = pqueue_pop(rl->unprocessed_rcds.q)) != NULL) {
rdata = (DTLS_RLAYER_RECORD_DATA *)item->data;
/* Push to the next record layer */
- /* TODO(RECLAYER): Handle SCTP meta data */
ret &= BIO_write_ex(rl->next, rdata->packet, rdata->packet_length,
&written);
OPENSSL_free(rdata->rbuf.buf);
SSL3_RECORD rrec;
} DTLS_RLAYER_RECORD_DATA;
-
extern struct record_functions_st ssl_3_0_funcs;
extern struct record_functions_st tls_1_funcs;
extern struct record_functions_st tls_1_3_funcs;
* 1: Success or MTE decryption failed (MAC will be randomised)
*/
if (enc_err == 0) {
- if (rl->alert != 0) {
+ if (rl->alert != SSL_AD_NO_ALERT) {
/* RLAYERfatal() already got called */
goto end;
}
}
if (enc_err == 0) {
- if (rl->alert != 0) {
+ if (rl->alert != SSL_AD_NO_ALERT) {
/* We already called RLAYERfatal() */
goto end;
}
rl->direction = direction;
rl->level = level;
+ rl->alert = SSL_AD_NO_ALERT;
+
if (level == OSSL_RECORD_PROTECTION_LEVEL_NONE)
rl->is_first_record = 1;
#ifndef OPENSSL_NO_SCTP
/* Restore bio_dgram_sctp_rcvinfo struct */
if (BIO_dgram_is_sctp(SSL_get_rbio(s))) {
- DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *)item->data;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO,
sizeof(rdata->recordinfo), &rdata->recordinfo);
}
SSL_R_UNEXPECTED_EOF_WHILE_READING, NULL);
}
} else if (ret == OSSL_RECORD_RETURN_FATAL) {
- ERR_new();
- ERR_set_debug(file, line, 0);
- ossl_statem_fatal(s, s->rlayer.rrlmethod->get_alert_code(s->rlayer.rrl),
- SSL_R_RECORD_LAYER_FAILURE, NULL);
+ int al = s->rlayer.rrlmethod->get_alert_code(s->rlayer.rrl);
+
+ if (al != SSL_AD_NO_ALERT) {
+ ERR_new();
+ ERR_set_debug(file, line, 0);
+ ossl_statem_fatal(s, al, SSL_R_RECORD_LAYER_FAILURE, NULL);
+ }
+ /*
+ * else some failure but there is no alert code. We don't log an
+ * error for this. The record layer should have logged an error
+ * already or, if not, its due to some sys call error which will be
+ * reported via SSL_ERROR_SYSCALL and errno.
+ */
}
/*
* The record layer distinguishes the cases of EOF, non-fatal
struct pqueue_st *q;
} record_pqueue;
-typedef struct dtls1_record_data_st {
- unsigned char *packet;
- size_t packet_length;
- SSL3_BUFFER rbuf;
- SSL3_RECORD rrec;
-#ifndef OPENSSL_NO_SCTP
- struct bio_dgram_sctp_rcvinfo recordinfo;
-#endif
-} DTLS1_RECORD_DATA;
-
typedef struct dtls_record_layer_st {
/*
* The current data and handshake epoch. This is initially