Lines Matching refs:prot

153 static int tls_padding_length(struct tls_prot_info *prot, struct sk_buff *skb,  in tls_padding_length()  argument
161 if (prot->version == TLS_1_3_VERSION) { in tls_padding_length()
167 if (offset < prot->prepend_size) in tls_padding_length()
240 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_decryption() local
245 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_decryption()
247 data_len + prot->tag_size, in tls_do_decryption()
276 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_trim_both_msgs() local
282 target_size += prot->overhead_size; in tls_trim_both_msgs()
299 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_clone_plaintext_msg() local
315 skip = prot->prepend_size + msg_pl->sg.size; in tls_clone_plaintext_msg()
323 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_get_rec() local
342 sg_set_buf(&rec->sg_aead_in[0], rec->aad_space, prot->aad_size); in tls_get_rec()
346 sg_set_buf(&rec->sg_aead_out[0], rec->aad_space, prot->aad_size); in tls_get_rec()
436 struct tls_prot_info *prot; in tls_encrypt_done() local
448 prot = &tls_ctx->prot_info; in tls_encrypt_done()
452 sge->offset -= prot->prepend_size; in tls_encrypt_done()
453 sge->length += prot->prepend_size; in tls_encrypt_done()
502 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_do_encryption() local
509 switch (prot->cipher_type) { in tls_do_encryption()
521 prot->iv_size + prot->salt_size); in tls_do_encryption()
523 tls_xor_iv_with_seq(prot, rec->iv_data + iv_offset, in tls_do_encryption()
526 sge->offset += prot->prepend_size; in tls_do_encryption()
527 sge->length -= prot->prepend_size; in tls_do_encryption()
532 aead_request_set_ad(aead_req, prot->aad_size); in tls_do_encryption()
547 sge->offset -= prot->prepend_size; in tls_do_encryption()
548 sge->length += prot->prepend_size; in tls_do_encryption()
560 tls_advance_record_sn(sk, prot, &tls_ctx->tx); in tls_do_encryption()
686 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_push_record() local
705 prot->overhead_size > msg_en->sg.size) || in tls_push_record()
708 prot->overhead_size > msg_en->sg.size))) { in tls_push_record()
714 split_point, prot->overhead_size, in tls_push_record()
730 prot->overhead_size); in tls_push_record()
740 if (prot->version == TLS_1_3_VERSION) { in tls_push_record()
766 tls_make_aad(rec->aad_space, msg_pl->sg.size + prot->tail_size, in tls_push_record()
767 tls_ctx->tx.rec_seq, record_type, prot); in tls_push_record()
772 msg_pl->sg.size + prot->tail_size, in tls_push_record()
778 msg_pl->sg.size + prot->tail_size, i); in tls_push_record()
792 sk_msg_trim(sk, msg_en, msg_pl->sg.size + prot->overhead_size); in tls_push_record()
936 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_sendmsg() local
1002 prot->overhead_size; in tls_sw_sendmsg()
1070 msg_pl->sg.size + prot->overhead_size); in tls_sw_sendmsg()
1164 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_do_sendpage() local
1206 required_size = msg_pl->sg.size + copy + prot->overhead_size; in tls_sw_do_sendpage()
1461 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sg() local
1469 const int data_len = rxm->full_len - prot->overhead_size; in tls_decrypt_sg()
1470 int tail_pages = !!prot->tail_size; in tls_decrypt_sg()
1476 n_sgin = skb_nsg(skb, rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1477 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1523 switch (prot->cipher_type) { in tls_decrypt_sg()
1535 if (prot->version == TLS_1_3_VERSION || in tls_decrypt_sg()
1536 prot->cipher_type == TLS_CIPHER_CHACHA20_POLY1305) { in tls_decrypt_sg()
1538 prot->iv_size + prot->salt_size); in tls_decrypt_sg()
1541 &dctx->iv[iv_offset] + prot->salt_size, in tls_decrypt_sg()
1542 prot->iv_size); in tls_decrypt_sg()
1545 memcpy(&dctx->iv[iv_offset], tls_ctx->rx.iv, prot->salt_size); in tls_decrypt_sg()
1547 tls_xor_iv_with_seq(prot, &dctx->iv[iv_offset], tls_ctx->rx.rec_seq); in tls_decrypt_sg()
1550 tls_make_aad(dctx->aad, rxm->full_len - prot->overhead_size + in tls_decrypt_sg()
1551 prot->tail_size, in tls_decrypt_sg()
1552 tls_ctx->rx.rec_seq, tlm->control, prot); in tls_decrypt_sg()
1556 sg_set_buf(&sgin[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1558 rxm->offset + prot->prepend_size, in tls_decrypt_sg()
1559 rxm->full_len - prot->prepend_size); in tls_decrypt_sg()
1565 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1567 err = skb_to_sgvec(clear_skb, &sgout[1], prot->prepend_size, in tls_decrypt_sg()
1568 data_len + prot->tail_size); in tls_decrypt_sg()
1573 sg_set_buf(&sgout[0], dctx->aad, prot->aad_size); in tls_decrypt_sg()
1580 if (prot->tail_size) { in tls_decrypt_sg()
1583 prot->tail_size); in tls_decrypt_sg()
1592 data_len + prot->tail_size, aead_req, darg); in tls_decrypt_sg()
1606 if (prot->tail_size) in tls_decrypt_sg()
1625 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_sw() local
1638 if (unlikely(darg->zc && prot->version == TLS_1_3_VERSION && in tls_decrypt_sw()
1647 pad = tls_padding_length(prot, darg->skb, darg); in tls_decrypt_sw()
1665 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_decrypt_device() local
1676 pad = tls_padding_length(prot, tls_strp_msg(ctx), darg); in tls_decrypt_device()
1683 darg->zc &= !(prot->version == TLS_1_3_VERSION && in tls_decrypt_device()
1700 off = rxm->offset + prot->prepend_size; in tls_decrypt_device()
1701 len = rxm->full_len - prot->overhead_size; in tls_decrypt_device()
1714 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_one_record() local
1725 rxm->offset += prot->prepend_size; in tls_rx_one_record()
1726 rxm->full_len -= prot->overhead_size; in tls_rx_one_record()
1727 tls_advance_record_sn(sk, prot, &tls_ctx->rx); in tls_rx_one_record()
1852 tls_read_flush_backlog(struct sock *sk, struct tls_prot_info *prot, in tls_read_flush_backlog() argument
1861 max_rec = prot->overhead_size - prot->tail_size + TLS_MAX_PAYLOAD_SIZE; in tls_read_flush_backlog()
1931 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_sw_recvmsg() local
2000 to_decrypt = rxm->full_len - prot->overhead_size; in tls_sw_recvmsg()
2037 released = tls_read_flush_backlog(sk, prot, len, to_decrypt, in tls_sw_recvmsg()
2237 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_rx_msg_size() local
2244 if (strp->stm.offset + prot->prepend_size > skb->len) in tls_rx_msg_size()
2248 if (WARN_ON(prot->prepend_size > sizeof(header))) { in tls_rx_msg_size()
2254 ret = skb_copy_bits(skb, strp->stm.offset, header, prot->prepend_size); in tls_rx_msg_size()
2262 cipher_overhead = prot->tag_size; in tls_rx_msg_size()
2263 if (prot->version != TLS_1_3_VERSION && in tls_rx_msg_size()
2264 prot->cipher_type != TLS_CIPHER_CHACHA20_POLY1305) in tls_rx_msg_size()
2265 cipher_overhead += prot->iv_size; in tls_rx_msg_size()
2268 prot->tail_size) { in tls_rx_msg_size()
2499 struct tls_prot_info *prot = &tls_ctx->prot_info; in tls_set_sw_offload() local
2706 prot->aad_size = TLS_HEADER_SIZE; in tls_set_sw_offload()
2707 prot->tail_size = 1; in tls_set_sw_offload()
2709 prot->aad_size = TLS_AAD_SPACE_SIZE; in tls_set_sw_offload()
2710 prot->tail_size = 0; in tls_set_sw_offload()
2716 prot->aad_size > TLS_MAX_AAD_SIZE) { in tls_set_sw_offload()
2721 prot->version = crypto_info->version; in tls_set_sw_offload()
2722 prot->cipher_type = crypto_info->cipher_type; in tls_set_sw_offload()
2723 prot->prepend_size = TLS_HEADER_SIZE + nonce_size; in tls_set_sw_offload()
2724 prot->tag_size = tag_size; in tls_set_sw_offload()
2725 prot->overhead_size = prot->prepend_size + in tls_set_sw_offload()
2726 prot->tag_size + prot->tail_size; in tls_set_sw_offload()
2727 prot->iv_size = iv_size; in tls_set_sw_offload()
2728 prot->salt_size = salt_size; in tls_set_sw_offload()
2735 prot->rec_seq_size = rec_seq_size; in tls_set_sw_offload()
2760 rc = crypto_aead_setauthsize(*aead, prot->tag_size); in tls_set_sw_offload()