Skip to content

Commit

Permalink
net/tls: store decrypted on a single bit
Browse files Browse the repository at this point in the history
Use a single bit instead of boolean to remember if packet
was already decrypted.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Oct 7, 2019
1 parent 5c5458e commit bc76e5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/net/tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ struct tls_sw_context_rx {
struct sk_buff *recv_pkt;
u8 control;
u8 async_capable:1;
bool decrypted;
u8 decrypted:1;
atomic_t decrypt_pending;
bool async_notify;
};
Expand Down
6 changes: 3 additions & 3 deletions net/tls/tls_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
rxm->offset += prot->prepend_size;
rxm->full_len -= prot->overhead_size;
tls_advance_record_sn(sk, prot, &tls_ctx->rx);
ctx->decrypted = true;
ctx->decrypted = 1;
ctx->saved_data_ready(sk);
} else {
*zc = false;
Expand Down Expand Up @@ -1933,7 +1933,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
tls_err_abort(sk, EBADMSG);
goto splice_read_end;
}
ctx->decrypted = true;
ctx->decrypted = 1;
}
rxm = strp_msg(skb);

Expand Down Expand Up @@ -2034,7 +2034,7 @@ static void tls_queue(struct strparser *strp, struct sk_buff *skb)
struct tls_context *tls_ctx = tls_get_ctx(strp->sk);
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);

ctx->decrypted = false;
ctx->decrypted = 0;

ctx->recv_pkt = skb;
strp_pause(strp);
Expand Down

0 comments on commit bc76e5b

Please sign in to comment.