Lines Matching refs:prot
155 static int tls_padding_length(struct tls_prot_info *prot, struct sk_buff *skb, in tls_padding_length() argument
163 if (prot->version == TLS_1_3_VERSION) { in tls_padding_length()
169 if (offset < prot->prepend_size) in tls_padding_length()
242 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_decryption() local
247 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_decryption()
249 data_len + prot->tag_size, in tls_do_decryption()
278 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_trim_both_msgs() local
284 target_size += prot->overhead_size; in tls_trim_both_msgs()
301 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_clone_plaintext_msg() local
317 skip = prot->prepend_size + msg_pl->sg.size; in tls_clone_plaintext_msg()
325 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_get_rec() local
344 sg_set_buf(&rec->sg_aead_in[0], rec->aad_space, prot->aad_size); in tls_get_rec()
348 sg_set_buf(&rec->sg_aead_out[0], rec->aad_space, prot->aad_size); in tls_get_rec()
438 struct tls_prot_info *prot; in tls_encrypt_done() local
450 prot = &tls_ctx->prot_info; in tls_encrypt_done()
454 sge->offset -= prot->prepend_size; in tls_encrypt_done()
455 sge->length += prot->prepend_size; in tls_encrypt_done()
504 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_encryption() local
511 switch (prot->cipher_type) { in tls_do_encryption()
523 prot->iv_size + prot->salt_size); in tls_do_encryption()
525 tls_xor_iv_with_seq(prot, rec->iv_data + iv_offset, in tls_do_encryption()
528 sge->offset += prot->prepend_size; in tls_do_encryption()
529 sge->length -= prot->prepend_size; in tls_do_encryption()
534 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_encryption()
549 sge->offset -= prot->prepend_size; in tls_do_encryption()
550 sge->length += prot->prepend_size; in tls_do_encryption()
562 tls_advance_record_sn(sk, prot, &tls_ctx->tx); in tls_do_encryption()
688 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_push_record() local
707 prot->overhead_size > msg_en->sg.size) || in tls_push_record()
710 prot->overhead_size > msg_en->sg.size))) { in tls_push_record()
716 split_point, prot->overhead_size, in tls_push_record()
732 prot->overhead_size); in tls_push_record()
742 if (prot->version == TLS_1_3_VERSION) { in tls_push_record()
768 tls_make_aad(rec->aad_space, msg_pl->sg.size + prot->tail_size, in tls_push_record()
769 tls_ctx->tx.rec_seq, record_type, prot); in tls_push_record()
774 msg_pl->sg.size + prot->tail_size, in tls_push_record()
780 msg_pl->sg.size + prot->tail_size, i); in tls_push_record()
794 sk_msg_trim(sk, msg_en, msg_pl->sg.size + prot->overhead_size); in tls_push_record()
968 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_sendmsg_locked() local
1028 prot->overhead_size; in tls_sw_sendmsg_locked()
1107 msg_pl->sg.size + prot->overhead_size); in tls_sw_sendmsg_locked()
1447 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sg() local
1455 const int data_len = rxm->full_len - prot->overhead_size; in tls_decrypt_sg()
1456 int tail_pages = !!prot->tail_size; in tls_decrypt_sg()
1462 n_sgin = skb_nsg(skb, rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1463 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1509 switch (prot->cipher_type) { in tls_decrypt_sg()
1521 if (prot->version == TLS_1_3_VERSION || in tls_decrypt_sg()
1522 prot->cipher_type == TLS_CIPHER_CHACHA20_POLY1305) { in tls_decrypt_sg()
1524 prot->iv_size + prot->salt_size); in tls_decrypt_sg()
1527 &dctx->iv[iv_offset] + prot->salt_size, in tls_decrypt_sg()
1528 prot->iv_size); in tls_decrypt_sg()
1531 memcpy(&dctx->iv[iv_offset], tls_ctx->rx.iv, prot->salt_size); in tls_decrypt_sg()
1533 tls_xor_iv_with_seq(prot, &dctx->iv[iv_offset], tls_ctx->rx.rec_seq); in tls_decrypt_sg()
1536 tls_make_aad(dctx->aad, rxm->full_len - prot->overhead_size + in tls_decrypt_sg()
1537 prot->tail_size, in tls_decrypt_sg()
1538 tls_ctx->rx.rec_seq, tlm->control, prot); in tls_decrypt_sg()
1542 sg_set_buf(&sgin[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1544 rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1545 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1551 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1553 err = skb_to_sgvec(clear_skb, &sgout[1], prot->prepend_size, in tls_decrypt_sg()
1554 data_len + prot->tail_size); in tls_decrypt_sg()
1559 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1566 if (prot->tail_size) { in tls_decrypt_sg()
1569 prot->tail_size); in tls_decrypt_sg()
1578 data_len + prot->tail_size, aead_req, darg); in tls_decrypt_sg()
1592 if (prot->tail_size) in tls_decrypt_sg()
1611 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sw() local
1624 if (unlikely(darg->zc && prot->version == TLS_1_3_VERSION && in tls_decrypt_sw()
1633 pad = tls_padding_length(prot, darg->skb, darg); in tls_decrypt_sw()
1651 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_device() local
1662 pad = tls_padding_length(prot, tls_strp_msg(ctx), darg); in tls_decrypt_device()
1669 darg->zc &= !(prot->version == TLS_1_3_VERSION && in tls_decrypt_device()
1686 off = rxm->offset + prot->prepend_size; in tls_decrypt_device()
1687 len = rxm->full_len - prot->overhead_size; in tls_decrypt_device()
1700 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_one_record() local
1711 rxm->offset += prot->prepend_size; in tls_rx_one_record()
1712 rxm->full_len -= prot->overhead_size; in tls_rx_one_record()
1713 tls_advance_record_sn(sk, prot, &tls_ctx->rx); in tls_rx_one_record()
1838 tls_read_flush_backlog(struct sock *sk, struct tls_prot_info *prot, in tls_read_flush_backlog() argument
1847 max_rec = prot->overhead_size - prot->tail_size + TLS_MAX_PAYLOAD_SIZE; in tls_read_flush_backlog()
1926 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_recvmsg() local
1995 to_decrypt = rxm->full_len - prot->overhead_size; in tls_sw_recvmsg()
2032 released = tls_read_flush_backlog(sk, prot, len, to_decrypt, in tls_sw_recvmsg()
2217 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_read_sock() local
2263 released = tls_read_flush_backlog(sk, prot, INT_MAX, in tls_sw_read_sock()
2328 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_msg_size() local
2335 if (strp->stm.offset + prot->prepend_size > skb->len) in tls_rx_msg_size()
2339 if (WARN_ON(prot->prepend_size > sizeof(header))) { in tls_rx_msg_size()
2345 ret = skb_copy_bits(skb, strp->stm.offset, header, prot->prepend_size); in tls_rx_msg_size()
2353 cipher_overhead = prot->tag_size; in tls_rx_msg_size()
2354 if (prot->version != TLS_1_3_VERSION && in tls_rx_msg_size()
2355 prot->cipher_type != TLS_CIPHER_CHACHA20_POLY1305) in tls_rx_msg_size()
2356 cipher_overhead += prot->iv_size; in tls_rx_msg_size()
2359 prot->tail_size) { in tls_rx_msg_size()
2594 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_set_sw_offload() local
2672 prot->aad_size = TLS_HEADER_SIZE; in tls_set_sw_offload()
2673 prot->tail_size = 1; in tls_set_sw_offload()
2675 prot->aad_size = TLS_AAD_SPACE_SIZE; in tls_set_sw_offload()
2676 prot->tail_size = 0; in tls_set_sw_offload()
2680 if (nonce_size > MAX_IV_SIZE || prot->aad_size > TLS_MAX_AAD_SIZE) { in tls_set_sw_offload()
2685 prot->version = crypto_info->version; in tls_set_sw_offload()
2686 prot->cipher_type = crypto_info->cipher_type; in tls_set_sw_offload()
2687 prot->prepend_size = TLS_HEADER_SIZE + nonce_size; in tls_set_sw_offload()
2688 prot->tag_size = cipher_desc->tag; in tls_set_sw_offload()
2689 prot->overhead_size = prot->prepend_size + in tls_set_sw_offload()
2690 prot->tag_size + prot->tail_size; in tls_set_sw_offload()
2691 prot->iv_size = cipher_desc->iv; in tls_set_sw_offload()
2692 prot->salt_size = cipher_desc->salt; in tls_set_sw_offload()
2699 prot->rec_seq_size = cipher_desc->rec_seq; in tls_set_sw_offload()
2724 rc = crypto_aead_setauthsize(*aead, prot->tag_size); in tls_set_sw_offload()