Lines Matching refs:rr
192 SSL3_RECORD *rr = &s->s3->rrec; in dtls1_process_record() local
195 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) { in dtls1_process_record()
203 rr->data = &s->packet[DTLS1_RT_HEADER_LENGTH]; in dtls1_process_record()
206 seq[0] = rr->epoch >> 8; in dtls1_process_record()
207 seq[1] = rr->epoch & 0xff; in dtls1_process_record()
208 memcpy(&seq[2], &rr->seq_num[2], 6); in dtls1_process_record()
217 if (!SSL_AEAD_CTX_open(s->aead_read_ctx, rr->data, &plaintext_len, rr->length, in dtls1_process_record()
218 rr->type, s->version, seq, rr->data, rr->length)) { in dtls1_process_record()
222 rr->length = 0; in dtls1_process_record()
233 rr->length = plaintext_len; in dtls1_process_record()
235 rr->off = 0; in dtls1_process_record()
265 SSL3_RECORD *rr; in dtls1_get_record() local
269 rr = &(s->s3->rrec); in dtls1_get_record()
298 rr->type = *(p++); in dtls1_get_record()
304 n2s(p, rr->epoch); in dtls1_get_record()
309 n2s(p, rr->length); in dtls1_get_record()
320 rr->length = 0; in dtls1_get_record()
328 rr->length = 0; in dtls1_get_record()
333 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) { in dtls1_get_record()
335 rr->length = 0; in dtls1_get_record()
345 if (rr->length > s->packet_length - DTLS1_RT_HEADER_LENGTH) { in dtls1_get_record()
347 n = ssl3_read_n(s, rr->length, 1); in dtls1_get_record()
349 if (n != rr->length) { in dtls1_get_record()
350 rr->length = 0; in dtls1_get_record()
360 if (rr->epoch != s->d1->r_epoch) { in dtls1_get_record()
364 rr->length = 0; in dtls1_get_record()
371 rr->length = 0; in dtls1_get_record()
377 if (rr->length == 0) { in dtls1_get_record()
382 rr->length = 0; in dtls1_get_record()
429 SSL3_RECORD *rr; in dtls1_read_bytes() local
459 rr = &s->s3->rrec; in dtls1_read_bytes()
467 if (rr->length == 0 || s->rstate == SSL_ST_READ_BODY) { in dtls1_read_bytes()
484 if (s->s3->change_cipher_spec && rr->type != SSL3_RT_HANDSHAKE && in dtls1_read_bytes()
485 rr->type != SSL3_RT_ALERT) { in dtls1_read_bytes()
489 rr->length = 0; in dtls1_read_bytes()
496 rr->length = 0; in dtls1_read_bytes()
502 if (type == rr->type) { /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ in dtls1_read_bytes()
518 if ((unsigned int)len > rr->length) { in dtls1_read_bytes()
519 n = rr->length; in dtls1_read_bytes()
524 memcpy(buf, &(rr->data[rr->off]), n); in dtls1_read_bytes()
526 rr->length -= n; in dtls1_read_bytes()
527 rr->off += n; in dtls1_read_bytes()
528 if (rr->length == 0) { in dtls1_read_bytes()
530 rr->off = 0; in dtls1_read_bytes()
541 if (rr->type == SSL3_RT_ALERT) { in dtls1_read_bytes()
543 if (rr->length < 2) { in dtls1_read_bytes()
550 s->msg_callback(0, s->version, SSL3_RT_ALERT, &rr->data[rr->off], 2, s, in dtls1_read_bytes()
553 const uint8_t alert_level = rr->data[rr->off++]; in dtls1_read_bytes()
554 const uint8_t alert_descr = rr->data[rr->off++]; in dtls1_read_bytes()
555 rr->length -= 2; in dtls1_read_bytes()
598 rr->length = 0; in dtls1_read_bytes()
602 if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { in dtls1_read_bytes()
605 if (rr->length != 1 || rr->off != 0 || rr->data[0] != SSL3_MT_CCS) { in dtls1_read_bytes()
611 rr->length = 0; in dtls1_read_bytes()
614 s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, in dtls1_read_bytes()
641 if (rr->type == SSL3_RT_HANDSHAKE && !s->in_handshake) { in dtls1_read_bytes()
642 if (rr->length < DTLS1_HM_HEADER_LENGTH) { in dtls1_read_bytes()
648 dtls1_get_message_header(&rr->data[rr->off], &msg_hdr); in dtls1_read_bytes()
663 rr->length = 0; in dtls1_read_bytes()
669 assert(rr->type != SSL3_RT_CHANGE_CIPHER_SPEC && rr->type != SSL3_RT_ALERT); in dtls1_read_bytes()