Lines Matching refs:msg

39 	struct tls13_handshake_msg *msg = NULL;
41 if ((msg = calloc(1, sizeof(struct tls13_handshake_msg))) == NULL)
43 if ((msg->buf = tls_buffer_new(0)) == NULL)
46 return msg;
49 tls13_handshake_msg_free(msg);
55 tls13_handshake_msg_free(struct tls13_handshake_msg *msg)
57 if (msg == NULL)
60 tls_buffer_free(msg->buf);
62 CBB_cleanup(&msg->cbb);
64 freezero(msg->data, msg->data_len);
65 freezero(msg, sizeof(struct tls13_handshake_msg));
69 tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs)
71 CBS_init(cbs, msg->data, msg->data_len);
75 tls13_handshake_msg_type(struct tls13_handshake_msg *msg)
77 return msg->msg_type;
81 tls13_handshake_msg_content(struct tls13_handshake_msg *msg, CBS *cbs)
83 tls13_handshake_msg_data(msg, cbs);
89 tls13_handshake_msg_start(struct tls13_handshake_msg *msg, CBB *body,
92 if (!CBB_init(&msg->cbb, TLS13_HANDSHAKE_MSG_INITIAL_LEN))
94 if (!CBB_add_u8(&msg->cbb, msg_type))
96 if (!CBB_add_u24_length_prefixed(&msg->cbb, body))
103 tls13_handshake_msg_finish(struct tls13_handshake_msg *msg)
105 if (!CBB_finish(&msg->cbb, &msg->data, &msg->data_len))
108 CBS_init(&msg->cbs, msg->data, msg->data_len);
122 tls13_handshake_msg_recv(struct tls13_handshake_msg *msg,
130 if (msg->data != NULL)
133 if (msg->msg_type == 0) {
134 if ((ret = tls_buffer_extend(msg->buf,
139 if (!tls_buffer_data(msg->buf, &cbs))
151 msg->msg_type = msg_type;
152 msg->msg_len = msg_len;
155 if ((ret = tls_buffer_extend(msg->buf,
156 TLS13_HANDSHAKE_MSG_HEADER_LEN + msg->msg_len,
160 if (!tls_buffer_finish(msg->buf, &msg->data, &msg->data_len))
167 tls13_handshake_msg_send(struct tls13_handshake_msg *msg,
172 if (msg->data == NULL)
175 if (CBS_len(&msg->cbs) == 0)
178 while (CBS_len(&msg->cbs) > 0) {
179 if ((ret = tls13_write_handshake_data(rl, CBS_data(&msg->cbs),
180 CBS_len(&msg->cbs))) <= 0)
183 if (!CBS_skip(&msg->cbs, ret))