| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * if_alg: User-space algorithm interface |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 11 | 6 | */ |
|---|
| 12 | 7 | |
|---|
| 13 | 8 | #ifndef _CRYPTO_IF_ALG_H |
|---|
| .. | .. |
|---|
| 51 | 46 | void *(*bind)(const char *name, u32 type, u32 mask); |
|---|
| 52 | 47 | void (*release)(void *private); |
|---|
| 53 | 48 | int (*setkey)(void *private, const u8 *key, unsigned int keylen); |
|---|
| 49 | + int (*setentropy)(void *private, sockptr_t entropy, unsigned int len); |
|---|
| 54 | 50 | int (*accept)(void *private, struct sock *sk); |
|---|
| 55 | 51 | int (*accept_nokey)(void *private, struct sock *sk); |
|---|
| 56 | 52 | int (*setauthsize)(void *private, unsigned int authsize); |
|---|
| .. | .. |
|---|
| 71 | 67 | struct af_alg_tsgl { |
|---|
| 72 | 68 | struct list_head list; |
|---|
| 73 | 69 | 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 */ |
|---|
| 75 | 71 | }; |
|---|
| 76 | 72 | |
|---|
| 77 | 73 | #define MAX_SGL_ENTS ((4096 - sizeof(struct af_alg_tsgl)) / \ |
|---|
| .. | .. |
|---|
| 140 | 136 | * SG? |
|---|
| 141 | 137 | * @enc: Cryptographic operation to be performed when |
|---|
| 142 | 138 | * recvmsg is invoked. |
|---|
| 139 | + * @init: True if metadata has been sent. |
|---|
| 143 | 140 | * @len: Length of memory allocated for this data structure. |
|---|
| 144 | 141 | */ |
|---|
| 145 | 142 | struct af_alg_ctx { |
|---|
| .. | .. |
|---|
| 156 | 153 | bool more; |
|---|
| 157 | 154 | bool merge; |
|---|
| 158 | 155 | bool enc; |
|---|
| 156 | + bool init; |
|---|
| 159 | 157 | |
|---|
| 160 | 158 | unsigned int len; |
|---|
| 161 | 159 | }; |
|---|
| .. | .. |
|---|
| 169 | 167 | |
|---|
| 170 | 168 | int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len); |
|---|
| 171 | 169 | 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); |
|---|
| 175 | 170 | |
|---|
| 176 | 171 | static inline struct alg_sock *alg_sk(struct sock *sk) |
|---|
| 177 | 172 | { |
|---|
| .. | .. |
|---|
| 230 | 225 | return PAGE_SIZE <= af_alg_rcvbuf(sk); |
|---|
| 231 | 226 | } |
|---|
| 232 | 227 | |
|---|
| 233 | | -int af_alg_alloc_tsgl(struct sock *sk); |
|---|
| 234 | 228 | unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offset); |
|---|
| 235 | 229 | void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *dst, |
|---|
| 236 | 230 | 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); |
|---|
| 239 | 231 | 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); |
|---|
| 242 | 233 | int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, |
|---|
| 243 | 234 | unsigned int ivsize); |
|---|
| 244 | 235 | ssize_t af_alg_sendpage(struct socket *sock, struct page *page, |
|---|