mirror of
https://github.com/torvalds/linux
synced 2024-10-06 19:34:19 +00:00
tls: Pass rec instead of aead_req into tls_encrypt_done
The function tls_encrypt_done only uses aead_req to get ahold of the tls_rec object. So we could pass that in instead of aead_req to simplify the code. Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
846366b0df
commit
d3777ceaad
|
@ -430,18 +430,16 @@ int tls_tx_records(struct sock *sk, int flags)
|
||||||
|
|
||||||
static void tls_encrypt_done(void *data, int err)
|
static void tls_encrypt_done(void *data, int err)
|
||||||
{
|
{
|
||||||
struct aead_request *aead_req = data;
|
|
||||||
struct tls_sw_context_tx *ctx;
|
struct tls_sw_context_tx *ctx;
|
||||||
struct tls_context *tls_ctx;
|
struct tls_context *tls_ctx;
|
||||||
struct tls_prot_info *prot;
|
struct tls_prot_info *prot;
|
||||||
|
struct tls_rec *rec = data;
|
||||||
struct scatterlist *sge;
|
struct scatterlist *sge;
|
||||||
struct sk_msg *msg_en;
|
struct sk_msg *msg_en;
|
||||||
struct tls_rec *rec;
|
|
||||||
bool ready = false;
|
bool ready = false;
|
||||||
struct sock *sk;
|
struct sock *sk;
|
||||||
int pending;
|
int pending;
|
||||||
|
|
||||||
rec = container_of(aead_req, struct tls_rec, aead_req);
|
|
||||||
msg_en = &rec->msg_encrypted;
|
msg_en = &rec->msg_encrypted;
|
||||||
|
|
||||||
sk = rec->sk;
|
sk = rec->sk;
|
||||||
|
@ -536,7 +534,7 @@ static int tls_do_encryption(struct sock *sk,
|
||||||
data_len, rec->iv_data);
|
data_len, rec->iv_data);
|
||||||
|
|
||||||
aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
|
||||||
tls_encrypt_done, aead_req);
|
tls_encrypt_done, rec);
|
||||||
|
|
||||||
/* Add the record in tx_list */
|
/* Add the record in tx_list */
|
||||||
list_add_tail((struct list_head *)&rec->list, &ctx->tx_list);
|
list_add_tail((struct list_head *)&rec->list, &ctx->tx_list);
|
||||||
|
|
Loading…
Reference in a new issue