Lines Matching refs:frag
146 static void dtls1_hm_fragment_free(hm_fragment *frag) {
147 if (frag == NULL) {
150 OPENSSL_free(frag->data);
151 OPENSSL_free(frag->reassembly);
152 OPENSSL_free(frag);
156 hm_fragment *frag = OPENSSL_malloc(sizeof(hm_fragment));
157 if (frag == NULL) {
161 OPENSSL_memset(frag, 0, sizeof(hm_fragment));
162 frag->type = msg_hdr->type;
163 frag->seq = msg_hdr->seq;
164 frag->msg_len = msg_hdr->msg_len;
167 frag->data = OPENSSL_malloc(DTLS1_HM_HEADER_LENGTH + msg_hdr->msg_len);
168 if (frag->data == NULL) {
174 if (!CBB_init_fixed(&cbb, frag->data, DTLS1_HM_HEADER_LENGTH) ||
186 /* If the handshake message is empty, |frag->reassembly| is NULL. */
194 frag->reassembly = OPENSSL_malloc(bitmask_len);
195 if (frag->reassembly == NULL) {
199 OPENSSL_memset(frag->reassembly, 0, bitmask_len);
202 return frag;
205 dtls1_hm_fragment_free(frag);
216 * as received in |frag|. If |frag| becomes complete, it clears
217 * |frag->reassembly|. The range must be within the bounds of |frag|'s message
218 * and |frag->reassembly| must not be NULL. */
219 static void dtls1_hm_fragment_mark(hm_fragment *frag, size_t start,
221 size_t msg_len = frag->msg_len;
223 if (frag->reassembly == NULL || start > end || end > msg_len) {
231 frag->reassembly[start >> 3] |= bit_range(start & 7, end & 7);
233 frag->reassembly[start >> 3] |= bit_range(start & 7, 8);
235 frag->reassembly[i] = 0xff;
238 frag->reassembly[end >> 3] |= bit_range(0, end & 7);
244 if (frag->reassembly[i] != 0xff) {
249 frag->reassembly[msg_len >> 3] != bit_range(0, msg_len & 7)) {
253 OPENSSL_free(frag->reassembly);
254 frag->reassembly = NULL;
260 hm_fragment *frag = ssl->d1->incoming_messages[ssl->d1->handshake_read_seq %
262 return frag != NULL && frag->reassembly == NULL;
277 hm_fragment *frag = ssl->d1->incoming_messages[idx];
278 if (frag != NULL) {
279 assert(frag->seq == msg_hdr->seq);
282 if (frag->type != msg_hdr->type ||
283 frag->msg_len != msg_hdr->msg_len) {
288 return frag;
292 frag = dtls1_hm_fragment_new(msg_hdr);
293 if (frag == NULL) {
296 ssl->d1->incoming_messages[idx] = frag;
297 return frag;
374 hm_fragment *frag = dtls1_get_incoming_message(ssl, &msg_hdr);
375 if (frag == NULL) {
378 assert(frag->msg_len == msg_len);
380 if (frag->reassembly == NULL) {
387 OPENSSL_memcpy(frag->data + DTLS1_HM_HEADER_LENGTH + frag_off,
389 dtls1_hm_fragment_mark(frag, frag_off, frag_off + frag_len);
414 hm_fragment *frag = ssl->d1->incoming_messages[ssl->d1->handshake_read_seq %
416 assert(frag != NULL);
417 assert(frag->reassembly == NULL);
418 assert(ssl->d1->handshake_read_seq == frag->seq);
422 ssl->s3->tmp.message_type = frag->type;
423 ssl->init_msg = frag->data + DTLS1_HM_HEADER_LENGTH;
424 ssl->init_num = frag->msg_len;
426 ssl_do_msg_callback(ssl, 0 /* read */, SSL3_RT_HANDSHAKE, frag->data,
434 hm_fragment *frag
436 CBS_init(out, frag->data, DTLS1_HM_HEADER_LENGTH + frag->msg_len);
681 uint8_t *frag = out + prefix;
683 if (!CBB_init_fixed(&cbb, frag, max_frag) ||
696 ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_HANDSHAKE, frag, frag_len);