Re: [PATCH 8/17] tls: Only use data field in crypto completion function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 06 Feb 2023 18:22:27 +0800 Herbert Xu wrote:
> -static void tls_encrypt_done(struct crypto_async_request *req, int err)
> +static void tls_encrypt_done(crypto_completion_data_t *data, int err)
>  {
> -	struct aead_request *aead_req = (struct aead_request *)req;
> -	struct sock *sk = req->data;
> -	struct tls_context *tls_ctx = tls_get_ctx(sk);
> -	struct tls_prot_info *prot = &tls_ctx->prot_info;
> -	struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx);
> +	struct aead_request *aead_req = crypto_get_completion_data(data);

All we use aead_req for in this function now is to find rec...

> +	struct tls_sw_context_tx *ctx;
> +	struct tls_context *tls_ctx;
> +	struct tls_prot_info *prot;
>  	struct scatterlist *sge;
>  	struct sk_msg *msg_en;
>  	struct tls_rec *rec;
>  	bool ready = false;
> +	struct sock *sk;
>  	int pending;
>  
>  	rec = container_of(aead_req, struct tls_rec, aead_req);
>  	msg_en = &rec->msg_encrypted;
>  
> +	sk = rec->sk;
> +	tls_ctx = tls_get_ctx(sk);
> +	prot = &tls_ctx->prot_info;
> +	ctx = tls_sw_ctx_tx(tls_ctx);
> +
>  	sge = sk_msg_elem(msg_en, msg_en->sg.curr);
>  	sge->offset -= prot->prepend_size;
>  	sge->length += prot->prepend_size;
> @@ -520,7 +536,7 @@ static int tls_do_encryption(struct sock *sk,
>  			       data_len, rec->iv_data);
>  
>  	aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> -				  tls_encrypt_done, sk);
> +				  tls_encrypt_done, aead_req);

... let's just pass rec instead of aead_req here, then?

>  	/* Add the record in tx_list */
>  	list_add_tail((struct list_head *)&rec->list, &ctx->tx_list);



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux