Go to the documentation of this file.
122 #include "../crypto/err/internal.h"
123 #include "../crypto/internal.h"
134 assert(!ssl->
s3->aead_write_ctx->is_null_cipher());
136 *out_needs_handshake =
false;
144 assert(ssl->
s3->wnum <= INT_MAX);
145 unsigned tot = ssl->
s3->wnum;
160 const int is_early_data_write =
166 if (is_early_data_write) {
171 *out_needs_handshake =
true;
175 max_send_fragment,
size_t{hs->
early_session->ticket_max_early_data -
179 const size_t nw =
std::min(max_send_fragment,
size_t{
n});
186 if (is_early_data_write) {
187 ssl->
s3->hs->early_data_written +=
ret;
201 if (ssl->
s3->wpend_tot > (
int)
len ||
203 ssl->
s3->wpend_buf !=
in) ||
204 ssl->
s3->wpend_type !=
type) {
213 ssl->
s3->wpend_pending =
false;
214 return ssl->
s3->wpend_ret;
220 if (ssl->
s3->wpend_pending) {
234 size_t flight_len = 0;
235 if (ssl->
s3->pending_flight !=
nullptr) {
237 ssl->
s3->pending_flight->length - ssl->
s3->pending_flight_offset;
240 size_t max_out = flight_len;
243 if (max_ciphertext_len <
len || max_out + max_ciphertext_len < max_out) {
247 max_out += max_ciphertext_len;
262 if (ssl->
s3->pending_flight !=
nullptr) {
264 buf->remaining().data(),
265 ssl->
s3->pending_flight->data + ssl->
s3->pending_flight_offset,
267 ssl->
s3->pending_flight.reset();
268 ssl->
s3->pending_flight_offset = 0;
269 buf->DidWrite(flight_len);
273 size_t ciphertext_len;
278 buf->DidWrite(ciphertext_len);
283 ssl->
s3->key_update_pending =
false;
287 ssl->
s3->wpend_tot =
len;
288 ssl->
s3->wpend_buf =
in;
289 ssl->
s3->wpend_type =
type;
290 ssl->
s3->wpend_ret =
len;
291 ssl->
s3->wpend_pending =
true;
298 size_t *out_consumed,
uint8_t *out_alert,
301 assert(!ssl->
s3->aead_read_ctx->is_null_cipher());
335 if (is_early_data_read) {
342 ssl->
s3->hs->early_data_read += body.
size();
411 ssl->
s3->alert_dispatch =
true;
412 ssl->
s3->send_alert[0] =
level;
413 ssl->
s3->send_alert[1] =
desc;
414 if (ssl->
s3->write_buffer.empty()) {
417 return ssl->
method->dispatch_alert(ssl);
427 ssl->
s3->send_alert[1])) {
438 ssl->
s3->alert_dispatch =
false;
447 int alert = (ssl->
s3->send_alert[0] << 8) | ssl->
s3->send_alert[1];
int ssl_send_alert_impl(SSL *ssl, int level, int desc)
#define SSL3_AD_UNEXPECTED_MESSAGE
#define SSL_AD_UNEXPECTED_MESSAGE
enum ssl_open_record_t tls_open_record(SSL *ssl, uint8_t *out_type, Span< uint8_t > *out, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
#define OPENSSL_PUT_ERROR(library, reason)
#define SSL_R_QUIC_INTERNAL_ERROR
#define SSL_AD_INTERNAL_ERROR
#define SSL_max_seal_overhead
UniquePtr< SSL_SESSION > early_session
ssl_open_record_t tls_open_app_data(SSL *ssl, Span< uint8_t > *out, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
#define SSL_AD_ILLEGAL_PARAMETER
const SSL_QUIC_METHOD * quic_method
static int tls_write_pending(SSL *ssl, int type, const uint8_t *in, unsigned int len)
void ssl_do_msg_callback(const SSL *ssl, int is_write, int content_type, Span< const uint8_t > in)
#define SSL_CB_WRITE_ALERT
#define SSL3_RT_MAX_PLAIN_LENGTH
#define SSL_R_BAD_CHANGE_CIPHER_SPEC
@ ssl_open_record_discard
int tls_dispatch_alert(SSL *ssl)
#define SSL_R_UNEXPECTED_RECORD
ssl_open_record_t tls_open_change_cipher_spec(SSL *ssl, size_t *out_consumed, uint8_t *out_alert, Span< uint8_t > in)
bssl::UniquePtr< BIO > wbio
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
#define BSSL_NAMESPACE_END
bool ssl_can_write(const SSL *ssl)
#define ERR_R_INTERNAL_ERROR
uint16_t ssl_protocol_version(const SSL *ssl)
#define SSL_AD_NO_RENEGOTIATION
bool ssl_can_read(const SSL *ssl)
bool tls_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)
#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
#define SSL_R_BAD_WRITE_RETRY
size_t ssl_seal_align_prefix_len(const SSL *ssl)
int tls_write_app_data(SSL *ssl, bool *out_needs_handshake, const uint8_t *in, int len)
#define SSL_AD_CLOSE_NOTIFY
static const size_t kMaxEarlyDataAccepted
uint16_t early_data_written
#define SSL3_RT_HANDSHAKE
#define ERR_restore_state
#define SSL3_RT_CHANGE_CIPHER_SPEC
@ ssl_open_record_success
#define SSL_MODE_ENABLE_PARTIAL_WRITE
UniquePtr< SSL_SESSION > ret
uint16_t max_send_fragment
const bssl::SSL_PROTOCOL_METHOD * method
@ ssl_shutdown_close_notify
int ssl_write_buffer_flush(SSL *ssl)
void ssl_do_info_callback(const SSL *ssl, int type, int value)
int(* send_alert)(SSL *ssl, enum ssl_encryption_level_t level, uint8_t alert)
#define SSL_in_early_data
#define SSL_R_TOO_MUCH_READ_EARLY_DATA
bool tls_flush_pending_hs_data(SSL *ssl)
#define SSL3_RT_APPLICATION_DATA
void ssl_send_alert(SSL *ssl, int level, int desc)
static BSSL_NAMESPACE_BEGIN int do_tls_write(SSL *ssl, int type, const uint8_t *in, unsigned len)
bool tls_append_handshake_data(SSL *ssl, Span< const uint8_t > data)
#define SSL_R_NO_RENEGOTIATION
#define SSL_R_PROTOCOL_IS_SHUTDOWN
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:09