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

TOMOYO Linux Cross Reference
Linux/crypto/pcompress.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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  * 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         strncpy(rpcomp.type, "pcomp", sizeof(rpcomp.type));
 57         if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
 58                     sizeof(struct crypto_report_comp), &rpcomp))
 59                 goto nla_put_failure;
 60         return 0;
 61 
 62 nla_put_failure:
 63         return -EMSGSIZE;
 64 }
 65 #else
 66 static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg)
 67 {
 68         return -ENOSYS;
 69 }
 70 #endif
 71 
 72 static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
 73         __attribute__ ((unused));
 74 static void crypto_pcomp_show(struct seq_file *m, struct crypto_alg *alg)
 75 {
 76         seq_printf(m, "type         : pcomp\n");
 77 }
 78 
 79 static const struct crypto_type crypto_pcomp_type = {
 80         .extsize        = crypto_pcomp_extsize,
 81         .init           = crypto_pcomp_init,
 82         .init_tfm       = crypto_pcomp_init_tfm,
 83 #ifdef CONFIG_PROC_FS
 84         .show           = crypto_pcomp_show,
 85 #endif
 86         .report         = crypto_pcomp_report,
 87         .maskclear      = ~CRYPTO_ALG_TYPE_MASK,
 88         .maskset        = CRYPTO_ALG_TYPE_MASK,
 89         .type           = CRYPTO_ALG_TYPE_PCOMPRESS,
 90         .tfmsize        = offsetof(struct crypto_pcomp, base),
 91 };
 92 
 93 struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type,
 94                                         u32 mask)
 95 {
 96         return crypto_alloc_tfm(alg_name, &crypto_pcomp_type, type, mask);
 97 }
 98 EXPORT_SYMBOL_GPL(crypto_alloc_pcomp);
 99 
100 int crypto_register_pcomp(struct pcomp_alg *alg)
101 {
102         struct crypto_alg *base = &alg->base;
103 
104         base->cra_type = &crypto_pcomp_type;
105         base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
106         base->cra_flags |= CRYPTO_ALG_TYPE_PCOMPRESS;
107 
108         return crypto_register_alg(base);
109 }
110 EXPORT_SYMBOL_GPL(crypto_register_pcomp);
111 
112 int crypto_unregister_pcomp(struct pcomp_alg *alg)
113 {
114         return crypto_unregister_alg(&alg->base);
115 }
116 EXPORT_SYMBOL_GPL(crypto_unregister_pcomp);
117 
118 MODULE_LICENSE("GPL");
119 MODULE_DESCRIPTION("Partial (de)compression type");
120 MODULE_AUTHOR("Sony Corporation");
121 

~ [ 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