Skip to content

Commit d3777ce

Browse files
committed
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 846366b commit d3777ce

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/tls/tls_sw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,16 @@ int tls_tx_records(struct sock *sk, int flags)
430430

431431
static void tls_encrypt_done(void *data, int err)
432432
{
433-
struct aead_request *aead_req = data;
434433
struct tls_sw_context_tx *ctx;
435434
struct tls_context *tls_ctx;
436435
struct tls_prot_info *prot;
436+
struct tls_rec *rec = data;
437437
struct scatterlist *sge;
438438
struct sk_msg *msg_en;
439-
struct tls_rec *rec;
440439
bool ready = false;
441440
struct sock *sk;
442441
int pending;
443442

444-
rec = container_of(aead_req, struct tls_rec, aead_req);
445443
msg_en = &rec->msg_encrypted;
446444

447445
sk = rec->sk;
@@ -536,7 +534,7 @@ static int tls_do_encryption(struct sock *sk,
536534
data_len, rec->iv_data);
537535

538536
aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG,
539-
tls_encrypt_done, aead_req);
537+
tls_encrypt_done, rec);
540538

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

0 commit comments

Comments
 (0)