Blame view

crypto/pcompress.c 2.48 KB
a1d2f0954   Geert Uytterhoeven   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
27
28
  /*
   * 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>
  
  #include <crypto/compress.h>
2f6ceb793   Geert Uytterhoeven   crypto: pcomp - p...
29
  #include <crypto/internal/compress.h>
a1d2f0954   Geert Uytterhoeven   crypto: compress ...
30
31
32
33
34
35
36
37
  
  #include "internal.h"
  
  
  static int crypto_pcomp_init(struct crypto_tfm *tfm, u32 type, u32 mask)
  {
  	return 0;
  }
2ca33da1d   Herbert Xu   crypto: api - Rem...
38
  static unsigned int crypto_pcomp_extsize(struct crypto_alg *alg)
a1d2f0954   Geert Uytterhoeven   crypto: compress ...
39
40
41
  {
  	return alg->cra_ctxsize;
  }
2ca33da1d   Herbert Xu   crypto: api - Rem...
42
  static int crypto_pcomp_init_tfm(struct crypto_tfm *tfm)
a1d2f0954   Geert Uytterhoeven   crypto: compress ...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  {
  	return 0;
  }
  
  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
  	.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");