2022-07-15 05:22:33 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
|
|
|
|
#include "tls.h"
|
|
|
|
|
2022-07-22 23:50:30 +00:00
|
|
|
struct sk_buff *tls_strp_msg_detach(struct tls_sw_context_rx *ctx)
|
|
|
|
{
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
|
|
|
skb = ctx->recv_pkt;
|
|
|
|
ctx->recv_pkt = NULL;
|
|
|
|
return skb;
|
|
|
|
}
|
|
|
|
|
2022-07-22 23:50:32 +00:00
|
|
|
int tls_strp_msg_cow(struct tls_sw_context_rx *ctx)
|
|
|
|
{
|
|
|
|
struct sk_buff *unused;
|
|
|
|
int nsg;
|
|
|
|
|
|
|
|
nsg = skb_cow_data(ctx->recv_pkt, 0, &unused);
|
|
|
|
if (nsg < 0)
|
|
|
|
return nsg;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-15 05:22:33 +00:00
|
|
|
int tls_strp_msg_hold(struct sock *sk, struct sk_buff *skb,
|
|
|
|
struct sk_buff_head *dst)
|
|
|
|
{
|
|
|
|
struct sk_buff *clone;
|
|
|
|
|
|
|
|
clone = skb_clone(skb, sk->sk_allocation);
|
|
|
|
if (!clone)
|
|
|
|
return -ENOMEM;
|
|
|
|
__skb_queue_tail(dst, clone);
|
|
|
|
return 0;
|
|
|
|
}
|