^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * if_alg: User-space algorithm interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _CRYPTO_IF_ALG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _CRYPTO_IF_ALG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/completion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/if_alg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <crypto/aead.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <crypto/skcipher.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define ALG_MAX_PAGES 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct crypto_async_request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct alg_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* struct sock must be the first member of struct alg_sock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct sock sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct sock *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) atomic_t refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) atomic_t nokey_refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) const struct af_alg_type *type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void *private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct af_alg_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct af_alg_iv *iv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned int aead_assoclen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct af_alg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void *(*bind)(const char *name, u32 type, u32 mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void (*release)(void *private);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int (*setkey)(void *private, const u8 *key, unsigned int keylen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int (*setentropy)(void *private, sockptr_t entropy, unsigned int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int (*accept)(void *private, struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int (*accept_nokey)(void *private, struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int (*setauthsize)(void *private, unsigned int authsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct proto_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct proto_ops *ops_nokey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) char name[14];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct af_alg_sgl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct scatterlist sg[ALG_MAX_PAGES + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct page *pages[ALG_MAX_PAGES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) unsigned int npages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* TX SGL entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct af_alg_tsgl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) unsigned int cur; /* Last processed SG entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct scatterlist sg[]; /* Array of SGs forming the SGL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define MAX_SGL_ENTS ((4096 - sizeof(struct af_alg_tsgl)) / \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) sizeof(struct scatterlist) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* RX SGL entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct af_alg_rsgl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct af_alg_sgl sgl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) size_t sg_num_bytes; /* Bytes of data in that SGL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * struct af_alg_async_req - definition of crypto request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * @iocb: IOCB for AIO operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * @sk: Socket the request is associated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * @first_rsgl: First RX SG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * @last_rsgl: Pointer to last RX SG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * @rsgl_list: Track RX SGs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * @tsgl: Private, per request TX SGL of buffers to process
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * @tsgl_entries: Number of entries in priv. TX SGL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * @outlen: Number of output bytes generated by crypto op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * @areqlen: Length of this data structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * @cra_u: Cipher request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct af_alg_async_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct kiocb *iocb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct sock *sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct af_alg_rsgl first_rsgl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct af_alg_rsgl *last_rsgl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct list_head rsgl_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct scatterlist *tsgl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) unsigned int tsgl_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) unsigned int outlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned int areqlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct aead_request aead_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct skcipher_request skcipher_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) } cra_u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* req ctx trails this struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * struct af_alg_ctx - definition of the crypto context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * The crypto context tracks the input data during the lifetime of an AF_ALG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * socket.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * @tsgl_list: Link to TX SGL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * @iv: IV for cipher operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * @aead_assoclen: Length of AAD for AEAD cipher operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * @completion: Work queue for synchronous operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @used: TX bytes sent to kernel. This variable is used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * ensure that user space cannot cause the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * to allocate too much memory in sendmsg operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * @rcvused: Total RX bytes to be filled by kernel. This variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * is used to ensure user space cannot cause the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * to allocate too much memory in a recvmsg operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * @more: More data to be expected from user space?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * @merge: Shall new data from user space be merged into existing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * SG?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * @enc: Cryptographic operation to be performed when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * recvmsg is invoked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * @init: True if metadata has been sent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @len: Length of memory allocated for this data structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct af_alg_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct list_head tsgl_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) void *iv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) size_t aead_assoclen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct crypto_wait wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) size_t used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) atomic_t rcvused;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) bool more;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) bool merge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) bool enc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) bool init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) unsigned int len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int af_alg_register_type(const struct af_alg_type *type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int af_alg_unregister_type(const struct af_alg_type *type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) int af_alg_release(struct socket *sock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) void af_alg_release_parent(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) void af_alg_free_sg(struct af_alg_sgl *sgl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static inline struct alg_sock *alg_sk(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) return (struct alg_sock *)sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * Size of available buffer for sending data from user space to kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @sk socket of connection to user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * @return number of bytes still available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) static inline int af_alg_sndbuf(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) struct alg_sock *ask = alg_sk(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct af_alg_ctx *ctx = ask->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) return max_t(int, max_t(int, sk->sk_sndbuf & PAGE_MASK, PAGE_SIZE) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) ctx->used, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * Can the send buffer still be written to?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * @sk socket of connection to user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * @return true => writable, false => not writable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline bool af_alg_writable(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return PAGE_SIZE <= af_alg_sndbuf(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * Size of available buffer used by kernel for the RX user space operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * @sk socket of connection to user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * @return number of bytes still available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static inline int af_alg_rcvbuf(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct alg_sock *ask = alg_sk(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) struct af_alg_ctx *ctx = ask->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) return max_t(int, max_t(int, sk->sk_rcvbuf & PAGE_MASK, PAGE_SIZE) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) atomic_read(&ctx->rcvused), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * Can the RX buffer still be written to?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * @sk socket of connection to user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * @return true => writable, false => not writable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static inline bool af_alg_readable(struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return PAGE_SIZE <= af_alg_rcvbuf(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) unsigned int af_alg_count_tsgl(struct sock *sk, size_t bytes, size_t offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) void af_alg_pull_tsgl(struct sock *sk, size_t used, struct scatterlist *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) size_t dst_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void af_alg_wmem_wakeup(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) int af_alg_wait_for_data(struct sock *sk, unsigned flags, unsigned min);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) unsigned int ivsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ssize_t af_alg_sendpage(struct socket *sock, struct page *page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int offset, size_t size, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void af_alg_free_resources(struct af_alg_async_req *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) void af_alg_async_cb(struct crypto_async_request *_req, int err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) __poll_t af_alg_poll(struct file *file, struct socket *sock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) struct af_alg_async_req *af_alg_alloc_areq(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) unsigned int areqlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) struct af_alg_async_req *areq, size_t maxsize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) size_t *outlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) #endif /* _CRYPTO_IF_ALG_H */