Root/
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/types.h> |
20 | #include <net/sock.h> |
21 | |
22 | #define ALG_MAX_PAGES 16 |
23 | |
24 | struct crypto_async_request; |
25 | |
26 | struct alg_sock { |
27 | /* struct sock must be the first member of struct alg_sock */ |
28 | struct sock sk; |
29 | |
30 | struct sock *parent; |
31 | |
32 | const struct af_alg_type *type; |
33 | void *private; |
34 | }; |
35 | |
36 | struct af_alg_completion { |
37 | struct completion completion; |
38 | int err; |
39 | }; |
40 | |
41 | struct af_alg_control { |
42 | struct af_alg_iv *iv; |
43 | int op; |
44 | }; |
45 | |
46 | struct af_alg_type { |
47 | void *(*bind)(const char *name, u32 type, u32 mask); |
48 | void (*release)(void *private); |
49 | int (*setkey)(void *private, const u8 *key, unsigned int keylen); |
50 | int (*accept)(void *private, struct sock *sk); |
51 | |
52 | struct proto_ops *ops; |
53 | struct module *owner; |
54 | char name[14]; |
55 | }; |
56 | |
57 | struct af_alg_sgl { |
58 | struct scatterlist sg[ALG_MAX_PAGES]; |
59 | struct page *pages[ALG_MAX_PAGES]; |
60 | }; |
61 | |
62 | int af_alg_register_type(const struct af_alg_type *type); |
63 | int af_alg_unregister_type(const struct af_alg_type *type); |
64 | |
65 | int af_alg_release(struct socket *sock); |
66 | int af_alg_accept(struct sock *sk, struct socket *newsock); |
67 | |
68 | int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, |
69 | int write); |
70 | void af_alg_free_sg(struct af_alg_sgl *sgl); |
71 | |
72 | int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con); |
73 | |
74 | int af_alg_wait_for_completion(int err, struct af_alg_completion *completion); |
75 | void af_alg_complete(struct crypto_async_request *req, int err); |
76 | |
77 | static inline struct alg_sock *alg_sk(struct sock *sk) |
78 | { |
79 | return (struct alg_sock *)sk; |
80 | } |
81 | |
82 | static inline void af_alg_release_parent(struct sock *sk) |
83 | { |
84 | sock_put(alg_sk(sk)->parent); |
85 | } |
86 | |
87 | static inline void af_alg_init_completion(struct af_alg_completion *completion) |
88 | { |
89 | init_completion(&completion->completion); |
90 | } |
91 | |
92 | #endif /* _CRYPTO_IF_ALG_H */ |
93 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9