aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_null.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2009-01-02 08:17:13 -0500
committerDavid Vrabel <david.vrabel@csr.com>2009-01-02 08:17:13 -0500
commitb21a207141d83a06abc5f492b80204602e02ca44 (patch)
treef0152cde543008c72d7eb5c12c18095ad92785e6 /crypto/crypto_null.c
parent3af373021fa32f8f787bfbdcc1a9277a287bde4e (diff)
parentb58602a4bac012b5f4fc12fe6b46ab237b610d5d (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-upstream
Conflicts: drivers/uwb/wlp/eda.c
Diffstat (limited to 'crypto/crypto_null.c')
-rw-r--r--crypto/crypto_null.c64
1 files changed, 41 insertions, 23 deletions
diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c
index 1f7d53013a22..cb71c9122bc0 100644
--- a/crypto/crypto_null.c
+++ b/crypto/crypto_null.c
@@ -17,6 +17,7 @@
17 * 17 *
18 */ 18 */
19 19
20#include <crypto/internal/hash.h>
20#include <crypto/internal/skcipher.h> 21#include <crypto/internal/skcipher.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/module.h> 23#include <linux/module.h>
@@ -38,15 +39,31 @@ static int null_compress(struct crypto_tfm *tfm, const u8 *src,
38 return 0; 39 return 0;
39} 40}
40 41
41static void null_init(struct crypto_tfm *tfm) 42static int null_init(struct shash_desc *desc)
42{ } 43{
44 return 0;
45}
43 46
44static void null_update(struct crypto_tfm *tfm, const u8 *data, 47static int null_update(struct shash_desc *desc, const u8 *data,
45 unsigned int len) 48 unsigned int len)
46{ } 49{
50 return 0;
51}
47 52
48static void null_final(struct crypto_tfm *tfm, u8 *out) 53static int null_final(struct shash_desc *desc, u8 *out)
49{ } 54{
55 return 0;
56}
57
58static int null_digest(struct shash_desc *desc, const u8 *data,
59 unsigned int len, u8 *out)
60{
61 return 0;
62}
63
64static int null_hash_setkey(struct crypto_shash *tfm, const u8 *key,
65 unsigned int keylen)
66{ return 0; }
50 67
51static int null_setkey(struct crypto_tfm *tfm, const u8 *key, 68static int null_setkey(struct crypto_tfm *tfm, const u8 *key,
52 unsigned int keylen) 69 unsigned int keylen)
@@ -89,19 +106,20 @@ static struct crypto_alg compress_null = {
89 .coa_decompress = null_compress } } 106 .coa_decompress = null_compress } }
90}; 107};
91 108
92static struct crypto_alg digest_null = { 109static struct shash_alg digest_null = {
93 .cra_name = "digest_null", 110 .digestsize = NULL_DIGEST_SIZE,
94 .cra_flags = CRYPTO_ALG_TYPE_DIGEST, 111 .setkey = null_hash_setkey,
95 .cra_blocksize = NULL_BLOCK_SIZE, 112 .init = null_init,
96 .cra_ctxsize = 0, 113 .update = null_update,
97 .cra_module = THIS_MODULE, 114 .finup = null_digest,
98 .cra_list = LIST_HEAD_INIT(digest_null.cra_list), 115 .digest = null_digest,
99 .cra_u = { .digest = { 116 .final = null_final,
100 .dia_digestsize = NULL_DIGEST_SIZE, 117 .base = {
101 .dia_setkey = null_setkey, 118 .cra_name = "digest_null",
102 .dia_init = null_init, 119 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
103 .dia_update = null_update, 120 .cra_blocksize = NULL_BLOCK_SIZE,
104 .dia_final = null_final } } 121 .cra_module = THIS_MODULE,
122 }
105}; 123};
106 124
107static struct crypto_alg cipher_null = { 125static struct crypto_alg cipher_null = {
@@ -154,7 +172,7 @@ static int __init crypto_null_mod_init(void)
154 if (ret < 0) 172 if (ret < 0)
155 goto out_unregister_cipher; 173 goto out_unregister_cipher;
156 174
157 ret = crypto_register_alg(&digest_null); 175 ret = crypto_register_shash(&digest_null);
158 if (ret < 0) 176 if (ret < 0)
159 goto out_unregister_skcipher; 177 goto out_unregister_skcipher;
160 178
@@ -166,7 +184,7 @@ out:
166 return ret; 184 return ret;
167 185
168out_unregister_digest: 186out_unregister_digest:
169 crypto_unregister_alg(&digest_null); 187 crypto_unregister_shash(&digest_null);
170out_unregister_skcipher: 188out_unregister_skcipher:
171 crypto_unregister_alg(&skcipher_null); 189 crypto_unregister_alg(&skcipher_null);
172out_unregister_cipher: 190out_unregister_cipher:
@@ -177,7 +195,7 @@ out_unregister_cipher:
177static void __exit crypto_null_mod_fini(void) 195static void __exit crypto_null_mod_fini(void)
178{ 196{
179 crypto_unregister_alg(&compress_null); 197 crypto_unregister_alg(&compress_null);
180 crypto_unregister_alg(&digest_null); 198 crypto_unregister_shash(&digest_null);
181 crypto_unregister_alg(&skcipher_null); 199 crypto_unregister_alg(&skcipher_null);
182 crypto_unregister_alg(&cipher_null); 200 crypto_unregister_alg(&cipher_null);
183} 201}