d1_both.cc
Go to the documentation of this file.
1 /*
2  * DTLS implementation written by Nagendra Modadugu
3  * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
4  */
5 /* ====================================================================
6  * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. All advertising materials mentioning features or use of this
21  * software must display the following acknowledgment:
22  * "This product includes software developed by the OpenSSL Project
23  * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24  *
25  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26  * endorse or promote products derived from this software without
27  * prior written permission. For written permission, please contact
28  * openssl-core@openssl.org.
29  *
30  * 5. Products derived from this software may not be called "OpenSSL"
31  * nor may "OpenSSL" appear in their names without prior written
32  * permission of the OpenSSL Project.
33  *
34  * 6. Redistributions of any form whatsoever must retain the following
35  * acknowledgment:
36  * "This product includes software developed by the OpenSSL Project
37  * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38  *
39  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50  * OF THE POSSIBILITY OF SUCH DAMAGE.
51  * ====================================================================
52  *
53  * This product includes cryptographic software written by Eric Young
54  * (eay@cryptsoft.com). This product includes software written by Tim
55  * Hudson (tjh@cryptsoft.com).
56  *
57  */
58 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
59  * All rights reserved.
60  *
61  * This package is an SSL implementation written
62  * by Eric Young (eay@cryptsoft.com).
63  * The implementation was written so as to conform with Netscapes SSL.
64  *
65  * This library is free for commercial and non-commercial use as long as
66  * the following conditions are aheared to. The following conditions
67  * apply to all code found in this distribution, be it the RC4, RSA,
68  * lhash, DES, etc., code; not just the SSL code. The SSL documentation
69  * included with this distribution is covered by the same copyright terms
70  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
71  *
72  * Copyright remains Eric Young's, and as such any Copyright notices in
73  * the code are not to be removed.
74  * If this package is used in a product, Eric Young should be given attribution
75  * as the author of the parts of the library used.
76  * This can be in the form of a textual message at program startup or
77  * in documentation (online or textual) provided with the package.
78  *
79  * Redistribution and use in source and binary forms, with or without
80  * modification, are permitted provided that the following conditions
81  * are met:
82  * 1. Redistributions of source code must retain the copyright
83  * notice, this list of conditions and the following disclaimer.
84  * 2. Redistributions in binary form must reproduce the above copyright
85  * notice, this list of conditions and the following disclaimer in the
86  * documentation and/or other materials provided with the distribution.
87  * 3. All advertising materials mentioning features or use of this software
88  * must display the following acknowledgement:
89  * "This product includes cryptographic software written by
90  * Eric Young (eay@cryptsoft.com)"
91  * The word 'cryptographic' can be left out if the rouines from the library
92  * being used are not cryptographic related :-).
93  * 4. If you include any Windows specific code (or a derivative thereof) from
94  * the apps directory (application code) you must include an acknowledgement:
95  * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
96  *
97  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
98  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
99  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
100  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
101  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
102  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
103  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
104  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
105  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
106  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
107  * SUCH DAMAGE.
108  *
109  * The licence and distribution terms for any publically available version or
110  * derivative of this code cannot be changed. i.e. this code cannot simply be
111  * copied and put under another distribution licence
112  * [including the GNU Public Licence.] */
113 
114 #include <openssl/ssl.h>
115 
116 #include <assert.h>
117 #include <limits.h>
118 #include <string.h>
119 
120 #include <openssl/err.h>
121 #include <openssl/evp.h>
122 #include <openssl/mem.h>
123 #include <openssl/rand.h>
124 
125 #include "../crypto/internal.h"
126 #include "internal.h"
127 
128 
130 
131 // TODO(davidben): 28 comes from the size of IP + UDP header. Is this reasonable
132 // for these values? Notably, why is kMinMTU a function of the transport
133 // protocol's overhead rather than, say, what's needed to hold a minimally-sized
134 // handshake fragment plus protocol overhead.
135 
136 // kMinMTU is the minimum acceptable MTU value.
137 static const unsigned int kMinMTU = 256 - 28;
138 
139 // kDefaultMTU is the default MTU value to use if neither the user nor
140 // the underlying BIO supplies one.
141 static const unsigned int kDefaultMTU = 1500 - 28;
142 
143 
144 // Receiving handshake messages.
145 
149 }
150 
151 static UniquePtr<hm_fragment> dtls1_hm_fragment_new(
152  const struct hm_header_st *msg_hdr) {
153  ScopedCBB cbb;
154  UniquePtr<hm_fragment> frag = MakeUnique<hm_fragment>();
155  if (!frag) {
156  return nullptr;
157  }
158  frag->type = msg_hdr->type;
159  frag->seq = msg_hdr->seq;
160  frag->msg_len = msg_hdr->msg_len;
161 
162  // Allocate space for the reassembled message and fill in the header.
163  frag->data =
165  if (frag->data == NULL) {
167  return nullptr;
168  }
169 
170  if (!CBB_init_fixed(cbb.get(), frag->data, DTLS1_HM_HEADER_LENGTH) ||
171  !CBB_add_u8(cbb.get(), msg_hdr->type) ||
172  !CBB_add_u24(cbb.get(), msg_hdr->msg_len) ||
173  !CBB_add_u16(cbb.get(), msg_hdr->seq) ||
174  !CBB_add_u24(cbb.get(), 0 /* frag_off */) ||
175  !CBB_add_u24(cbb.get(), msg_hdr->msg_len) ||
176  !CBB_finish(cbb.get(), NULL, NULL)) {
178  return nullptr;
179  }
180 
181  // If the handshake message is empty, |frag->reassembly| is NULL.
182  if (msg_hdr->msg_len > 0) {
183  // Initialize reassembly bitmask.
184  if (msg_hdr->msg_len + 7 < msg_hdr->msg_len) {
186  return nullptr;
187  }
188  size_t bitmask_len = (msg_hdr->msg_len + 7) / 8;
189  frag->reassembly = (uint8_t *)OPENSSL_malloc(bitmask_len);
190  if (frag->reassembly == NULL) {
192  return nullptr;
193  }
194  OPENSSL_memset(frag->reassembly, 0, bitmask_len);
195  }
196 
197  return frag;
198 }
199 
200 // bit_range returns a |uint8_t| with bits |start|, inclusive, to |end|,
201 // exclusive, set.
202 static uint8_t bit_range(size_t start, size_t end) {
203  return (uint8_t)(~((1u << start) - 1) & ((1u << end) - 1));
204 }
205 
206 // dtls1_hm_fragment_mark marks bytes |start|, inclusive, to |end|, exclusive,
207 // as received in |frag|. If |frag| becomes complete, it clears
208 // |frag->reassembly|. The range must be within the bounds of |frag|'s message
209 // and |frag->reassembly| must not be NULL.
210 static void dtls1_hm_fragment_mark(hm_fragment *frag, size_t start,
211  size_t end) {
212  size_t msg_len = frag->msg_len;
213 
214  if (frag->reassembly == NULL || start > end || end > msg_len) {
215  assert(0);
216  return;
217  }
218  // A zero-length message will never have a pending reassembly.
219  assert(msg_len > 0);
220 
221  if (start == end) {
222  return;
223  }
224 
225  if ((start >> 3) == (end >> 3)) {
226  frag->reassembly[start >> 3] |= bit_range(start & 7, end & 7);
227  } else {
228  frag->reassembly[start >> 3] |= bit_range(start & 7, 8);
229  for (size_t i = (start >> 3) + 1; i < (end >> 3); i++) {
230  frag->reassembly[i] = 0xff;
231  }
232  if ((end & 7) != 0) {
233  frag->reassembly[end >> 3] |= bit_range(0, end & 7);
234  }
235  }
236 
237  // Check if the fragment is complete.
238  for (size_t i = 0; i < (msg_len >> 3); i++) {
239  if (frag->reassembly[i] != 0xff) {
240  return;
241  }
242  }
243  if ((msg_len & 7) != 0 &&
244  frag->reassembly[msg_len >> 3] != bit_range(0, msg_len & 7)) {
245  return;
246  }
247 
248  OPENSSL_free(frag->reassembly);
249  frag->reassembly = NULL;
250 }
251 
252 // dtls1_is_current_message_complete returns whether the current handshake
253 // message is complete.
254 static bool dtls1_is_current_message_complete(const SSL *ssl) {
255  size_t idx = ssl->d1->handshake_read_seq % SSL_MAX_HANDSHAKE_FLIGHT;
256  hm_fragment *frag = ssl->d1->incoming_messages[idx].get();
257  return frag != NULL && frag->reassembly == NULL;
258 }
259 
260 // dtls1_get_incoming_message returns the incoming message corresponding to
261 // |msg_hdr|. If none exists, it creates a new one and inserts it in the
262 // queue. Otherwise, it checks |msg_hdr| is consistent with the existing one. It
263 // returns NULL on failure. The caller does not take ownership of the result.
265  SSL *ssl, uint8_t *out_alert, const struct hm_header_st *msg_hdr) {
266  if (msg_hdr->seq < ssl->d1->handshake_read_seq ||
267  msg_hdr->seq - ssl->d1->handshake_read_seq >= SSL_MAX_HANDSHAKE_FLIGHT) {
268  *out_alert = SSL_AD_INTERNAL_ERROR;
269  return NULL;
270  }
271 
272  size_t idx = msg_hdr->seq % SSL_MAX_HANDSHAKE_FLIGHT;
273  hm_fragment *frag = ssl->d1->incoming_messages[idx].get();
274  if (frag != NULL) {
275  assert(frag->seq == msg_hdr->seq);
276  // The new fragment must be compatible with the previous fragments from this
277  // message.
278  if (frag->type != msg_hdr->type ||
279  frag->msg_len != msg_hdr->msg_len) {
281  *out_alert = SSL_AD_ILLEGAL_PARAMETER;
282  return NULL;
283  }
284  return frag;
285  }
286 
287  // This is the first fragment from this message.
288  ssl->d1->incoming_messages[idx] = dtls1_hm_fragment_new(msg_hdr);
289  if (!ssl->d1->incoming_messages[idx]) {
290  *out_alert = SSL_AD_INTERNAL_ERROR;
291  return NULL;
292  }
293  return ssl->d1->incoming_messages[idx].get();
294 }
295 
296 ssl_open_record_t dtls1_open_handshake(SSL *ssl, size_t *out_consumed,
297  uint8_t *out_alert, Span<uint8_t> in) {
298  uint8_t type;
299  Span<uint8_t> record;
300  auto ret = dtls_open_record(ssl, &type, &record, out_consumed, out_alert, in);
301  if (ret != ssl_open_record_success) {
302  return ret;
303  }
304 
305  switch (type) {
307  // Unencrypted application data records are always illegal.
308  if (ssl->s3->aead_read_ctx->is_null_cipher()) {
310  *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
311  return ssl_open_record_error;
312  }
313 
314  // Out-of-order application data may be received between ChangeCipherSpec
315  // and finished. Discard it.
317 
319  // We do not support renegotiation, so encrypted ChangeCipherSpec records
320  // are illegal.
321  if (!ssl->s3->aead_read_ctx->is_null_cipher()) {
323  *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
324  return ssl_open_record_error;
325  }
326 
327  if (record.size() != 1u || record[0] != SSL3_MT_CCS) {
329  *out_alert = SSL_AD_ILLEGAL_PARAMETER;
330  return ssl_open_record_error;
331  }
332 
333  // Flag the ChangeCipherSpec for later.
334  ssl->d1->has_change_cipher_spec = true;
336  record);
338 
339  case SSL3_RT_HANDSHAKE:
340  // Break out to main processing.
341  break;
342 
343  default:
345  *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
346  return ssl_open_record_error;
347  }
348 
349  CBS cbs;
350  CBS_init(&cbs, record.data(), record.size());
351  while (CBS_len(&cbs) > 0) {
352  // Read a handshake fragment.
353  struct hm_header_st msg_hdr;
354  CBS body;
355  if (!dtls1_parse_fragment(&cbs, &msg_hdr, &body)) {
357  *out_alert = SSL_AD_DECODE_ERROR;
358  return ssl_open_record_error;
359  }
360 
361  const size_t frag_off = msg_hdr.frag_off;
362  const size_t frag_len = msg_hdr.frag_len;
363  const size_t msg_len = msg_hdr.msg_len;
364  if (frag_off > msg_len || frag_off + frag_len < frag_off ||
365  frag_off + frag_len > msg_len ||
368  *out_alert = SSL_AD_ILLEGAL_PARAMETER;
369  return ssl_open_record_error;
370  }
371 
372  // The encrypted epoch in DTLS has only one handshake message.
373  if (ssl->d1->r_epoch == 1 && msg_hdr.seq != ssl->d1->handshake_read_seq) {
375  *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
376  return ssl_open_record_error;
377  }
378 
379  if (msg_hdr.seq < ssl->d1->handshake_read_seq ||
380  msg_hdr.seq >
381  (unsigned)ssl->d1->handshake_read_seq + SSL_MAX_HANDSHAKE_FLIGHT) {
382  // Ignore fragments from the past, or ones too far in the future.
383  continue;
384  }
385 
386  hm_fragment *frag = dtls1_get_incoming_message(ssl, out_alert, &msg_hdr);
387  if (frag == NULL) {
388  return ssl_open_record_error;
389  }
390  assert(frag->msg_len == msg_len);
391 
392  if (frag->reassembly == NULL) {
393  // The message is already assembled.
394  continue;
395  }
396  assert(msg_len > 0);
397 
398  // Copy the body into the fragment.
400  CBS_data(&body), CBS_len(&body));
402  }
403 
405 }
406 
407 bool dtls1_get_message(const SSL *ssl, SSLMessage *out) {
409  return false;
410  }
411 
412  size_t idx = ssl->d1->handshake_read_seq % SSL_MAX_HANDSHAKE_FLIGHT;
413  hm_fragment *frag = ssl->d1->incoming_messages[idx].get();
414  out->type = frag->type;
415  CBS_init(&out->body, frag->data + DTLS1_HM_HEADER_LENGTH, frag->msg_len);
416  CBS_init(&out->raw, frag->data, DTLS1_HM_HEADER_LENGTH + frag->msg_len);
417  out->is_v2_hello = false;
418  if (!ssl->s3->has_message) {
419  ssl_do_msg_callback(ssl, 0 /* read */, SSL3_RT_HANDSHAKE, out->raw);
420  ssl->s3->has_message = true;
421  }
422  return true;
423 }
424 
426  assert(ssl->s3->has_message);
428  size_t index = ssl->d1->handshake_read_seq % SSL_MAX_HANDSHAKE_FLIGHT;
429  ssl->d1->incoming_messages[index].reset();
430  ssl->d1->handshake_read_seq++;
431  ssl->s3->has_message = false;
432  // If we previously sent a flight, mark it as having a reply, so
433  // |on_handshake_complete| can manage post-handshake retransmission.
434  if (ssl->d1->outgoing_messages_complete) {
435  ssl->d1->flight_has_reply = true;
436  }
437 }
438 
440  size_t current = ssl->d1->handshake_read_seq % SSL_MAX_HANDSHAKE_FLIGHT;
441  for (size_t i = 0; i < SSL_MAX_HANDSHAKE_FLIGHT; i++) {
442  // Skip the current message.
443  if (ssl->s3->has_message && i == current) {
445  continue;
446  }
447  if (ssl->d1->incoming_messages[i] != nullptr) {
448  return true;
449  }
450  }
451  return false;
452 }
453 
454 bool dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr,
455  CBS *out_body) {
456  OPENSSL_memset(out_hdr, 0x00, sizeof(struct hm_header_st));
457 
458  if (!CBS_get_u8(cbs, &out_hdr->type) ||
459  !CBS_get_u24(cbs, &out_hdr->msg_len) ||
460  !CBS_get_u16(cbs, &out_hdr->seq) ||
461  !CBS_get_u24(cbs, &out_hdr->frag_off) ||
462  !CBS_get_u24(cbs, &out_hdr->frag_len) ||
463  !CBS_get_bytes(cbs, out_body, out_hdr->frag_len)) {
464  return false;
465  }
466 
467  return true;
468 }
469 
471  uint8_t *out_alert,
472  Span<uint8_t> in) {
473  if (!ssl->d1->has_change_cipher_spec) {
474  // dtls1_open_handshake processes both handshake and ChangeCipherSpec.
475  auto ret = dtls1_open_handshake(ssl, out_consumed, out_alert, in);
476  if (ret != ssl_open_record_success) {
477  return ret;
478  }
479  }
480  if (ssl->d1->has_change_cipher_spec) {
481  ssl->d1->has_change_cipher_spec = false;
483  }
485 }
486 
487 
488 // Sending handshake messages.
489 
492  data = nullptr;
493 }
494 
496  for (size_t i = 0; i < ssl->d1->outgoing_messages_len; i++) {
497  ssl->d1->outgoing_messages[i].Clear();
498  }
499  ssl->d1->outgoing_messages_len = 0;
500  ssl->d1->outgoing_written = 0;
501  ssl->d1->outgoing_offset = 0;
502  ssl->d1->outgoing_messages_complete = false;
503  ssl->d1->flight_has_reply = false;
504 }
505 
506 bool dtls1_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type) {
507  // Pick a modest size hint to save most of the |realloc| calls.
508  if (!CBB_init(cbb, 64) ||
509  !CBB_add_u8(cbb, type) ||
510  !CBB_add_u24(cbb, 0 /* length (filled in later) */) ||
511  !CBB_add_u16(cbb, ssl->d1->handshake_write_seq) ||
512  !CBB_add_u24(cbb, 0 /* offset */) ||
513  !CBB_add_u24_length_prefixed(cbb, body)) {
514  return false;
515  }
516 
517  return true;
518 }
519 
520 bool dtls1_finish_message(const SSL *ssl, CBB *cbb, Array<uint8_t> *out_msg) {
521  if (!CBBFinishArray(cbb, out_msg) ||
522  out_msg->size() < DTLS1_HM_HEADER_LENGTH) {
524  return false;
525  }
526 
527  // Fix up the header. Copy the fragment length into the total message
528  // length.
529  OPENSSL_memcpy(out_msg->data() + 1,
530  out_msg->data() + DTLS1_HM_HEADER_LENGTH - 3, 3);
531  return true;
532 }
533 
534 // ssl_size_t_greater_than_32_bits returns whether |v| exceeds the bounds of a
535 // 32-bit value. The obvious thing doesn't work because, in some 32-bit build
536 // configurations, the compiler warns that the test is always false and breaks
537 // the build.
538 static bool ssl_size_t_greater_than_32_bits(size_t v) {
539 #if defined(OPENSSL_64_BIT)
540  return v > 0xffffffff;
541 #elif defined(OPENSSL_32_BIT)
542  return false;
543 #else
544 #error "Building for neither 32- nor 64-bits."
545 #endif
546 }
547 
548 // add_outgoing adds a new handshake message or ChangeCipherSpec to the current
549 // outgoing flight. It returns true on success and false on error.
550 static bool add_outgoing(SSL *ssl, bool is_ccs, Array<uint8_t> data) {
551  if (ssl->d1->outgoing_messages_complete) {
552  // If we've begun writing a new flight, we received the peer flight. Discard
553  // the timer and the our flight.
554  dtls1_stop_timer(ssl);
556  }
557 
558  static_assert(SSL_MAX_HANDSHAKE_FLIGHT <
559  (1 << 8 * sizeof(ssl->d1->outgoing_messages_len)),
560  "outgoing_messages_len is too small");
561  if (ssl->d1->outgoing_messages_len >= SSL_MAX_HANDSHAKE_FLIGHT ||
563  assert(false);
565  return false;
566  }
567 
568  if (!is_ccs) {
569  // TODO(svaldez): Move this up a layer to fix abstraction for SSLTranscript
570  // on hs.
571  if (ssl->s3->hs != NULL &&
572  !ssl->s3->hs->transcript.Update(data)) {
574  return false;
575  }
576  ssl->d1->handshake_write_seq++;
577  }
578 
580  &ssl->d1->outgoing_messages[ssl->d1->outgoing_messages_len];
581  size_t len;
582  data.Release(&msg->data, &len);
583  msg->len = len;
584  msg->epoch = ssl->d1->w_epoch;
585  msg->is_ccs = is_ccs;
586 
587  ssl->d1->outgoing_messages_len++;
588  return true;
589 }
590 
592  return add_outgoing(ssl, false /* handshake */, std::move(data));
593 }
594 
596  return add_outgoing(ssl, true /* ChangeCipherSpec */, Array<uint8_t>());
597 }
598 
599 // dtls1_update_mtu updates the current MTU from the BIO, ensuring it is above
600 // the minimum.
601 static void dtls1_update_mtu(SSL *ssl) {
602  // TODO(davidben): No consumer implements |BIO_CTRL_DGRAM_SET_MTU| and the
603  // only |BIO_CTRL_DGRAM_QUERY_MTU| implementation could use
604  // |SSL_set_mtu|. Does this need to be so complex?
605  if (ssl->d1->mtu < dtls1_min_mtu() &&
607  long mtu = BIO_ctrl(ssl->wbio.get(), BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
608  if (mtu >= 0 && mtu <= (1 << 30) && (unsigned)mtu >= dtls1_min_mtu()) {
609  ssl->d1->mtu = (unsigned)mtu;
610  } else {
611  ssl->d1->mtu = kDefaultMTU;
612  BIO_ctrl(ssl->wbio.get(), BIO_CTRL_DGRAM_SET_MTU, ssl->d1->mtu, NULL);
613  }
614  }
615 
616  // The MTU should be above the minimum now.
617  assert(ssl->d1->mtu >= dtls1_min_mtu());
618 }
619 
625 };
626 
627 // seal_next_message seals |msg|, which must be the next message, to |out|. If
628 // progress was made, it returns |seal_partial| or |seal_success| and sets
629 // |*out_len| to the number of bytes written.
631  size_t *out_len, size_t max_out,
632  const DTLS_OUTGOING_MESSAGE *msg) {
633  assert(ssl->d1->outgoing_written < ssl->d1->outgoing_messages_len);
634  assert(msg == &ssl->d1->outgoing_messages[ssl->d1->outgoing_written]);
635 
637  if (ssl->d1->w_epoch >= 1 && msg->epoch == ssl->d1->w_epoch - 1) {
638  use_epoch = dtls1_use_previous_epoch;
639  } else if (msg->epoch != ssl->d1->w_epoch) {
641  return seal_error;
642  }
643 
644  size_t overhead = dtls_max_seal_overhead(ssl, use_epoch);
645  size_t prefix = dtls_seal_prefix_len(ssl, use_epoch);
646 
647  if (msg->is_ccs) {
648  // Check there is room for the ChangeCipherSpec.
649  static const uint8_t kChangeCipherSpec[1] = {SSL3_MT_CCS};
650  if (max_out < sizeof(kChangeCipherSpec) + overhead) {
651  return seal_no_progress;
652  }
653 
654  if (!dtls_seal_record(ssl, out, out_len, max_out,
655  SSL3_RT_CHANGE_CIPHER_SPEC, kChangeCipherSpec,
656  sizeof(kChangeCipherSpec), use_epoch)) {
657  return seal_error;
658  }
659 
661  kChangeCipherSpec);
662  return seal_success;
663  }
664 
665  // DTLS messages are serialized as a single fragment in |msg|.
666  CBS cbs, body;
667  struct hm_header_st hdr;
668  CBS_init(&cbs, msg->data, msg->len);
669  if (!dtls1_parse_fragment(&cbs, &hdr, &body) ||
670  hdr.frag_off != 0 ||
671  hdr.frag_len != CBS_len(&body) ||
672  hdr.msg_len != CBS_len(&body) ||
673  !CBS_skip(&body, ssl->d1->outgoing_offset) ||
674  CBS_len(&cbs) != 0) {
676  return seal_error;
677  }
678 
679  // Determine how much progress can be made.
680  if (max_out < DTLS1_HM_HEADER_LENGTH + 1 + overhead || max_out < prefix) {
681  return seal_no_progress;
682  }
683  size_t todo = CBS_len(&body);
684  if (todo > max_out - DTLS1_HM_HEADER_LENGTH - overhead) {
685  todo = max_out - DTLS1_HM_HEADER_LENGTH - overhead;
686  }
687 
688  // Assemble a fragment, to be sealed in-place.
689  ScopedCBB cbb;
690  uint8_t *frag = out + prefix;
691  size_t max_frag = max_out - prefix, frag_len;
692  if (!CBB_init_fixed(cbb.get(), frag, max_frag) ||
693  !CBB_add_u8(cbb.get(), hdr.type) ||
694  !CBB_add_u24(cbb.get(), hdr.msg_len) ||
695  !CBB_add_u16(cbb.get(), hdr.seq) ||
696  !CBB_add_u24(cbb.get(), ssl->d1->outgoing_offset) ||
697  !CBB_add_u24(cbb.get(), todo) ||
698  !CBB_add_bytes(cbb.get(), CBS_data(&body), todo) ||
699  !CBB_finish(cbb.get(), NULL, &frag_len)) {
701  return seal_error;
702  }
703 
704  ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_HANDSHAKE,
705  MakeSpan(frag, frag_len));
706 
707  if (!dtls_seal_record(ssl, out, out_len, max_out, SSL3_RT_HANDSHAKE,
708  out + prefix, frag_len, use_epoch)) {
709  return seal_error;
710  }
711 
712  if (todo == CBS_len(&body)) {
713  // The next message is complete.
714  ssl->d1->outgoing_offset = 0;
715  return seal_success;
716  }
717 
718  ssl->d1->outgoing_offset += todo;
719  return seal_partial;
720 }
721 
722 // seal_next_packet writes as much of the next flight as possible to |out| and
723 // advances |ssl->d1->outgoing_written| and |ssl->d1->outgoing_offset| as
724 // appropriate.
725 static bool seal_next_packet(SSL *ssl, uint8_t *out, size_t *out_len,
726  size_t max_out) {
727  bool made_progress = false;
728  size_t total = 0;
729  assert(ssl->d1->outgoing_written < ssl->d1->outgoing_messages_len);
730  for (; ssl->d1->outgoing_written < ssl->d1->outgoing_messages_len;
731  ssl->d1->outgoing_written++) {
732  const DTLS_OUTGOING_MESSAGE *msg =
733  &ssl->d1->outgoing_messages[ssl->d1->outgoing_written];
734  size_t len;
735  enum seal_result_t ret = seal_next_message(ssl, out, &len, max_out, msg);
736  switch (ret) {
737  case seal_error:
738  return false;
739 
740  case seal_no_progress:
741  goto packet_full;
742 
743  case seal_partial:
744  case seal_success:
745  out += len;
746  max_out -= len;
747  total += len;
748  made_progress = true;
749 
750  if (ret == seal_partial) {
751  goto packet_full;
752  }
753  break;
754  }
755  }
756 
757 packet_full:
758  // The MTU was too small to make any progress.
759  if (!made_progress) {
761  return false;
762  }
763 
764  *out_len = total;
765  return true;
766 }
767 
768 static int send_flight(SSL *ssl) {
769  if (ssl->s3->write_shutdown != ssl_shutdown_none) {
771  return -1;
772  }
773 
774  if (ssl->wbio == nullptr) {
776  return -1;
777  }
778 
779  dtls1_update_mtu(ssl);
780 
781  Array<uint8_t> packet;
782  if (!packet.Init(ssl->d1->mtu)) {
783  return -1;
784  }
785 
786  while (ssl->d1->outgoing_written < ssl->d1->outgoing_messages_len) {
787  uint8_t old_written = ssl->d1->outgoing_written;
788  uint32_t old_offset = ssl->d1->outgoing_offset;
789 
790  size_t packet_len;
791  if (!seal_next_packet(ssl, packet.data(), &packet_len, packet.size())) {
792  return -1;
793  }
794 
795  int bio_ret = BIO_write(ssl->wbio.get(), packet.data(), packet_len);
796  if (bio_ret <= 0) {
797  // Retry this packet the next time around.
798  ssl->d1->outgoing_written = old_written;
799  ssl->d1->outgoing_offset = old_offset;
800  ssl->s3->rwstate = SSL_ERROR_WANT_WRITE;
801  return bio_ret;
802  }
803  }
804 
805  if (BIO_flush(ssl->wbio.get()) <= 0) {
806  ssl->s3->rwstate = SSL_ERROR_WANT_WRITE;
807  return -1;
808  }
809 
810  return 1;
811 }
812 
814  ssl->d1->outgoing_messages_complete = true;
815  // Start the retransmission timer for the next flight (if any).
816  dtls1_start_timer(ssl);
817  return send_flight(ssl);
818 }
819 
821  // Rewind to the start of the flight and write it again.
822  //
823  // TODO(davidben): This does not allow retransmits to be resumed on
824  // non-blocking write.
825  ssl->d1->outgoing_written = 0;
826  ssl->d1->outgoing_offset = 0;
827 
828  return send_flight(ssl);
829 }
830 
831 unsigned int dtls1_min_mtu(void) {
832  return kMinMTU;
833 }
834 
dtls1_start_timer
void dtls1_start_timer(SSL *ssl)
Definition: d1_lib.cc:120
SSL_R_BAD_HANDSHAKE_RECORD
#define SSL_R_BAD_HANDSHAKE_RECORD
Definition: ssl.h:5377
hm_fragment::seq
uint16_t seq
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2862
SSL_AD_UNEXPECTED_MESSAGE
#define SSL_AD_UNEXPECTED_MESSAGE
Definition: ssl.h:3795
Array::Init
bool Init(size_t new_size)
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:314
CBB_init
#define CBB_init
Definition: boringssl_prefix_symbols.h:1047
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
CBS_get_u16
#define CBS_get_u16
Definition: boringssl_prefix_symbols.h:1073
Span::size
size_t size() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:133
ssl_size_t_greater_than_32_bits
static bool ssl_size_t_greater_than_32_bits(size_t v)
Definition: d1_both.cc:538
hm_header_st::frag_len
uint32_t frag_len
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2846
SSL_R_FRAGMENT_MISMATCH
#define SSL_R_FRAGMENT_MISMATCH
Definition: ssl.h:5420
cbs_st
Definition: bytestring.h:39
CBS_skip
#define CBS_skip
Definition: boringssl_prefix_symbols.h:1092
Array::data
const T * data() const
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:274
evp.h
CBS_data
#define CBS_data
Definition: boringssl_prefix_symbols.h:1057
dtls1_open_change_cipher_spec
ssl_open_record_t dtls1_open_change_cipher_spec(SSL *ssl, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: d1_both.cc:470
dtls1_parse_fragment
bool dtls1_parse_fragment(CBS *cbs, struct hm_header_st *out_hdr, CBS *out_body)
Definition: d1_both.cc:454
dtls1_get_message
bool dtls1_get_message(const SSL *ssl, SSLMessage *out)
Definition: d1_both.cc:407
SSL_R_BIO_NOT_SET
#define SSL_R_BIO_NOT_SET
Definition: ssl.h:5387
total
size_t total
Definition: cord_analysis.cc:59
OPENSSL_PUT_ERROR
#define OPENSSL_PUT_ERROR(library, reason)
Definition: err.h:423
internal.h
DTLS_OUTGOING_MESSAGE::Clear
void Clear()
Definition: d1_both.cc:490
string.h
CBB_add_u8
#define CBB_add_u8
Definition: boringssl_prefix_symbols.h:1036
SSL_AD_INTERNAL_ERROR
#define SSL_AD_INTERNAL_ERROR
Definition: ssl.h:3815
dtls1_use_epoch_t
dtls1_use_epoch_t
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1002
kMinMTU
static const BSSL_NAMESPACE_BEGIN unsigned int kMinMTU
Definition: d1_both.cc:137
BIO_CTRL_DGRAM_SET_MTU
#define BIO_CTRL_DGRAM_SET_MTU
Definition: bio.h:578
CBS_len
#define CBS_len
Definition: boringssl_prefix_symbols.h:1089
u
OPENSSL_EXPORT pem_password_cb void * u
Definition: pem.h:351
CBB_add_u24
#define CBB_add_u24
Definition: boringssl_prefix_symbols.h:1030
BIO_write
#define BIO_write
Definition: boringssl_prefix_symbols.h:870
cbs
const CBS * cbs
Definition: third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h:107
SSL_AD_ILLEGAL_PARAMETER
#define SSL_AD_ILLEGAL_PARAMETER
Definition: ssl.h:3807
hm_fragment
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2850
CBS_init
#define CBS_init
Definition: boringssl_prefix_symbols.h:1085
seal_no_progress
@ seal_no_progress
Definition: d1_both.cc:622
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
ssl_shutdown_none
@ ssl_shutdown_none
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2604
OPENSSL_memset
static void * OPENSSL_memset(void *dst, int c, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:835
ssl_max_handshake_message_len
size_t ssl_max_handshake_message_len(const SSL *ssl)
Definition: handshake.cc:230
seal_next_message
static enum seal_result_t seal_next_message(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out, const DTLS_OUTGOING_MESSAGE *msg)
Definition: d1_both.cc:630
kDefaultMTU
static const unsigned int kDefaultMTU
Definition: d1_both.cc:141
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
ssl_do_msg_callback
void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type, Span< const uint8_t > in)
Definition: ssl_lib.cc:329
dtls1_get_incoming_message
static hm_fragment * dtls1_get_incoming_message(SSL *ssl, uint8_t *out_alert, const struct hm_header_st *msg_hdr)
Definition: d1_both.cc:264
OPENSSL_malloc
#define OPENSSL_malloc
Definition: boringssl_prefix_symbols.h:1885
seal_error
@ seal_error
Definition: d1_both.cc:621
hm_fragment::reassembly
uint8_t * reassembly
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2870
hm_fragment::data
uint8_t * data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2867
hm_fragment::msg_len
uint32_t msg_len
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2864
add_outgoing
static bool add_outgoing(SSL *ssl, bool is_ccs, Array< uint8_t > data)
Definition: d1_both.cc:550
in
const char * in
Definition: third_party/abseil-cpp/absl/strings/internal/str_format/parser_test.cc:391
start
static uint64_t start
Definition: benchmark-pound.c:74
CBB_add_u16
#define CBB_add_u16
Definition: boringssl_prefix_symbols.h:1027
SSL_R_BAD_CHANGE_CIPHER_SPEC
#define SSL_R_BAD_CHANGE_CIPHER_SPEC
Definition: ssl.h:5371
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
Array< uint8_t >
ssl_open_record_discard
@ ssl_open_record_discard
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:935
Array::size
size_t size() const
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:276
ssl_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3698
dtls1_flush_flight
int dtls1_flush_flight(SSL *ssl)
Definition: d1_both.cc:813
BIO_ctrl
#define BIO_ctrl
Definition: boringssl_prefix_symbols.h:779
CBB_finish
#define CBB_finish
Definition: boringssl_prefix_symbols.h:1043
setup.v
v
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
dtls1_add_message
bool dtls1_add_message(SSL *ssl, Array< uint8_t > data)
Definition: d1_both.cc:591
hm_header_st::frag_off
uint32_t frag_off
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2845
SSL_R_UNEXPECTED_RECORD
#define SSL_R_UNEXPECTED_RECORD
Definition: ssl.h:5492
dtls1_retransmit_outgoing_messages
int dtls1_retransmit_outgoing_messages(SSL *ssl)
Definition: d1_both.cc:820
ssl_st::wbio
bssl::UniquePtr< BIO > wbio
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3723
bit_range
static uint8_t bit_range(size_t start, size_t end)
Definition: d1_both.cc:202
dtls1_update_mtu
static void dtls1_update_mtu(SSL *ssl)
Definition: d1_both.cc:601
OPENSSL_memcpy
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:819
BSSL_NAMESPACE_END
#define BSSL_NAMESPACE_END
Definition: base.h:480
CBS_get_u8
#define CBS_get_u8
Definition: boringssl_prefix_symbols.h:1082
err.h
ERR_R_INTERNAL_ERROR
#define ERR_R_INTERNAL_ERROR
Definition: err.h:374
hm_header_st
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2841
overhead
static const size_t overhead
Definition: php-upb.c:1485
SSL3_MT_CCS
#define SSL3_MT_CCS
Definition: ssl3.h:326
dtls_seal_record
bool dtls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out, uint8_t type, const uint8_t *in, size_t in_len, enum dtls1_use_epoch_t use_epoch)
Definition: dtls_record.cc:294
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
hm_header_st::type
uint8_t type
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2842
seal_success
@ seal_success
Definition: d1_both.cc:624
Span< uint8_t >
send_flight
static int send_flight(SSL *ssl)
Definition: d1_both.cc:768
dtls1_open_handshake
ssl_open_record_t dtls1_open_handshake(SSL *ssl, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: d1_both.cc:296
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
ERR_R_OVERFLOW
#define ERR_R_OVERFLOW
Definition: err.h:375
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
ssl.h
SSL_ERROR_WANT_WRITE
#define SSL_ERROR_WANT_WRITE
Definition: ssl.h:499
SSL3_RT_HANDSHAKE
#define SSL3_RT_HANDSHAKE
Definition: ssl3.h:273
ssl_open_record_t
ssl_open_record_t
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:933
hm_fragment::~hm_fragment
~hm_fragment()
Definition: d1_both.cc:146
SSLMessage
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1140
seal_next_packet
static bool seal_next_packet(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out)
Definition: d1_both.cc:725
dtls1_hm_fragment_mark
static void dtls1_hm_fragment_mark(hm_fragment *frag, size_t start, size_t end)
Definition: d1_both.cc:210
CBB_add_bytes
#define CBB_add_bytes
Definition: boringssl_prefix_symbols.h:1025
CBBFinishArray
OPENSSL_EXPORT bool CBBFinishArray(CBB *cbb, Array< uint8_t > *out)
Definition: ssl_lib.cc:190
BSSL_NAMESPACE_BEGIN
Definition: trust_token_test.cc:45
ssl_st::s3
bssl::SSL3_STATE * s3
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3730
SSL3_RT_CHANGE_CIPHER_SPEC
#define SSL3_RT_CHANGE_CIPHER_SPEC
Definition: ssl3.h:271
rand.h
BIO_CTRL_DGRAM_QUERY_MTU
#define BIO_CTRL_DGRAM_QUERY_MTU
Definition: bio.h:576
ssl_open_record_success
@ ssl_open_record_success
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:934
hm_header_st::seq
uint16_t seq
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2844
SSL_OP_NO_QUERY_MTU
#define SSL_OP_NO_QUERY_MTU
Definition: ssl.h:706
SSL_AD_DECODE_ERROR
#define SSL_AD_DECODE_ERROR
Definition: ssl.h:3810
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
ssl_st::d1
bssl::DTLS1_STATE * d1
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:3731
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
seal_result_t
seal_result_t
Definition: d1_both.cc:620
DTLS_OUTGOING_MESSAGE
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1183
dtls_seal_prefix_len
size_t dtls_seal_prefix_len(const SSL *ssl, enum dtls1_use_epoch_t use_epoch)
Definition: dtls_record.cc:289
SSL_R_MTU_TOO_SMALL
#define SSL_R_MTU_TOO_SMALL
Definition: ssl.h:5436
DTLS_OUTGOING_MESSAGE::data
uint8_t * data
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1191
ssl_open_record_error
@ ssl_open_record_error
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:938
dtls1_use_current_epoch
@ dtls1_use_current_epoch
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1004
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
dtls1_is_current_message_complete
static bool dtls1_is_current_message_complete(const SSL *ssl)
Definition: d1_both.cc:254
dtls_clear_outgoing_messages
void dtls_clear_outgoing_messages(SSL *ssl)
Definition: d1_both.cc:495
dtls1_add_change_cipher_spec
bool dtls1_add_change_cipher_spec(SSL *ssl)
Definition: d1_both.cc:595
dtls_open_record
enum ssl_open_record_t dtls_open_record(SSL *ssl, uint8_t *out_type, Span< uint8_t > *out, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
Definition: dtls_record.cc:177
CBS_get_bytes
#define CBS_get_bytes
Definition: boringssl_prefix_symbols.h:1067
SSL_get_options
#define SSL_get_options
Definition: boringssl_prefix_symbols.h:354
CBS_get_u24
#define CBS_get_u24
Definition: boringssl_prefix_symbols.h:1076
dtls_has_unprocessed_handshake_data
bool dtls_has_unprocessed_handshake_data(const SSL *ssl)
Definition: d1_both.cc:439
dtls1_use_previous_epoch
@ dtls1_use_previous_epoch
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1003
dtls1_init_message
bool dtls1_init_message(const SSL *ssl, CBB *cbb, CBB *body, uint8_t type)
Definition: d1_both.cc:506
hm_header_st::msg_len
uint32_t msg_len
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2843
Span::data
T * data() const
Definition: boringssl-with-bazel/src/include/openssl/span.h:132
dtls1_stop_timer
void dtls1_stop_timer(SSL *ssl)
Definition: d1_lib.cc:162
mem.h
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
BIO_flush
#define BIO_flush
Definition: boringssl_prefix_symbols.h:786
dtls1_hm_fragment_new
static UniquePtr< hm_fragment > dtls1_hm_fragment_new(const struct hm_header_st *msg_hdr)
Definition: d1_both.cc:151
SSL3_RT_APPLICATION_DATA
#define SSL3_RT_APPLICATION_DATA
Definition: ssl3.h:274
SSL_MAX_HANDSHAKE_FLIGHT
#define SSL_MAX_HANDSHAKE_FLIGHT
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:1153
dtls1_min_mtu
unsigned int dtls1_min_mtu(void)
Definition: d1_both.cc:831
dtls_max_seal_overhead
size_t dtls_max_seal_overhead(const SSL *ssl, enum dtls1_use_epoch_t use_epoch)
Definition: dtls_record.cc:284
OPENSSL_free
#define OPENSSL_free
Definition: boringssl_prefix_symbols.h:1869
mkowners.todo
todo
Definition: mkowners.py:209
absl::MakeSpan
constexpr Span< T > MakeSpan(T *ptr, size_t size) noexcept
Definition: abseil-cpp/absl/types/span.h:661
seal_partial
@ seal_partial
Definition: d1_both.cc:623
CBB_init_fixed
#define CBB_init_fixed
Definition: boringssl_prefix_symbols.h:1048
hm_fragment::type
uint8_t type
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2860
DTLS1_HM_HEADER_LENGTH
#define DTLS1_HM_HEADER_LENGTH
Definition: third_party/boringssl-with-bazel/src/ssl/internal.h:2835
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
ERR_R_MALLOC_FAILURE
#define ERR_R_MALLOC_FAILURE
Definition: err.h:371
SSL_R_EXCESSIVE_MESSAGE_SIZE
#define SSL_R_EXCESSIVE_MESSAGE_SIZE
Definition: ssl.h:5418
SSL_R_PROTOCOL_IS_SHUTDOWN
#define SSL_R_PROTOCOL_IS_SHUTDOWN
Definition: ssl.h:5461
dtls1_next_message
void dtls1_next_message(SSL *ssl)
Definition: d1_both.cc:425
cbb_st
Definition: bytestring.h:375
CBB_add_u24_length_prefixed
#define CBB_add_u24_length_prefixed
Definition: boringssl_prefix_symbols.h:1031
dtls1_finish_message
bool dtls1_finish_message(const SSL *ssl, CBB *cbb, Array< uint8_t > *out_msg)
Definition: d1_both.cc:520


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:08