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