~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/crypto/if_alg.h

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * if_alg: User-space algorithm interface
  3  *
  4  * 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  */
 12 
 13 #ifndef _CRYPTO_IF_ALG_H
 14 #define _CRYPTO_IF_ALG_H
 15 
 16 #include <linux/compiler.h>
 17 #include <linux/completion.h>
 18 #include <linux/if_alg.h>
 19 #include <linux/scatterlist.h>
 20 #include <linux/types.h>
 21 #include <net/sock.h>
 22 
 23 #define ALG_MAX_PAGES                   16
 24 
 25 struct crypto_async_request;
 26 
 27 struct alg_sock {
 28         /* struct sock must be the first member of struct alg_sock */
 29         struct sock sk;
 30 
 31         struct sock *parent;
 32 
 33         unsigned int refcnt;
 34         unsigned int nokey_refcnt;
 35 
 36         const struct af_alg_type *type;
 37         void *private;
 38 };
 39 
 40 struct af_alg_completion {
 41         struct completion completion;
 42         int err;
 43 };
 44 
 45 struct af_alg_control {
 46         struct af_alg_iv *iv;
 47         int op;
 48         unsigned int aead_assoclen;
 49 };
 50 
 51 struct af_alg_type {
 52         void *(*bind)(const char *name, u32 type, u32 mask);
 53         void (*release)(void *private);
 54         int (*setkey)(void *private, const u8 *key, unsigned int keylen);
 55         int (*accept)(void *private, struct sock *sk);
 56         int (*accept_nokey)(void *private, struct sock *sk);
 57         int (*setauthsize)(void *private, unsigned int authsize);
 58 
 59         struct proto_ops *ops;
 60         struct proto_ops *ops_nokey;
 61         struct module *owner;
 62         char name[14];
 63 };
 64 
 65 struct af_alg_sgl {
 66         struct scatterlist sg[ALG_MAX_PAGES + 1];
 67         struct page *pages[ALG_MAX_PAGES];
 68         unsigned int npages;
 69 };
 70 
 71 int af_alg_register_type(const struct af_alg_type *type);
 72 int af_alg_unregister_type(const struct af_alg_type *type);
 73 
 74 int af_alg_release(struct socket *sock);
 75 void af_alg_release_parent(struct sock *sk);
 76 int af_alg_accept(struct sock *sk, struct socket *newsock);
 77 
 78 int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
 79 void af_alg_free_sg(struct af_alg_sgl *sgl);
 80 void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new);
 81 
 82 int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con);
 83 
 84 int af_alg_wait_for_completion(int err, struct af_alg_completion *completion);
 85 void af_alg_complete(struct crypto_async_request *req, int err);
 86 
 87 static inline struct alg_sock *alg_sk(struct sock *sk)
 88 {
 89         return (struct alg_sock *)sk;
 90 }
 91 
 92 static inline void af_alg_init_completion(struct af_alg_completion *completion)
 93 {
 94         init_completion(&completion->completion);
 95 }
 96 
 97 #endif  /* _CRYPTO_IF_ALG_H */
 98 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp