databuf bugfix, find_neigh bugfix
[cor_2_6_31.git] / crypto / pcompress.c
blobbcadc03726b7eb2d12ac71b251da31e4e38651bf
1 /*
2 * Cryptographic API.
4 * Partial (de)compression operations.
6 * Copyright 2008 Sony Corporation
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.
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.
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/>.
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>
28 #include <crypto/compress.h>
29 #include <crypto/internal/compress.h>
31 #include "internal.h"
34 static int crypto_pcomp_init(struct crypto_tfm *tfm, u32 type, u32 mask)
36 return 0;
39 static unsigned int crypto_pcomp_extsize(struct crypto_alg *alg,
40 const struct crypto_type *frontend)
42 return alg->cra_ctxsize;
45 static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm,
46 const struct crypto_type *frontend)
48 return 0;
51 static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
52 __attribute__ ((unused));
53 static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
55 seq_printf(m, "type : pcomp\n");
58 static const struct crypto_type crypto_pcomp_type = {
59 .extsize = crypto_pcomp_extsize,
60 .init = crypto_pcomp_init,
61 .init_tfm = crypto_pcomp_init_tfm,
62 #ifdef CONFIG_PROC_FS
63 .show = crypto_pcomp_show,
64 #endif
65 .maskclear = ~CRYPTO_ALG_TYPE_MASK,
66 .maskset = CRYPTO_ALG_TYPE_MASK,
67 .type = CRYPTO_ALG_TYPE_PCOMPRESS,
68 .tfmsize = offsetof(struct crypto_pcomp, base),
71 struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type,
72 u32 mask)
74 return crypto_alloc_tfm(alg_name, &crypto_pcomp_type, type, mask);
76 EXPORT_SYMBOL_GPL(crypto_alloc_pcomp);
78 int crypto_register_pcomp(struct pcomp_alg *alg)
80 struct crypto_alg *base = &alg->base;
82 base->cra_type = &crypto_pcomp_type;
83 base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
84 base->cra_flags |= CRYPTO_ALG_TYPE_PCOMPRESS;
86 return crypto_register_alg(base);
88 EXPORT_SYMBOL_GPL(crypto_register_pcomp);
90 int crypto_unregister_pcomp(struct pcomp_alg *alg)
92 return crypto_unregister_alg(&alg->base);
94 EXPORT_SYMBOL_GPL(crypto_unregister_pcomp);
96 MODULE_LICENSE("GPL");
97 MODULE_DESCRIPTION("Partial (de)compression type");
98 MODULE_AUTHOR("Sony Corporation");