Lines Matching refs:prot
150 static int tls_padding_length(struct tls_prot_info *prot, struct sk_buff *skb, in tls_padding_length() argument
158 if (prot->version == TLS_1_3_VERSION) { in tls_padding_length()
164 if (offset < prot->prepend_size) in tls_padding_length()
230 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_decryption() local
235 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_decryption()
237 data_len + prot->tag_size, in tls_do_decryption()
266 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_trim_both_msgs() local
272 target_size += prot->overhead_size; in tls_trim_both_msgs()
289 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_clone_plaintext_msg() local
305 skip = prot->prepend_size + msg_pl->sg.size; in tls_clone_plaintext_msg()
313 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_get_rec() local
332 sg_set_buf(&rec->sg_aead_in[0], rec->aad_space, prot->aad_size); in tls_get_rec()
336 sg_set_buf(&rec->sg_aead_out[0], rec->aad_space, prot->aad_size); in tls_get_rec()
425 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_encrypt_done() local
437 sge->offset -= prot->prepend_size; in tls_encrypt_done()
438 sge->length += prot->prepend_size; in tls_encrypt_done()
487 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_encryption() local
494 switch (prot->cipher_type) { in tls_do_encryption()
506 prot->iv_size + prot->salt_size); in tls_do_encryption()
508 tls_xor_iv_with_seq(prot, rec->iv_data + iv_offset, in tls_do_encryption()
511 sge->offset += prot->prepend_size; in tls_do_encryption()
512 sge->length -= prot->prepend_size; in tls_do_encryption()
517 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_encryption()
532 sge->offset -= prot->prepend_size; in tls_do_encryption()
533 sge->length += prot->prepend_size; in tls_do_encryption()
545 tls_advance_record_sn(sk, prot, &tls_ctx->tx); in tls_do_encryption()
671 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_push_record() local
690 prot->overhead_size > msg_en->sg.size) || in tls_push_record()
693 prot->overhead_size > msg_en->sg.size))) { in tls_push_record()
699 split_point, prot->overhead_size, in tls_push_record()
715 prot->overhead_size); in tls_push_record()
725 if (prot->version == TLS_1_3_VERSION) { in tls_push_record()
751 tls_make_aad(rec->aad_space, msg_pl->sg.size + prot->tail_size, in tls_push_record()
752 tls_ctx->tx.rec_seq, record_type, prot); in tls_push_record()
757 msg_pl->sg.size + prot->tail_size, in tls_push_record()
763 msg_pl->sg.size + prot->tail_size, i); in tls_push_record()
777 sk_msg_trim(sk, msg_en, msg_pl->sg.size + prot->overhead_size); in tls_push_record()
919 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_sendmsg() local
983 prot->overhead_size; in tls_sw_sendmsg()
1051 msg_pl->sg.size + prot->overhead_size); in tls_sw_sendmsg()
1145 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_do_sendpage() local
1187 required_size = msg_pl->sg.size + copy + prot->overhead_size; in tls_sw_do_sendpage()
1440 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sg() local
1448 const int data_len = rxm->full_len - prot->overhead_size; in tls_decrypt_sg()
1449 int tail_pages = !!prot->tail_size; in tls_decrypt_sg()
1455 n_sgin = skb_nsg(skb, rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1456 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1500 switch (prot->cipher_type) { in tls_decrypt_sg()
1512 if (prot->version == TLS_1_3_VERSION || in tls_decrypt_sg()
1513 prot->cipher_type == TLS_CIPHER_CHACHA20_POLY1305) { in tls_decrypt_sg()
1515 prot->iv_size + prot->salt_size); in tls_decrypt_sg()
1518 &dctx->iv[iv_offset] + prot->salt_size, in tls_decrypt_sg()
1519 prot->iv_size); in tls_decrypt_sg()
1522 memcpy(&dctx->iv[iv_offset], tls_ctx->rx.iv, prot->salt_size); in tls_decrypt_sg()
1524 tls_xor_iv_with_seq(prot, &dctx->iv[iv_offset], tls_ctx->rx.rec_seq); in tls_decrypt_sg()
1527 tls_make_aad(dctx->aad, rxm->full_len - prot->overhead_size + in tls_decrypt_sg()
1528 prot->tail_size, in tls_decrypt_sg()
1529 tls_ctx->rx.rec_seq, tlm->control, prot); in tls_decrypt_sg()
1533 sg_set_buf(&sgin[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1535 rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1536 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1542 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1544 err = skb_to_sgvec(clear_skb, &sgout[1], prot->prepend_size, in tls_decrypt_sg()
1545 data_len + prot->tail_size); in tls_decrypt_sg()
1550 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1557 if (prot->tail_size) { in tls_decrypt_sg()
1560 prot->tail_size); in tls_decrypt_sg()
1569 data_len + prot->tail_size, aead_req, darg); in tls_decrypt_sg()
1583 if (prot->tail_size) in tls_decrypt_sg()
1602 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sw() local
1615 if (unlikely(darg->zc && prot->version == TLS_1_3_VERSION && in tls_decrypt_sw()
1624 pad = tls_padding_length(prot, darg->skb, darg); in tls_decrypt_sw()
1642 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_device() local
1653 pad = tls_padding_length(prot, tls_strp_msg(ctx), darg); in tls_decrypt_device()
1660 darg->zc &= !(prot->version == TLS_1_3_VERSION && in tls_decrypt_device()
1677 off = rxm->offset + prot->prepend_size; in tls_decrypt_device()
1678 len = rxm->full_len - prot->overhead_size; in tls_decrypt_device()
1691 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_one_record() local
1702 rxm->offset += prot->prepend_size; in tls_rx_one_record()
1703 rxm->full_len -= prot->overhead_size; in tls_rx_one_record()
1704 tls_advance_record_sn(sk, prot, &tls_ctx->rx); in tls_rx_one_record()
1829 tls_read_flush_backlog(struct sock *sk, struct tls_prot_info *prot, in tls_read_flush_backlog() argument
1838 max_rec = prot->overhead_size - prot->tail_size + TLS_MAX_PAYLOAD_SIZE; in tls_read_flush_backlog()
1908 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_recvmsg() local
1977 to_decrypt = rxm->full_len - prot->overhead_size; in tls_sw_recvmsg()
2014 released = tls_read_flush_backlog(sk, prot, len, to_decrypt, in tls_sw_recvmsg()
2214 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_msg_size() local
2221 if (strp->stm.offset + prot->prepend_size > skb->len) in tls_rx_msg_size()
2225 if (WARN_ON(prot->prepend_size > sizeof(header))) { in tls_rx_msg_size()
2231 ret = skb_copy_bits(skb, strp->stm.offset, header, prot->prepend_size); in tls_rx_msg_size()
2239 cipher_overhead = prot->tag_size; in tls_rx_msg_size()
2240 if (prot->version != TLS_1_3_VERSION && in tls_rx_msg_size()
2241 prot->cipher_type != TLS_CIPHER_CHACHA20_POLY1305) in tls_rx_msg_size()
2242 cipher_overhead += prot->iv_size; in tls_rx_msg_size()
2245 prot->tail_size) { in tls_rx_msg_size()
2466 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_set_sw_offload() local
2673 prot->aad_size = TLS_HEADER_SIZE; in tls_set_sw_offload()
2674 prot->tail_size = 1; in tls_set_sw_offload()
2676 prot->aad_size = TLS_AAD_SPACE_SIZE; in tls_set_sw_offload()
2677 prot->tail_size = 0; in tls_set_sw_offload()
2683 prot->aad_size > TLS_MAX_AAD_SIZE) { in tls_set_sw_offload()
2688 prot->version = crypto_info->version; in tls_set_sw_offload()
2689 prot->cipher_type = crypto_info->cipher_type; in tls_set_sw_offload()
2690 prot->prepend_size = TLS_HEADER_SIZE + nonce_size; in tls_set_sw_offload()
2691 prot->tag_size = tag_size; in tls_set_sw_offload()
2692 prot->overhead_size = prot->prepend_size + in tls_set_sw_offload()
2693 prot->tag_size + prot->tail_size; in tls_set_sw_offload()
2694 prot->iv_size = iv_size; in tls_set_sw_offload()
2695 prot->salt_size = salt_size; in tls_set_sw_offload()
2702 prot->rec_seq_size = rec_seq_size; in tls_set_sw_offload()
2727 rc = crypto_aead_setauthsize(*aead, prot->tag_size); in tls_set_sw_offload()