.. | .. |
---|
39 | 39 | #include <linux/crypto.h> |
---|
40 | 40 | #include <linux/socket.h> |
---|
41 | 41 | #include <linux/tcp.h> |
---|
| 42 | +#include <linux/skmsg.h> |
---|
| 43 | +#include <linux/mutex.h> |
---|
| 44 | +#include <linux/netdevice.h> |
---|
| 45 | +#include <linux/rcupdate.h> |
---|
| 46 | +#include <linux/android_kabi.h> |
---|
| 47 | + |
---|
| 48 | +#include <net/net_namespace.h> |
---|
42 | 49 | #include <net/tcp.h> |
---|
43 | 50 | #include <net/strparser.h> |
---|
44 | | - |
---|
| 51 | +#include <crypto/aead.h> |
---|
45 | 52 | #include <uapi/linux/tls.h> |
---|
46 | 53 | |
---|
47 | 54 | |
---|
.. | .. |
---|
56 | 63 | #define TLS_RECORD_TYPE_DATA 0x17 |
---|
57 | 64 | |
---|
58 | 65 | #define TLS_AAD_SPACE_SIZE 13 |
---|
59 | | -#define TLS_DEVICE_NAME_MAX 32 |
---|
60 | 66 | |
---|
61 | | -/* |
---|
62 | | - * This structure defines the routines for Inline TLS driver. |
---|
63 | | - * The following routines are optional and filled with a |
---|
64 | | - * null pointer if not defined. |
---|
| 67 | +#define MAX_IV_SIZE 16 |
---|
| 68 | +#define TLS_MAX_REC_SEQ_SIZE 8 |
---|
| 69 | + |
---|
| 70 | +/* For AES-CCM, the full 16-bytes of IV is made of '4' fields of given sizes. |
---|
65 | 71 | * |
---|
66 | | - * @name: Its the name of registered Inline tls device |
---|
67 | | - * @dev_list: Inline tls device list |
---|
68 | | - * int (*feature)(struct tls_device *device); |
---|
69 | | - * Called to return Inline TLS driver capability |
---|
| 72 | + * IV[16] = b0[1] || implicit nonce[4] || explicit nonce[8] || length[3] |
---|
70 | 73 | * |
---|
71 | | - * int (*hash)(struct tls_device *device, struct sock *sk); |
---|
72 | | - * This function sets Inline driver for listen and program |
---|
73 | | - * device specific functioanlity as required |
---|
74 | | - * |
---|
75 | | - * void (*unhash)(struct tls_device *device, struct sock *sk); |
---|
76 | | - * This function cleans listen state set by Inline TLS driver |
---|
| 74 | + * The field 'length' is encoded in field 'b0' as '(length width - 1)'. |
---|
| 75 | + * Hence b0 contains (3 - 1) = 2. |
---|
77 | 76 | */ |
---|
78 | | -struct tls_device { |
---|
79 | | - char name[TLS_DEVICE_NAME_MAX]; |
---|
80 | | - struct list_head dev_list; |
---|
81 | | - int (*feature)(struct tls_device *device); |
---|
82 | | - int (*hash)(struct tls_device *device, struct sock *sk); |
---|
83 | | - void (*unhash)(struct tls_device *device, struct sock *sk); |
---|
84 | | -}; |
---|
| 77 | +#define TLS_AES_CCM_IV_B0_BYTE 2 |
---|
| 78 | + |
---|
| 79 | +#define __TLS_INC_STATS(net, field) \ |
---|
| 80 | + __SNMP_INC_STATS((net)->mib.tls_statistics, field) |
---|
| 81 | +#define TLS_INC_STATS(net, field) \ |
---|
| 82 | + SNMP_INC_STATS((net)->mib.tls_statistics, field) |
---|
| 83 | +#define __TLS_DEC_STATS(net, field) \ |
---|
| 84 | + __SNMP_DEC_STATS((net)->mib.tls_statistics, field) |
---|
| 85 | +#define TLS_DEC_STATS(net, field) \ |
---|
| 86 | + SNMP_DEC_STATS((net)->mib.tls_statistics, field) |
---|
85 | 87 | |
---|
86 | 88 | enum { |
---|
87 | 89 | TLS_BASE, |
---|
88 | 90 | TLS_SW, |
---|
89 | | -#ifdef CONFIG_TLS_DEVICE |
---|
90 | 91 | TLS_HW, |
---|
91 | | -#endif |
---|
92 | 92 | TLS_HW_RECORD, |
---|
93 | 93 | TLS_NUM_CONFIG, |
---|
| 94 | +}; |
---|
| 95 | + |
---|
| 96 | +/* TLS records are maintained in 'struct tls_rec'. It stores the memory pages |
---|
| 97 | + * allocated or mapped for each TLS record. After encryption, the records are |
---|
| 98 | + * stores in a linked list. |
---|
| 99 | + */ |
---|
| 100 | +struct tls_rec { |
---|
| 101 | + struct list_head list; |
---|
| 102 | + int tx_ready; |
---|
| 103 | + int tx_flags; |
---|
| 104 | + |
---|
| 105 | + struct sk_msg msg_plaintext; |
---|
| 106 | + struct sk_msg msg_encrypted; |
---|
| 107 | + |
---|
| 108 | + /* AAD | msg_plaintext.sg.data | sg_tag */ |
---|
| 109 | + struct scatterlist sg_aead_in[2]; |
---|
| 110 | + /* AAD | msg_encrypted.sg.data (data contains overhead for hdr & iv & tag) */ |
---|
| 111 | + struct scatterlist sg_aead_out[2]; |
---|
| 112 | + |
---|
| 113 | + char content_type; |
---|
| 114 | + struct scatterlist sg_content_type; |
---|
| 115 | + |
---|
| 116 | + char aad_space[TLS_AAD_SPACE_SIZE]; |
---|
| 117 | + u8 iv_data[MAX_IV_SIZE]; |
---|
| 118 | + struct aead_request aead_req; |
---|
| 119 | + |
---|
| 120 | + ANDROID_KABI_RESERVE(1); |
---|
| 121 | + |
---|
| 122 | + u8 aead_req_ctx[]; |
---|
| 123 | +}; |
---|
| 124 | + |
---|
| 125 | +struct tls_msg { |
---|
| 126 | + struct strp_msg rxm; |
---|
| 127 | + u8 control; |
---|
| 128 | +}; |
---|
| 129 | + |
---|
| 130 | +struct tx_work { |
---|
| 131 | + struct delayed_work work; |
---|
| 132 | + struct sock *sk; |
---|
94 | 133 | }; |
---|
95 | 134 | |
---|
96 | 135 | struct tls_sw_context_tx { |
---|
97 | 136 | struct crypto_aead *aead_send; |
---|
98 | 137 | struct crypto_wait async_wait; |
---|
| 138 | + struct tx_work tx_work; |
---|
| 139 | + struct tls_rec *open_rec; |
---|
| 140 | + struct list_head tx_list; |
---|
| 141 | + atomic_t encrypt_pending; |
---|
| 142 | + /* protect crypto_wait with encrypt_pending */ |
---|
| 143 | + spinlock_t encrypt_compl_lock; |
---|
| 144 | + int async_notify; |
---|
| 145 | + u8 async_capable:1; |
---|
99 | 146 | |
---|
100 | | - char aad_space[TLS_AAD_SPACE_SIZE]; |
---|
| 147 | +#define BIT_TX_SCHEDULED 0 |
---|
| 148 | +#define BIT_TX_CLOSING 1 |
---|
| 149 | + unsigned long tx_bitmask; |
---|
101 | 150 | |
---|
102 | | - unsigned int sg_plaintext_size; |
---|
103 | | - int sg_plaintext_num_elem; |
---|
104 | | - struct scatterlist sg_plaintext_data[MAX_SKB_FRAGS]; |
---|
105 | | - |
---|
106 | | - unsigned int sg_encrypted_size; |
---|
107 | | - int sg_encrypted_num_elem; |
---|
108 | | - struct scatterlist sg_encrypted_data[MAX_SKB_FRAGS]; |
---|
109 | | - |
---|
110 | | - /* AAD | sg_plaintext_data | sg_tag */ |
---|
111 | | - struct scatterlist sg_aead_in[2]; |
---|
112 | | - /* AAD | sg_encrypted_data (data contain overhead for hdr&iv&tag) */ |
---|
113 | | - struct scatterlist sg_aead_out[2]; |
---|
| 151 | + ANDROID_KABI_RESERVE(1); |
---|
114 | 152 | }; |
---|
115 | 153 | |
---|
116 | 154 | struct tls_sw_context_rx { |
---|
117 | 155 | struct crypto_aead *aead_recv; |
---|
118 | 156 | struct crypto_wait async_wait; |
---|
119 | | - |
---|
120 | 157 | struct strparser strp; |
---|
| 158 | + struct sk_buff_head rx_list; /* list of decrypted 'data' records */ |
---|
121 | 159 | void (*saved_data_ready)(struct sock *sk); |
---|
122 | | - unsigned int (*sk_poll)(struct file *file, struct socket *sock, |
---|
123 | | - struct poll_table_struct *wait); |
---|
| 160 | + |
---|
124 | 161 | struct sk_buff *recv_pkt; |
---|
125 | 162 | u8 control; |
---|
126 | | - bool decrypted; |
---|
| 163 | + u8 async_capable:1; |
---|
| 164 | + u8 decrypted:1; |
---|
| 165 | + atomic_t decrypt_pending; |
---|
| 166 | + /* protect crypto_wait with decrypt_pending*/ |
---|
| 167 | + spinlock_t decrypt_compl_lock; |
---|
| 168 | + bool async_notify; |
---|
| 169 | + |
---|
| 170 | + ANDROID_KABI_RESERVE(1); |
---|
127 | 171 | }; |
---|
128 | 172 | |
---|
129 | 173 | struct tls_record_info { |
---|
.. | .. |
---|
145 | 189 | |
---|
146 | 190 | struct scatterlist sg_tx_data[MAX_SKB_FRAGS]; |
---|
147 | 191 | void (*sk_destruct)(struct sock *sk); |
---|
148 | | - u8 driver_state[]; |
---|
| 192 | + u8 driver_state[] __aligned(8); |
---|
149 | 193 | /* The TLS layer reserves room for driver specific state |
---|
150 | 194 | * Currently the belief is that there is not enough |
---|
151 | 195 | * driver specific state to justify another layer of indirection |
---|
152 | 196 | */ |
---|
153 | | -#define TLS_DRIVER_STATE_SIZE (max_t(size_t, 8, sizeof(void *))) |
---|
| 197 | +#define TLS_DRIVER_STATE_SIZE_TX 16 |
---|
154 | 198 | }; |
---|
155 | 199 | |
---|
156 | 200 | #define TLS_OFFLOAD_CONTEXT_SIZE_TX \ |
---|
157 | | - (ALIGN(sizeof(struct tls_offload_context_tx), sizeof(void *)) + \ |
---|
158 | | - TLS_DRIVER_STATE_SIZE) |
---|
159 | | - |
---|
160 | | -enum { |
---|
161 | | - TLS_PENDING_CLOSED_RECORD |
---|
162 | | -}; |
---|
| 201 | + (sizeof(struct tls_offload_context_tx) + TLS_DRIVER_STATE_SIZE_TX) |
---|
163 | 202 | |
---|
164 | 203 | enum tls_context_flags { |
---|
165 | | - TLS_RX_SYNC_RUNNING = 0, |
---|
| 204 | + /* tls_device_down was called after the netdev went down, device state |
---|
| 205 | + * was released, and kTLS works in software, even though rx_conf is |
---|
| 206 | + * still TLS_HW (needed for transition). |
---|
| 207 | + */ |
---|
| 208 | + TLS_RX_DEV_DEGRADED = 0, |
---|
| 209 | + /* Unlike RX where resync is driven entirely by the core in TX only |
---|
| 210 | + * the driver knows when things went out of sync, so we need the flag |
---|
| 211 | + * to be atomic. |
---|
| 212 | + */ |
---|
| 213 | + TLS_TX_SYNC_SCHED = 1, |
---|
166 | 214 | /* tls_dev_del was called for the RX side, device state was released, |
---|
167 | 215 | * but tls_ctx->netdev might still be kept, because TX-side driver |
---|
168 | 216 | * resources might not be released yet. Used to prevent the second |
---|
.. | .. |
---|
172 | 220 | }; |
---|
173 | 221 | |
---|
174 | 222 | struct cipher_context { |
---|
175 | | - u16 prepend_size; |
---|
176 | | - u16 tag_size; |
---|
177 | | - u16 overhead_size; |
---|
178 | | - u16 iv_size; |
---|
179 | 223 | char *iv; |
---|
180 | | - u16 rec_seq_size; |
---|
181 | 224 | char *rec_seq; |
---|
182 | 225 | }; |
---|
183 | 226 | |
---|
184 | 227 | union tls_crypto_context { |
---|
185 | 228 | struct tls_crypto_info info; |
---|
186 | | - struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; |
---|
| 229 | + union { |
---|
| 230 | + struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; |
---|
| 231 | + struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; |
---|
| 232 | + }; |
---|
| 233 | +}; |
---|
| 234 | + |
---|
| 235 | +struct tls_prot_info { |
---|
| 236 | + u16 version; |
---|
| 237 | + u16 cipher_type; |
---|
| 238 | + u16 prepend_size; |
---|
| 239 | + u16 tag_size; |
---|
| 240 | + u16 overhead_size; |
---|
| 241 | + u16 iv_size; |
---|
| 242 | + u16 salt_size; |
---|
| 243 | + u16 rec_seq_size; |
---|
| 244 | + u16 aad_size; |
---|
| 245 | + u16 tail_size; |
---|
187 | 246 | }; |
---|
188 | 247 | |
---|
189 | 248 | struct tls_context { |
---|
190 | | - union tls_crypto_context crypto_send; |
---|
191 | | - union tls_crypto_context crypto_recv; |
---|
192 | | - |
---|
193 | | - struct list_head list; |
---|
194 | | - struct net_device *netdev; |
---|
195 | | - refcount_t refcount; |
---|
196 | | - |
---|
197 | | - void *priv_ctx_tx; |
---|
198 | | - void *priv_ctx_rx; |
---|
| 249 | + /* read-only cache line */ |
---|
| 250 | + struct tls_prot_info prot_info; |
---|
199 | 251 | |
---|
200 | 252 | u8 tx_conf:3; |
---|
201 | 253 | u8 rx_conf:3; |
---|
202 | 254 | |
---|
| 255 | + int (*push_pending_record)(struct sock *sk, int flags); |
---|
| 256 | + void (*sk_write_space)(struct sock *sk); |
---|
| 257 | + |
---|
| 258 | + void *priv_ctx_tx; |
---|
| 259 | + void *priv_ctx_rx; |
---|
| 260 | + |
---|
| 261 | + struct net_device *netdev; |
---|
| 262 | + |
---|
| 263 | + /* rw cache line */ |
---|
203 | 264 | struct cipher_context tx; |
---|
204 | 265 | struct cipher_context rx; |
---|
205 | 266 | |
---|
206 | 267 | struct scatterlist *partially_sent_record; |
---|
207 | 268 | u16 partially_sent_offset; |
---|
208 | | - unsigned long flags; |
---|
| 269 | + |
---|
209 | 270 | bool in_tcp_sendpages; |
---|
| 271 | + bool pending_open_record_frags; |
---|
210 | 272 | |
---|
211 | | - u16 pending_open_record_frags; |
---|
212 | | - int (*push_pending_record)(struct sock *sk, int flags); |
---|
| 273 | + struct mutex tx_lock; /* protects partially_sent_* fields and |
---|
| 274 | + * per-type TX fields |
---|
| 275 | + */ |
---|
| 276 | + unsigned long flags; |
---|
213 | 277 | |
---|
214 | | - void (*sk_write_space)(struct sock *sk); |
---|
| 278 | + /* cache cold stuff */ |
---|
| 279 | + struct proto *sk_proto; |
---|
| 280 | + struct sock *sk; |
---|
| 281 | + |
---|
215 | 282 | void (*sk_destruct)(struct sock *sk); |
---|
216 | | - void (*sk_proto_close)(struct sock *sk, long timeout); |
---|
217 | 283 | |
---|
218 | | - int (*setsockopt)(struct sock *sk, int level, |
---|
219 | | - int optname, char __user *optval, |
---|
220 | | - unsigned int optlen); |
---|
221 | | - int (*getsockopt)(struct sock *sk, int level, |
---|
222 | | - int optname, char __user *optval, |
---|
223 | | - int __user *optlen); |
---|
224 | | - int (*hash)(struct sock *sk); |
---|
225 | | - void (*unhash)(struct sock *sk); |
---|
| 284 | + union tls_crypto_context crypto_send; |
---|
| 285 | + union tls_crypto_context crypto_recv; |
---|
| 286 | + |
---|
| 287 | + struct list_head list; |
---|
| 288 | + refcount_t refcount; |
---|
| 289 | + struct rcu_head rcu; |
---|
| 290 | +}; |
---|
| 291 | + |
---|
| 292 | +enum tls_offload_ctx_dir { |
---|
| 293 | + TLS_OFFLOAD_CTX_DIR_RX, |
---|
| 294 | + TLS_OFFLOAD_CTX_DIR_TX, |
---|
| 295 | +}; |
---|
| 296 | + |
---|
| 297 | +struct tlsdev_ops { |
---|
| 298 | + int (*tls_dev_add)(struct net_device *netdev, struct sock *sk, |
---|
| 299 | + enum tls_offload_ctx_dir direction, |
---|
| 300 | + struct tls_crypto_info *crypto_info, |
---|
| 301 | + u32 start_offload_tcp_sn); |
---|
| 302 | + void (*tls_dev_del)(struct net_device *netdev, |
---|
| 303 | + struct tls_context *ctx, |
---|
| 304 | + enum tls_offload_ctx_dir direction); |
---|
| 305 | + int (*tls_dev_resync)(struct net_device *netdev, |
---|
| 306 | + struct sock *sk, u32 seq, u8 *rcd_sn, |
---|
| 307 | + enum tls_offload_ctx_dir direction); |
---|
| 308 | + |
---|
| 309 | + ANDROID_KABI_RESERVE(1); |
---|
| 310 | + ANDROID_KABI_RESERVE(2); |
---|
| 311 | + ANDROID_KABI_RESERVE(3); |
---|
| 312 | + ANDROID_KABI_RESERVE(4); |
---|
| 313 | + |
---|
| 314 | +}; |
---|
| 315 | + |
---|
| 316 | +enum tls_offload_sync_type { |
---|
| 317 | + TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ = 0, |
---|
| 318 | + TLS_OFFLOAD_SYNC_TYPE_CORE_NEXT_HINT = 1, |
---|
| 319 | + TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ_ASYNC = 2, |
---|
| 320 | +}; |
---|
| 321 | + |
---|
| 322 | +#define TLS_DEVICE_RESYNC_NH_START_IVAL 2 |
---|
| 323 | +#define TLS_DEVICE_RESYNC_NH_MAX_IVAL 128 |
---|
| 324 | + |
---|
| 325 | +#define TLS_DEVICE_RESYNC_ASYNC_LOGMAX 13 |
---|
| 326 | +struct tls_offload_resync_async { |
---|
| 327 | + atomic64_t req; |
---|
| 328 | + u16 loglen; |
---|
| 329 | + u16 rcd_delta; |
---|
| 330 | + u32 log[TLS_DEVICE_RESYNC_ASYNC_LOGMAX]; |
---|
226 | 331 | }; |
---|
227 | 332 | |
---|
228 | 333 | struct tls_offload_context_rx { |
---|
229 | 334 | /* sw must be the first member of tls_offload_context_rx */ |
---|
230 | 335 | struct tls_sw_context_rx sw; |
---|
231 | | - atomic64_t resync_req; |
---|
232 | | - u8 driver_state[]; |
---|
| 336 | + enum tls_offload_sync_type resync_type; |
---|
| 337 | + /* this member is set regardless of resync_type, to avoid branches */ |
---|
| 338 | + u8 resync_nh_reset:1; |
---|
| 339 | + /* CORE_NEXT_HINT-only member, but use the hole here */ |
---|
| 340 | + u8 resync_nh_do_now:1; |
---|
| 341 | + union { |
---|
| 342 | + /* TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ */ |
---|
| 343 | + struct { |
---|
| 344 | + atomic64_t resync_req; |
---|
| 345 | + }; |
---|
| 346 | + /* TLS_OFFLOAD_SYNC_TYPE_CORE_NEXT_HINT */ |
---|
| 347 | + struct { |
---|
| 348 | + u32 decrypted_failed; |
---|
| 349 | + u32 decrypted_tgt; |
---|
| 350 | + } resync_nh; |
---|
| 351 | + /* TLS_OFFLOAD_SYNC_TYPE_DRIVER_REQ_ASYNC */ |
---|
| 352 | + struct { |
---|
| 353 | + struct tls_offload_resync_async *resync_async; |
---|
| 354 | + }; |
---|
| 355 | + }; |
---|
| 356 | + u8 driver_state[] __aligned(8); |
---|
233 | 357 | /* The TLS layer reserves room for driver specific state |
---|
234 | 358 | * Currently the belief is that there is not enough |
---|
235 | 359 | * driver specific state to justify another layer of indirection |
---|
236 | 360 | */ |
---|
| 361 | +#define TLS_DRIVER_STATE_SIZE_RX 8 |
---|
237 | 362 | }; |
---|
238 | 363 | |
---|
239 | 364 | #define TLS_OFFLOAD_CONTEXT_SIZE_RX \ |
---|
240 | | - (ALIGN(sizeof(struct tls_offload_context_rx), sizeof(void *)) + \ |
---|
241 | | - TLS_DRIVER_STATE_SIZE) |
---|
| 365 | + (sizeof(struct tls_offload_context_rx) + TLS_DRIVER_STATE_SIZE_RX) |
---|
242 | 366 | |
---|
243 | | -void tls_ctx_free(struct tls_context *ctx); |
---|
| 367 | +struct tls_context *tls_ctx_create(struct sock *sk); |
---|
| 368 | +void tls_ctx_free(struct sock *sk, struct tls_context *ctx); |
---|
| 369 | +void update_sk_prot(struct sock *sk, struct tls_context *ctx); |
---|
| 370 | + |
---|
244 | 371 | int wait_on_pending_writer(struct sock *sk, long *timeo); |
---|
245 | 372 | int tls_sk_query(struct sock *sk, int optname, char __user *optval, |
---|
246 | 373 | int __user *optlen); |
---|
247 | 374 | int tls_sk_attach(struct sock *sk, int optname, char __user *optval, |
---|
248 | 375 | unsigned int optlen); |
---|
| 376 | +void tls_err_abort(struct sock *sk, int err); |
---|
249 | 377 | |
---|
250 | 378 | int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx); |
---|
| 379 | +void tls_sw_strparser_arm(struct sock *sk, struct tls_context *ctx); |
---|
| 380 | +void tls_sw_strparser_done(struct tls_context *tls_ctx); |
---|
251 | 381 | int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); |
---|
| 382 | +int tls_sw_sendpage_locked(struct sock *sk, struct page *page, |
---|
| 383 | + int offset, size_t size, int flags); |
---|
252 | 384 | int tls_sw_sendpage(struct sock *sk, struct page *page, |
---|
253 | 385 | int offset, size_t size, int flags); |
---|
254 | | -void tls_sw_close(struct sock *sk, long timeout); |
---|
255 | | -void tls_sw_free_resources_tx(struct sock *sk); |
---|
| 386 | +void tls_sw_cancel_work_tx(struct tls_context *tls_ctx); |
---|
| 387 | +void tls_sw_release_resources_tx(struct sock *sk); |
---|
| 388 | +void tls_sw_free_ctx_tx(struct tls_context *tls_ctx); |
---|
256 | 389 | void tls_sw_free_resources_rx(struct sock *sk); |
---|
257 | 390 | void tls_sw_release_resources_rx(struct sock *sk); |
---|
| 391 | +void tls_sw_free_ctx_rx(struct tls_context *tls_ctx); |
---|
258 | 392 | int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, |
---|
259 | 393 | int nonblock, int flags, int *addr_len); |
---|
260 | | -unsigned int tls_sw_poll(struct file *file, struct socket *sock, |
---|
261 | | - struct poll_table_struct *wait); |
---|
| 394 | +bool tls_sw_stream_read(const struct sock *sk); |
---|
262 | 395 | ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, |
---|
263 | 396 | struct pipe_inode_info *pipe, |
---|
264 | 397 | size_t len, unsigned int flags); |
---|
265 | 398 | |
---|
266 | | -int tls_set_device_offload(struct sock *sk, struct tls_context *ctx); |
---|
267 | 399 | int tls_device_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); |
---|
268 | 400 | int tls_device_sendpage(struct sock *sk, struct page *page, |
---|
269 | 401 | int offset, size_t size, int flags); |
---|
270 | | -void tls_device_sk_destruct(struct sock *sk); |
---|
271 | | -void tls_device_init(void); |
---|
272 | | -void tls_device_cleanup(void); |
---|
| 402 | +int tls_tx_records(struct sock *sk, int flags); |
---|
273 | 403 | |
---|
274 | 404 | struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context, |
---|
275 | 405 | u32 seq, u64 *p_record_sn); |
---|
.. | .. |
---|
284 | 414 | return rec->end_seq - rec->len; |
---|
285 | 415 | } |
---|
286 | 416 | |
---|
287 | | -void tls_sk_destruct(struct sock *sk, struct tls_context *ctx); |
---|
288 | 417 | int tls_push_sg(struct sock *sk, struct tls_context *ctx, |
---|
289 | 418 | struct scatterlist *sg, u16 first_offset, |
---|
290 | 419 | int flags); |
---|
291 | | -int tls_push_pending_closed_record(struct sock *sk, struct tls_context *ctx, |
---|
292 | | - int flags, long *timeo); |
---|
| 420 | +int tls_push_partial_record(struct sock *sk, struct tls_context *ctx, |
---|
| 421 | + int flags); |
---|
| 422 | +void tls_free_partial_record(struct sock *sk, struct tls_context *ctx); |
---|
293 | 423 | |
---|
294 | | -static inline bool tls_is_pending_closed_record(struct tls_context *ctx) |
---|
| 424 | +static inline struct tls_msg *tls_msg(struct sk_buff *skb) |
---|
295 | 425 | { |
---|
296 | | - return test_bit(TLS_PENDING_CLOSED_RECORD, &ctx->flags); |
---|
297 | | -} |
---|
298 | | - |
---|
299 | | -static inline int tls_complete_pending_work(struct sock *sk, |
---|
300 | | - struct tls_context *ctx, |
---|
301 | | - int flags, long *timeo) |
---|
302 | | -{ |
---|
303 | | - int rc = 0; |
---|
304 | | - |
---|
305 | | - if (unlikely(sk->sk_write_pending)) |
---|
306 | | - rc = wait_on_pending_writer(sk, timeo); |
---|
307 | | - |
---|
308 | | - if (!rc && tls_is_pending_closed_record(ctx)) |
---|
309 | | - rc = tls_push_pending_closed_record(sk, ctx, flags, timeo); |
---|
310 | | - |
---|
311 | | - return rc; |
---|
| 426 | + return (struct tls_msg *)strp_msg(skb); |
---|
312 | 427 | } |
---|
313 | 428 | |
---|
314 | 429 | static inline bool tls_is_partially_sent_record(struct tls_context *ctx) |
---|
.. | .. |
---|
321 | 436 | return tls_ctx->pending_open_record_frags; |
---|
322 | 437 | } |
---|
323 | 438 | |
---|
| 439 | +static inline bool is_tx_ready(struct tls_sw_context_tx *ctx) |
---|
| 440 | +{ |
---|
| 441 | + struct tls_rec *rec; |
---|
| 442 | + |
---|
| 443 | + rec = list_first_entry(&ctx->tx_list, struct tls_rec, list); |
---|
| 444 | + if (!rec) |
---|
| 445 | + return false; |
---|
| 446 | + |
---|
| 447 | + return READ_ONCE(rec->tx_ready); |
---|
| 448 | +} |
---|
| 449 | + |
---|
| 450 | +static inline u16 tls_user_config(struct tls_context *ctx, bool tx) |
---|
| 451 | +{ |
---|
| 452 | + u16 config = tx ? ctx->tx_conf : ctx->rx_conf; |
---|
| 453 | + |
---|
| 454 | + switch (config) { |
---|
| 455 | + case TLS_BASE: |
---|
| 456 | + return TLS_CONF_BASE; |
---|
| 457 | + case TLS_SW: |
---|
| 458 | + return TLS_CONF_SW; |
---|
| 459 | + case TLS_HW: |
---|
| 460 | + return TLS_CONF_HW; |
---|
| 461 | + case TLS_HW_RECORD: |
---|
| 462 | + return TLS_CONF_HW_RECORD; |
---|
| 463 | + } |
---|
| 464 | + return 0; |
---|
| 465 | +} |
---|
| 466 | + |
---|
324 | 467 | struct sk_buff * |
---|
325 | 468 | tls_validate_xmit_skb(struct sock *sk, struct net_device *dev, |
---|
326 | 469 | struct sk_buff *skb); |
---|
| 470 | +struct sk_buff * |
---|
| 471 | +tls_validate_xmit_skb_sw(struct sock *sk, struct net_device *dev, |
---|
| 472 | + struct sk_buff *skb); |
---|
327 | 473 | |
---|
328 | 474 | static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk) |
---|
329 | 475 | { |
---|
.. | .. |
---|
334 | 480 | #else |
---|
335 | 481 | return false; |
---|
336 | 482 | #endif |
---|
337 | | -} |
---|
338 | | - |
---|
339 | | -static inline void tls_err_abort(struct sock *sk, int err) |
---|
340 | | -{ |
---|
341 | | - sk->sk_err = err; |
---|
342 | | - sk->sk_error_report(sk); |
---|
343 | 483 | } |
---|
344 | 484 | |
---|
345 | 485 | static inline bool tls_bigint_increment(unsigned char *seq, int len) |
---|
.. | .. |
---|
355 | 495 | return (i == -1); |
---|
356 | 496 | } |
---|
357 | 497 | |
---|
358 | | -static inline void tls_advance_record_sn(struct sock *sk, |
---|
359 | | - struct cipher_context *ctx) |
---|
| 498 | +static inline void tls_bigint_subtract(unsigned char *seq, int n) |
---|
360 | 499 | { |
---|
361 | | - if (tls_bigint_increment(ctx->rec_seq, ctx->rec_seq_size)) |
---|
362 | | - tls_err_abort(sk, EBADMSG); |
---|
363 | | - tls_bigint_increment(ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, |
---|
364 | | - ctx->iv_size); |
---|
365 | | -} |
---|
| 500 | + u64 rcd_sn; |
---|
| 501 | + __be64 *p; |
---|
366 | 502 | |
---|
367 | | -static inline void tls_fill_prepend(struct tls_context *ctx, |
---|
368 | | - char *buf, |
---|
369 | | - size_t plaintext_len, |
---|
370 | | - unsigned char record_type) |
---|
371 | | -{ |
---|
372 | | - size_t pkt_len, iv_size = ctx->tx.iv_size; |
---|
| 503 | + BUILD_BUG_ON(TLS_MAX_REC_SEQ_SIZE != 8); |
---|
373 | 504 | |
---|
374 | | - pkt_len = plaintext_len + iv_size + ctx->tx.tag_size; |
---|
375 | | - |
---|
376 | | - /* we cover nonce explicit here as well, so buf should be of |
---|
377 | | - * size KTLS_DTLS_HEADER_SIZE + KTLS_DTLS_NONCE_EXPLICIT_SIZE |
---|
378 | | - */ |
---|
379 | | - buf[0] = record_type; |
---|
380 | | - buf[1] = TLS_VERSION_MINOR(ctx->crypto_send.info.version); |
---|
381 | | - buf[2] = TLS_VERSION_MAJOR(ctx->crypto_send.info.version); |
---|
382 | | - /* we can use IV for nonce explicit according to spec */ |
---|
383 | | - buf[3] = pkt_len >> 8; |
---|
384 | | - buf[4] = pkt_len & 0xFF; |
---|
385 | | - memcpy(buf + TLS_NONCE_OFFSET, |
---|
386 | | - ctx->tx.iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, iv_size); |
---|
387 | | -} |
---|
388 | | - |
---|
389 | | -static inline void tls_make_aad(char *buf, |
---|
390 | | - size_t size, |
---|
391 | | - char *record_sequence, |
---|
392 | | - int record_sequence_size, |
---|
393 | | - unsigned char record_type) |
---|
394 | | -{ |
---|
395 | | - memcpy(buf, record_sequence, record_sequence_size); |
---|
396 | | - |
---|
397 | | - buf[8] = record_type; |
---|
398 | | - buf[9] = TLS_1_2_VERSION_MAJOR; |
---|
399 | | - buf[10] = TLS_1_2_VERSION_MINOR; |
---|
400 | | - buf[11] = size >> 8; |
---|
401 | | - buf[12] = size & 0xFF; |
---|
| 505 | + p = (__be64 *)seq; |
---|
| 506 | + rcd_sn = be64_to_cpu(*p); |
---|
| 507 | + *p = cpu_to_be64(rcd_sn - n); |
---|
402 | 508 | } |
---|
403 | 509 | |
---|
404 | 510 | static inline struct tls_context *tls_get_ctx(const struct sock *sk) |
---|
405 | 511 | { |
---|
406 | 512 | struct inet_connection_sock *icsk = inet_csk(sk); |
---|
407 | 513 | |
---|
408 | | - return icsk->icsk_ulp_data; |
---|
| 514 | + /* Use RCU on icsk_ulp_data only for sock diag code, |
---|
| 515 | + * TLS data path doesn't need rcu_dereference(). |
---|
| 516 | + */ |
---|
| 517 | + return (__force void *)icsk->icsk_ulp_data; |
---|
409 | 518 | } |
---|
| 519 | + |
---|
| 520 | +static inline void tls_advance_record_sn(struct sock *sk, |
---|
| 521 | + struct tls_prot_info *prot, |
---|
| 522 | + struct cipher_context *ctx) |
---|
| 523 | +{ |
---|
| 524 | + if (tls_bigint_increment(ctx->rec_seq, prot->rec_seq_size)) |
---|
| 525 | + tls_err_abort(sk, -EBADMSG); |
---|
| 526 | + |
---|
| 527 | + if (prot->version != TLS_1_3_VERSION) |
---|
| 528 | + tls_bigint_increment(ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, |
---|
| 529 | + prot->iv_size); |
---|
| 530 | +} |
---|
| 531 | + |
---|
| 532 | +static inline void tls_fill_prepend(struct tls_context *ctx, |
---|
| 533 | + char *buf, |
---|
| 534 | + size_t plaintext_len, |
---|
| 535 | + unsigned char record_type, |
---|
| 536 | + int version) |
---|
| 537 | +{ |
---|
| 538 | + struct tls_prot_info *prot = &ctx->prot_info; |
---|
| 539 | + size_t pkt_len, iv_size = prot->iv_size; |
---|
| 540 | + |
---|
| 541 | + pkt_len = plaintext_len + prot->tag_size; |
---|
| 542 | + if (version != TLS_1_3_VERSION) { |
---|
| 543 | + pkt_len += iv_size; |
---|
| 544 | + |
---|
| 545 | + memcpy(buf + TLS_NONCE_OFFSET, |
---|
| 546 | + ctx->tx.iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, iv_size); |
---|
| 547 | + } |
---|
| 548 | + |
---|
| 549 | + /* we cover nonce explicit here as well, so buf should be of |
---|
| 550 | + * size KTLS_DTLS_HEADER_SIZE + KTLS_DTLS_NONCE_EXPLICIT_SIZE |
---|
| 551 | + */ |
---|
| 552 | + buf[0] = version == TLS_1_3_VERSION ? |
---|
| 553 | + TLS_RECORD_TYPE_DATA : record_type; |
---|
| 554 | + /* Note that VERSION must be TLS_1_2 for both TLS1.2 and TLS1.3 */ |
---|
| 555 | + buf[1] = TLS_1_2_VERSION_MINOR; |
---|
| 556 | + buf[2] = TLS_1_2_VERSION_MAJOR; |
---|
| 557 | + /* we can use IV for nonce explicit according to spec */ |
---|
| 558 | + buf[3] = pkt_len >> 8; |
---|
| 559 | + buf[4] = pkt_len & 0xFF; |
---|
| 560 | +} |
---|
| 561 | + |
---|
| 562 | +static inline void tls_make_aad(char *buf, |
---|
| 563 | + size_t size, |
---|
| 564 | + char *record_sequence, |
---|
| 565 | + int record_sequence_size, |
---|
| 566 | + unsigned char record_type, |
---|
| 567 | + int version) |
---|
| 568 | +{ |
---|
| 569 | + if (version != TLS_1_3_VERSION) { |
---|
| 570 | + memcpy(buf, record_sequence, record_sequence_size); |
---|
| 571 | + buf += 8; |
---|
| 572 | + } else { |
---|
| 573 | + size += TLS_CIPHER_AES_GCM_128_TAG_SIZE; |
---|
| 574 | + } |
---|
| 575 | + |
---|
| 576 | + buf[0] = version == TLS_1_3_VERSION ? |
---|
| 577 | + TLS_RECORD_TYPE_DATA : record_type; |
---|
| 578 | + buf[1] = TLS_1_2_VERSION_MAJOR; |
---|
| 579 | + buf[2] = TLS_1_2_VERSION_MINOR; |
---|
| 580 | + buf[3] = size >> 8; |
---|
| 581 | + buf[4] = size & 0xFF; |
---|
| 582 | +} |
---|
| 583 | + |
---|
| 584 | +static inline void xor_iv_with_seq(int version, char *iv, char *seq) |
---|
| 585 | +{ |
---|
| 586 | + int i; |
---|
| 587 | + |
---|
| 588 | + if (version == TLS_1_3_VERSION) { |
---|
| 589 | + for (i = 0; i < 8; i++) |
---|
| 590 | + iv[i + 4] ^= seq[i]; |
---|
| 591 | + } |
---|
| 592 | +} |
---|
| 593 | + |
---|
410 | 594 | |
---|
411 | 595 | static inline struct tls_sw_context_rx *tls_sw_ctx_rx( |
---|
412 | 596 | const struct tls_context *tls_ctx) |
---|
.. | .. |
---|
426 | 610 | return (struct tls_offload_context_tx *)tls_ctx->priv_ctx_tx; |
---|
427 | 611 | } |
---|
428 | 612 | |
---|
| 613 | +static inline bool tls_sw_has_ctx_tx(const struct sock *sk) |
---|
| 614 | +{ |
---|
| 615 | + struct tls_context *ctx = tls_get_ctx(sk); |
---|
| 616 | + |
---|
| 617 | + if (!ctx) |
---|
| 618 | + return false; |
---|
| 619 | + return !!tls_sw_ctx_tx(ctx); |
---|
| 620 | +} |
---|
| 621 | + |
---|
| 622 | +static inline bool tls_sw_has_ctx_rx(const struct sock *sk) |
---|
| 623 | +{ |
---|
| 624 | + struct tls_context *ctx = tls_get_ctx(sk); |
---|
| 625 | + |
---|
| 626 | + if (!ctx) |
---|
| 627 | + return false; |
---|
| 628 | + return !!tls_sw_ctx_rx(ctx); |
---|
| 629 | +} |
---|
| 630 | + |
---|
| 631 | +void tls_sw_write_space(struct sock *sk, struct tls_context *ctx); |
---|
| 632 | +void tls_device_write_space(struct sock *sk, struct tls_context *ctx); |
---|
| 633 | + |
---|
429 | 634 | static inline struct tls_offload_context_rx * |
---|
430 | 635 | tls_offload_ctx_rx(const struct tls_context *tls_ctx) |
---|
431 | 636 | { |
---|
432 | 637 | return (struct tls_offload_context_rx *)tls_ctx->priv_ctx_rx; |
---|
433 | 638 | } |
---|
434 | 639 | |
---|
| 640 | +#if IS_ENABLED(CONFIG_TLS_DEVICE) |
---|
| 641 | +static inline void *__tls_driver_ctx(struct tls_context *tls_ctx, |
---|
| 642 | + enum tls_offload_ctx_dir direction) |
---|
| 643 | +{ |
---|
| 644 | + if (direction == TLS_OFFLOAD_CTX_DIR_TX) |
---|
| 645 | + return tls_offload_ctx_tx(tls_ctx)->driver_state; |
---|
| 646 | + else |
---|
| 647 | + return tls_offload_ctx_rx(tls_ctx)->driver_state; |
---|
| 648 | +} |
---|
| 649 | + |
---|
| 650 | +static inline void * |
---|
| 651 | +tls_driver_ctx(const struct sock *sk, enum tls_offload_ctx_dir direction) |
---|
| 652 | +{ |
---|
| 653 | + return __tls_driver_ctx(tls_get_ctx(sk), direction); |
---|
| 654 | +} |
---|
| 655 | +#endif |
---|
| 656 | + |
---|
| 657 | +#define RESYNC_REQ BIT(0) |
---|
| 658 | +#define RESYNC_REQ_ASYNC BIT(1) |
---|
435 | 659 | /* The TLS context is valid until sk_destruct is called */ |
---|
436 | 660 | static inline void tls_offload_rx_resync_request(struct sock *sk, __be32 seq) |
---|
437 | 661 | { |
---|
438 | 662 | struct tls_context *tls_ctx = tls_get_ctx(sk); |
---|
439 | 663 | struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx); |
---|
440 | 664 | |
---|
441 | | - atomic64_set(&rx_ctx->resync_req, ((((uint64_t)seq) << 32) | 1)); |
---|
| 665 | + atomic64_set(&rx_ctx->resync_req, ((u64)ntohl(seq) << 32) | RESYNC_REQ); |
---|
442 | 666 | } |
---|
443 | 667 | |
---|
| 668 | +/* Log all TLS record header TCP sequences in [seq, seq+len] */ |
---|
| 669 | +static inline void |
---|
| 670 | +tls_offload_rx_resync_async_request_start(struct sock *sk, __be32 seq, u16 len) |
---|
| 671 | +{ |
---|
| 672 | + struct tls_context *tls_ctx = tls_get_ctx(sk); |
---|
| 673 | + struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx); |
---|
| 674 | + |
---|
| 675 | + atomic64_set(&rx_ctx->resync_async->req, ((u64)ntohl(seq) << 32) | |
---|
| 676 | + ((u64)len << 16) | RESYNC_REQ | RESYNC_REQ_ASYNC); |
---|
| 677 | + rx_ctx->resync_async->loglen = 0; |
---|
| 678 | + rx_ctx->resync_async->rcd_delta = 0; |
---|
| 679 | +} |
---|
| 680 | + |
---|
| 681 | +static inline void |
---|
| 682 | +tls_offload_rx_resync_async_request_end(struct sock *sk, __be32 seq) |
---|
| 683 | +{ |
---|
| 684 | + struct tls_context *tls_ctx = tls_get_ctx(sk); |
---|
| 685 | + struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx); |
---|
| 686 | + |
---|
| 687 | + atomic64_set(&rx_ctx->resync_async->req, |
---|
| 688 | + ((u64)ntohl(seq) << 32) | RESYNC_REQ); |
---|
| 689 | +} |
---|
| 690 | + |
---|
| 691 | +static inline void |
---|
| 692 | +tls_offload_rx_resync_set_type(struct sock *sk, enum tls_offload_sync_type type) |
---|
| 693 | +{ |
---|
| 694 | + struct tls_context *tls_ctx = tls_get_ctx(sk); |
---|
| 695 | + |
---|
| 696 | + tls_offload_ctx_rx(tls_ctx)->resync_type = type; |
---|
| 697 | +} |
---|
| 698 | + |
---|
| 699 | +/* Driver's seq tracking has to be disabled until resync succeeded */ |
---|
| 700 | +static inline bool tls_offload_tx_resync_pending(struct sock *sk) |
---|
| 701 | +{ |
---|
| 702 | + struct tls_context *tls_ctx = tls_get_ctx(sk); |
---|
| 703 | + bool ret; |
---|
| 704 | + |
---|
| 705 | + ret = test_bit(TLS_TX_SYNC_SCHED, &tls_ctx->flags); |
---|
| 706 | + smp_mb__after_atomic(); |
---|
| 707 | + return ret; |
---|
| 708 | +} |
---|
| 709 | + |
---|
| 710 | +int __net_init tls_proc_init(struct net *net); |
---|
| 711 | +void __net_exit tls_proc_fini(struct net *net); |
---|
444 | 712 | |
---|
445 | 713 | int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg, |
---|
446 | 714 | unsigned char *record_type); |
---|
447 | | -void tls_register_device(struct tls_device *device); |
---|
448 | | -void tls_unregister_device(struct tls_device *device); |
---|
449 | | -int tls_device_decrypted(struct sock *sk, struct sk_buff *skb); |
---|
450 | 715 | int decrypt_skb(struct sock *sk, struct sk_buff *skb, |
---|
451 | 716 | struct scatterlist *sgout); |
---|
452 | | - |
---|
453 | | -struct sk_buff *tls_validate_xmit_skb(struct sock *sk, |
---|
454 | | - struct net_device *dev, |
---|
455 | | - struct sk_buff *skb); |
---|
| 717 | +struct sk_buff *tls_encrypt_skb(struct sk_buff *skb); |
---|
456 | 718 | |
---|
457 | 719 | int tls_sw_fallback_init(struct sock *sk, |
---|
458 | 720 | struct tls_offload_context_tx *offload_ctx, |
---|
459 | 721 | struct tls_crypto_info *crypto_info); |
---|
460 | 722 | |
---|
| 723 | +#ifdef CONFIG_TLS_DEVICE |
---|
| 724 | +int tls_device_init(void); |
---|
| 725 | +void tls_device_cleanup(void); |
---|
| 726 | +void tls_device_sk_destruct(struct sock *sk); |
---|
| 727 | +int tls_set_device_offload(struct sock *sk, struct tls_context *ctx); |
---|
| 728 | +void tls_device_free_resources_tx(struct sock *sk); |
---|
461 | 729 | int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx); |
---|
462 | | - |
---|
463 | 730 | void tls_device_offload_cleanup_rx(struct sock *sk); |
---|
464 | | -void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn); |
---|
| 731 | +void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq); |
---|
| 732 | +void tls_offload_tx_resync_request(struct sock *sk, u32 got_seq, u32 exp_seq); |
---|
| 733 | +int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx, |
---|
| 734 | + struct sk_buff *skb, struct strp_msg *rxm); |
---|
465 | 735 | |
---|
| 736 | +static inline bool tls_is_sk_rx_device_offloaded(struct sock *sk) |
---|
| 737 | +{ |
---|
| 738 | + if (!sk_fullsock(sk) || |
---|
| 739 | + smp_load_acquire(&sk->sk_destruct) != tls_device_sk_destruct) |
---|
| 740 | + return false; |
---|
| 741 | + return tls_get_ctx(sk)->rx_conf == TLS_HW; |
---|
| 742 | +} |
---|
| 743 | +#else |
---|
| 744 | +static inline int tls_device_init(void) { return 0; } |
---|
| 745 | +static inline void tls_device_cleanup(void) {} |
---|
| 746 | + |
---|
| 747 | +static inline int |
---|
| 748 | +tls_set_device_offload(struct sock *sk, struct tls_context *ctx) |
---|
| 749 | +{ |
---|
| 750 | + return -EOPNOTSUPP; |
---|
| 751 | +} |
---|
| 752 | + |
---|
| 753 | +static inline void tls_device_free_resources_tx(struct sock *sk) {} |
---|
| 754 | + |
---|
| 755 | +static inline int |
---|
| 756 | +tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) |
---|
| 757 | +{ |
---|
| 758 | + return -EOPNOTSUPP; |
---|
| 759 | +} |
---|
| 760 | + |
---|
| 761 | +static inline void tls_device_offload_cleanup_rx(struct sock *sk) {} |
---|
| 762 | +static inline void |
---|
| 763 | +tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq) {} |
---|
| 764 | + |
---|
| 765 | +static inline int |
---|
| 766 | +tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx, |
---|
| 767 | + struct sk_buff *skb, struct strp_msg *rxm) |
---|
| 768 | +{ |
---|
| 769 | + return 0; |
---|
| 770 | +} |
---|
| 771 | +#endif |
---|
466 | 772 | #endif /* _TLS_OFFLOAD_H */ |
---|