Root/
Source at commit cdde9cf73945d547acd3e96f9508c79e84ad0bf1 created 12 years 9 months ago. By Maarten ter Huurne, MMC: JZ4740: Added support for CPU frequency changing | |
---|---|
1 | /* |
2 | * Cryptographic API. |
3 | * |
4 | * Partial (de)compression operations. |
5 | * |
6 | * Copyright 2008 Sony Corporation |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; version 2 of the License. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program. |
19 | * If not, see <http://www.gnu.org/licenses/>. |
20 | */ |
21 | |
22 | #include <linux/crypto.h> |
23 | #include <linux/errno.h> |
24 | #include <linux/module.h> |
25 | #include <linux/seq_file.h> |
26 | #include <linux/string.h> |
27 | #include <linux/cryptouser.h> |
28 | #include <net/netlink.h> |
29 | |
30 | #include <crypto/compress.h> |
31 | #include <crypto/internal/compress.h> |
32 | |
33 | #include "internal.h" |
34 | |
35 | |
36 | static int crypto_pcomp_init(struct crypto_tfm *tfm, u32 type, u32 mask) |
37 | { |
38 | return 0; |
39 | } |
40 | |
41 | static unsigned int crypto_pcomp_extsize(struct crypto_alg *alg) |
42 | { |
43 | return alg->cra_ctxsize; |
44 | } |
45 | |
46 | static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm) |
47 | { |
48 | return 0; |
49 | } |
50 | |
51 | #ifdef CONFIG_NET |
52 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) |
53 | { |
54 | struct crypto_report_comp rpcomp; |
55 | |
56 | snprintf(rpcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "pcomp"); |
57 | |
58 | if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, |
59 | sizeof(struct crypto_report_comp), &rpcomp)) |
60 | goto nla_put_failure; |
61 | return 0; |
62 | |
63 | nla_put_failure: |
64 | return -EMSGSIZE; |
65 | } |
66 | #else |
67 | static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) |
68 | { |
69 | return -ENOSYS; |
70 | } |
71 | #endif |
72 | |
73 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) |
74 | __attribute__ ((unused)); |
75 | static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg) |
76 | { |
77 | seq_printf(m, "type : pcomp\n"); |
78 | } |
79 | |
80 | static const struct crypto_type crypto_pcomp_type = { |
81 | .extsize = crypto_pcomp_extsize, |
82 | .init = crypto_pcomp_init, |
83 | .init_tfm = crypto_pcomp_init_tfm, |
84 | #ifdef CONFIG_PROC_FS |
85 | .show = crypto_pcomp_show, |
86 | #endif |
87 | .report = crypto_pcomp_report, |
88 | .maskclear = ~CRYPTO_ALG_TYPE_MASK, |
89 | .maskset = CRYPTO_ALG_TYPE_MASK, |
90 | .type = CRYPTO_ALG_TYPE_PCOMPRESS, |
91 | .tfmsize = offsetof(struct crypto_pcomp, base), |
92 | }; |
93 | |
94 | struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type, |
95 | u32 mask) |
96 | { |
97 | return crypto_alloc_tfm(alg_name, &crypto_pcomp_type, type, mask); |
98 | } |
99 | EXPORT_SYMBOL_GPL(crypto_alloc_pcomp); |
100 | |
101 | int crypto_register_pcomp(struct pcomp_alg *alg) |
102 | { |
103 | struct crypto_alg *base = &alg->base; |
104 | |
105 | base->cra_type = &crypto_pcomp_type; |
106 | base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; |
107 | base->cra_flags |= CRYPTO_ALG_TYPE_PCOMPRESS; |
108 | |
109 | return crypto_register_alg(base); |
110 | } |
111 | EXPORT_SYMBOL_GPL(crypto_register_pcomp); |
112 | |
113 | int crypto_unregister_pcomp(struct pcomp_alg *alg) |
114 | { |
115 | return crypto_unregister_alg(&alg->base); |
116 | } |
117 | EXPORT_SYMBOL_GPL(crypto_unregister_pcomp); |
118 | |
119 | MODULE_LICENSE("GPL"); |
120 | MODULE_DESCRIPTION("Partial (de)compression type"); |
121 | MODULE_AUTHOR("Sony Corporation"); |
122 |
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