hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/crypto/if_alg.h
....@@ -1,13 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * if_alg: User-space algorithm interface
34 *
45 * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the Free
8
- * Software Foundation; either version 2 of the License, or (at your option)
9
- * any later version.
10
- *
116 */
127
138 #ifndef _CRYPTO_IF_ALG_H
....@@ -51,6 +46,7 @@
5146 void *(*bind)(const char *name, u32 type, u32 mask);
5247 void (*release)(void *private);
5348 int (*setkey)(void *private, const u8 *key, unsigned int keylen);
49
+ int (*setentropy)(void *private, sockptr_t entropy, unsigned int len);
5450 int (*accept)(void *private, struct sock *sk);
5551 int (*accept_nokey)(void *private, struct sock *sk);
5652 int (*setauthsize)(void *private, unsigned int authsize);
....@@ -71,7 +67,7 @@
7167 struct af_alg_tsgl {
7268 struct list_head list;
7369 unsigned int cur; /* Last processed SG entry */
74
- struct scatterlist sg[0]; /* Array of SGs forming the SGL */
70
+ struct scatterlist sg[]; /* Array of SGs forming the SGL */
7571 };
7672
7773 #define MAX_SGL_ENTS ((4096 - sizeof(struct af_alg_tsgl)) / \
....@@ -140,6 +136,7 @@
140136 * SG?
141137 * @enc: Cryptographic operation to be performed when
142138 * recvmsg is invoked.
139
+ * @init: True if metadata has been sent.
143140 * @len: Length of memory allocated for this data structure.
144141 */
145142 struct af_alg_ctx {
....@@ -156,6 +153,7 @@
156153 bool more;
157154 bool merge;
158155 bool enc;
156
+ bool init;
159157
160158 unsigned int len;
161159 };
....@@ -169,9 +167,6 @@
169167
170168 int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
171169 void af_alg_free_sg(struct af_alg_sgl *sgl);
172
-void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new);
173
-
174
-int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con);
175170
176171 static inline struct alg_sock *alg_sk(struct sock *sk)
177172 {
....@@ -230,15 +225,11 @@
230225 return PAGE_SIZE <= af_alg_rcvbuf(sk);
231226 }
232227
233
-int af_alg_alloc_tsgl(struct sock *sk);
234228 unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offset);
235229 void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *dst,
236230 size_t dst_offset);
237
-void af_alg_free_areq_sgls(struct af_alg_async_req *areq);
238
-int af_alg_wait_for_wmem(struct sock *sk, unsigned int flags);
239231 void af_alg_wmem_wakeup(struct sock *sk);
240
-int af_alg_wait_for_data(struct sock *sk, unsigned flags);
241
-void af_alg_data_wakeup(struct sock *sk);
232
+int af_alg_wait_for_data(struct sock *sk, unsigned flags, unsigned min);
242233 int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
243234 unsigned int ivsize);
244235 ssize_t af_alg_sendpage(struct socket *sock, struct page *page,