#include <linux/bug.h>
#include <linux/sched/signal.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/splice.h>
#include <crypto/aead.h>
#include <net/strparser.h>
#include <net/tls.h>
#include <trace/events/sock.h>
#include "tls.h"
struct tls_decrypt_arg { … };
struct tls_decrypt_ctx { … };
noinline void tls_err_abort(struct sock *sk, int err)
{ … }
static int __skb_nsg(struct sk_buff *skb, int offset, int len,
unsigned int recursion_level)
{ … }
static int skb_nsg(struct sk_buff *skb, int offset, int len)
{ … }
static int tls_padding_length(struct tls_prot_info *prot, struct sk_buff *skb,
struct tls_decrypt_arg *darg)
{ … }
static void tls_decrypt_done(void *data, int err)
{ … }
static int tls_decrypt_async_wait(struct tls_sw_context_rx *ctx)
{ … }
static int tls_do_decryption(struct sock *sk,
struct scatterlist *sgin,
struct scatterlist *sgout,
char *iv_recv,
size_t data_len,
struct aead_request *aead_req,
struct tls_decrypt_arg *darg)
{ … }
static void tls_trim_both_msgs(struct sock *sk, int target_size)
{ … }
static int tls_alloc_encrypted_msg(struct sock *sk, int len)
{ … }
static int tls_clone_plaintext_msg(struct sock *sk, int required)
{ … }
static struct tls_rec *tls_get_rec(struct sock *sk)
{ … }
static void tls_free_rec(struct sock *sk, struct tls_rec *rec)
{ … }
static void tls_free_open_rec(struct sock *sk)
{ … }
int tls_tx_records(struct sock *sk, int flags)
{ … }
static void tls_encrypt_done(void *data, int err)
{ … }
static int tls_encrypt_async_wait(struct tls_sw_context_tx *ctx)
{ … }
static int tls_do_encryption(struct sock *sk,
struct tls_context *tls_ctx,
struct tls_sw_context_tx *ctx,
struct aead_request *aead_req,
size_t data_len, u32 start)
{ … }
static int tls_split_open_record(struct sock *sk, struct tls_rec *from,
struct tls_rec **to, struct sk_msg *msg_opl,
struct sk_msg *msg_oen, u32 split_point,
u32 tx_overhead_size, u32 *orig_end)
{ … }
static void tls_merge_open_record(struct sock *sk, struct tls_rec *to,
struct tls_rec *from, u32 orig_end)
{ … }
static int tls_push_record(struct sock *sk, int flags,
unsigned char record_type)
{ … }
static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk,
bool full_record, u8 record_type,
ssize_t *copied, int flags)
{ … }
static int tls_sw_push_pending_record(struct sock *sk, int flags)
{ … }
static int tls_sw_sendmsg_splice(struct sock *sk, struct msghdr *msg,
struct sk_msg *msg_pl, size_t try_to_copy,
ssize_t *copied)
{ … }
static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,
size_t size)
{ … }
int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
{ … }
void tls_sw_splice_eof(struct socket *sock)
{ … }
static int
tls_rx_rec_wait(struct sock *sk, struct sk_psock *psock, bool nonblock,
bool released)
{ … }
static int tls_setup_from_iter(struct iov_iter *from,
int length, int *pages_used,
struct scatterlist *to,
int to_max_pages)
{ … }
static struct sk_buff *
tls_alloc_clrtxt_skb(struct sock *sk, struct sk_buff *skb,
unsigned int full_len)
{ … }
static int tls_decrypt_sg(struct sock *sk, struct iov_iter *out_iov,
struct scatterlist *out_sg,
struct tls_decrypt_arg *darg)
{ … }
static int
tls_decrypt_sw(struct sock *sk, struct tls_context *tls_ctx,
struct msghdr *msg, struct tls_decrypt_arg *darg)
{ … }
static int
tls_decrypt_device(struct sock *sk, struct msghdr *msg,
struct tls_context *tls_ctx, struct tls_decrypt_arg *darg)
{ … }
static int tls_rx_one_record(struct sock *sk, struct msghdr *msg,
struct tls_decrypt_arg *darg)
{ … }
int decrypt_skb(struct sock *sk, struct scatterlist *sgout)
{ … }
static int tls_record_content_type(struct msghdr *msg, struct tls_msg *tlm,
u8 *control)
{ … }
static void tls_rx_rec_done(struct tls_sw_context_rx *ctx)
{ … }
static int process_rx_list(struct tls_sw_context_rx *ctx,
struct msghdr *msg,
u8 *control,
size_t skip,
size_t len,
bool is_peek,
bool *more)
{ … }
static bool
tls_read_flush_backlog(struct sock *sk, struct tls_prot_info *prot,
size_t len_left, size_t decrypted, ssize_t done,
size_t *flushed_at)
{ … }
static int tls_rx_reader_acquire(struct sock *sk, struct tls_sw_context_rx *ctx,
bool nonblock)
{ … }
static int tls_rx_reader_lock(struct sock *sk, struct tls_sw_context_rx *ctx,
bool nonblock)
{ … }
static void tls_rx_reader_release(struct sock *sk, struct tls_sw_context_rx *ctx)
{ … }
static void tls_rx_reader_unlock(struct sock *sk, struct tls_sw_context_rx *ctx)
{ … }
int tls_sw_recvmsg(struct sock *sk,
struct msghdr *msg,
size_t len,
int flags,
int *addr_len)
{ … }
ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
struct pipe_inode_info *pipe,
size_t len, unsigned int flags)
{ … }
int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc,
sk_read_actor_t read_actor)
{ … }
bool tls_sw_sock_is_readable(struct sock *sk)
{ … }
int tls_rx_msg_size(struct tls_strparser *strp, struct sk_buff *skb)
{ … }
void tls_rx_msg_ready(struct tls_strparser *strp)
{ … }
static void tls_data_ready(struct sock *sk)
{ … }
void tls_sw_cancel_work_tx(struct tls_context *tls_ctx)
{ … }
void tls_sw_release_resources_tx(struct sock *sk)
{ … }
void tls_sw_free_ctx_tx(struct tls_context *tls_ctx)
{ … }
void tls_sw_release_resources_rx(struct sock *sk)
{ … }
void tls_sw_strparser_done(struct tls_context *tls_ctx)
{ … }
void tls_sw_free_ctx_rx(struct tls_context *tls_ctx)
{ … }
void tls_sw_free_resources_rx(struct sock *sk)
{ … }
static void tx_work_handler(struct work_struct *work)
{ … }
static bool tls_is_tx_ready(struct tls_sw_context_tx *ctx)
{ … }
void tls_sw_write_space(struct sock *sk, struct tls_context *ctx)
{ … }
void tls_sw_strparser_arm(struct sock *sk, struct tls_context *tls_ctx)
{ … }
void tls_update_rx_zc_capable(struct tls_context *tls_ctx)
{ … }
static struct tls_sw_context_tx *init_ctx_tx(struct tls_context *ctx, struct sock *sk)
{ … }
static struct tls_sw_context_rx *init_ctx_rx(struct tls_context *ctx)
{ … }
int init_prot_info(struct tls_prot_info *prot,
const struct tls_crypto_info *crypto_info,
const struct tls_cipher_desc *cipher_desc)
{ … }
int tls_set_sw_offload(struct sock *sk, int tx)
{ … }