• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/OpenSSL098-52/src/ssl/

Lines Matching defs:?r

9  * Redistribution and use in source and binary forms, with or without
18 * the documentation and/or other materials provided with the
21 * 3. All advertising materials mentioning features or use of this
27 * endorse or promote products derived from this software without
77 * This can be in the form of a textual message at program startup or
78 * in documentation (online or textual) provided with the package.
80 * Redistribution and use in source and binary forms, with or without
87 * documentation and/or other materials provided with the distribution.
88 * 3. All advertising materials mentioning features or use of this software
94 * 4. If you include any Windows specific code (or a derivative thereof) from
110 * The licence and distribution terms for any publically available version or
130 static DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,
133 static int dtls1_record_needs_buffering(SSL *s, SSL3_RECORD *rr,
333 SSL3_RECORD *rr;
337 rr= &(s->s3->rrec);
340 /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length,
343 rr->input= &(s->packet[DTLS1_RT_HEADER_LENGTH]);
345 /* ok, we can now read from 's->packet' data into 'rr'
346 * rr->input points at rr->length bytes, which
347 * need to be copied into rr->data by either
348 * the decryption or by the decompression
349 * When the data is 'copied' into the rr->data buffer,
350 * rr->input will be pointed at the new buffer */
353 * rr->length bytes of encrypted compressed stuff. */
356 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH)
363 /* decrypt in place in 'rr->input' */
364 rr->data=rr->input;
374 rr->length = 0;
380 printf("dec %d\n",rr->length);
381 { unsigned int z; for (z=0; z<rr->length; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); }
396 /* kludge: *_cbc_remove_padding passes padding length in rr->type */
397 orig_len = rr->length+((unsigned int)rr->type>>8);
422 ssl3_cbc_copy_mac(mac_tmp, rr, mac_size, orig_len);
423 rr->length -= mac_size;
430 rr->length -= mac_size;
431 mac = &rr->data[rr->length];
437 if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+mac_size)
444 rr->length = 0;
452 if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH)
466 if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH)
473 rr->off=0;
496 * or non-blocking IO.
507 SSL3_RECORD *rr;
513 rr= &(s->s3->rrec);
531 if (n <= 0) return(n); /* error or non-blocking */
545 rr->type= *(p++);
551 n2s(p,rr->epoch);
556 n2s(p,rr->length);
564 rr->length = 0;
574 rr->length = 0;
579 if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH)
582 rr->length = 0;
593 if (rr->length > s->packet_length-DTLS1_RT_HEADER_LENGTH)
596 i=rr->length;
598 if (n <= 0) return(n); /* error or non-blocking io */
603 rr->length = 0;
608 /* now n == rr->length,
609 * and s->packet_length == DTLS1_RT_HEADER_LENGTH + rr->length */
614 bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch);
617 rr->length = 0;
622 /* Check whether this is a repeat, or aged record.
628 if (!(s->d1->listen && rr->type == SSL3_RT_HANDSHAKE &&
630 ! dtls1_record_replay_check(s, bitmap, &(rr->seq_num)))
632 rr->length = 0;
638 if (rr->length == 0) goto again;
640 /* If this record is from the next epoch (either HM or ALERT),
649 dtls1_buffer_record(s, &(s->d1->unprocessed_rcds), &rr->seq_num);
651 rr->length = 0;
658 rr->length = 0;
679 * a surprise, but handled as if it were), or renegotiation requests.
698 SSL3_RECORD *rr;
739 rr = &(s->s3->rrec);
745 if (s->state == SSL_ST_OK && rr->length == 0)
763 if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY))
777 if (s->d1->listen && rr->type != SSL3_RT_HANDSHAKE)
779 rr->length = 0;
787 && (rr->type != SSL3_RT_HANDSHAKE))
794 dtls1_buffer_record(s, &(s->d1->buffered_app_data), &rr->seq_num);
795 rr->length = 0;
803 rr->length=0;
809 if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */
823 if ((unsigned int)len > rr->length)
824 n = rr->length;
828 memcpy(buf,&(rr->data[rr->off]),n);
831 rr->length-=n;
832 rr->off+=n;
833 if (rr->length == 0)
836 rr->off=0;
843 /* If we get here, then type != rr->type; if we have a handshake
844 * message, then it was unexpected (Hello Request or Client Hello). */
854 if (rr->type == SSL3_RT_HANDSHAKE)
860 else if (rr->type == SSL3_RT_ALERT)
866 /* else it's a CCS message, or application data or wrong */
867 else if (rr->type != SSL3_RT_CHANGE_CIPHER_SPEC)
872 if (rr->type == SSL3_RT_APPLICATION_DATA)
893 if ( rr->length < dest_maxlen)
897 * for normal alerts rr->length is 2, while
904 rr->length = 0;
911 dest[k] = rr->data[rr->off++];
912 rr->length--;
918 /* s->d1->handshake_fragment_len == 12 iff rr->type == SSL3_RT_HANDSHAKE;
919 * s->d1->alert_fragment_len == 7 iff rr->type == SSL3_RT_ALERT.
920 * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */
979 /* we either finished a handshake or ignored the request,
1066 rr->length=0;
1070 if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC)
1075 dtls1_get_ccs_header(rr->data, &ccs_hdr);
1083 if ((rr->length != ccs_hdr_len) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS))
1090 rr->length=0;
1094 rr->data, 1, s, s->msg_callback_arg);
1119 /* Unexpected handshake message (Client Hello, or protocol violation) */
1126 dtls1_get_message_header(rr->data, &msg_hdr);
1127 if( rr->epoch != s->d1->r_epoch)
1129 rr->length = 0;
1142 rr->length = 0;
1187 switch (rr->type)
1194 rr->length = 0;
1206 * should not happen when type != rr->type */
1311 * It will return <= 0 if not all data has been sent or non-blocking IO.
1328 SSL3_RECORD *wr;
1353 wr= &(s->s3->wrec);
1404 wr->type=type;
1428 wr->data=p + bs; /* make room for IV in case of CBC */
1429 wr->length=(int)len;
1430 wr->input=(unsigned char *)buf;
1432 /* we now 'read' from wr->input, wr->length bytes into
1433 * wr->data */
1446 memcpy(wr->data,wr->input,wr->length);
1447 wr->input=wr->data;
1450 /* we should still have the output to wr->data and the input
1451 * from wr->input. Length should be wr->length.
1452 * wr->data still points in the wb->buf */
1456 s->method->ssl3_enc->mac(s,&(p[wr->length + bs]),1);
1457 wr->length+=mac_size;
1461 wr->input=p;
1462 wr->data=p;
1471 wr->length += bs;
1490 s2n(wr->length,pseq);
1493 * wr->data pointing to the encrypted data, which is
1494 * wr->length long */
1495 wr->type=type; /* not needed but helps for debugging */
1496 wr->length+=DTLS1_RT_HEADER_LENGTH;
1501 dtls1_buffer_record(s, wr->data, wr->length,
1512 return wr->length;
1516 wb->left = prefix_len + wr->length;
1707 dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr, unsigned int *is_next_epoch)
1713 if (rr->epoch == s->d1->r_epoch)
1717 else if (rr->epoch == (unsigned long)(s->d1->r_epoch + 1) &&
1718 (rr->type == SSL3_RT_HANDSHAKE ||
1719 rr->type == SSL3_RT_ALERT))
1730 dtls1_record_needs_buffering(SSL *s, SSL3_RECORD *rr, unsigned short *priority,
1735 if ( rr->type == SSL3_RT_APPLICATION_DATA ||
1736 rr->type == SSL3_RT_ALERT)
1744 unsigned char *data = rr->data;
1746 if ( rr->type == SSL3_RT_HANDSHAKE ||
1747 rr->type == SSL3_RT_CHANGE_CIPHER_SPEC)
1753 if ( rr->type == SSL3_RT_HANDSHAKE)
1766 /* this is either a record we're waiting for, or a
1771 if (rr->type == SSL3_RT_HANDSHAKE &&
1776 (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC ||