aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smbencrypt.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-05-04 23:12:25 -0400
committerSteve French <smfrench@gmail.com>2013-05-04 23:17:23 -0400
commitf96637be081141d6f8813429499f164260b49d70 (patch)
treec91f5a9b5a2b7a67bbeda15d7c9805655547a098 /fs/cifs/smbencrypt.c
parentf7f7c1850eb98da758731ea7edfa830ebefe24cd (diff)
[CIFS] cifs: Rename cERROR and cFYI to cifs_dbg
It's not obvious from reading the macro names that these macros are for debugging. Convert the names to a single more typical kernel style cifs_dbg macro. cERROR(1, ...) -> cifs_dbg(VFS, ...) cFYI(1, ...) -> cifs_dbg(FYI, ...) cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...) Move the terminating format newline from the macro to the call site. Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the "CIFS VFS: " prefix for VFS messages. Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y) $ size fs/cifs/cifs.ko* text data bss dec hex filename 265245 2525 132 267902 4167e fs/cifs/cifs.ko.new 268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old Other miscellaneous changes around these conversions: o Miscellaneous typo fixes o Add terminating \n's to almost all formats and remove them from the macros to be more kernel style like. A few formats previously had defective \n's o Remove unnecessary OOM messages as kmalloc() calls dump_stack o Coalesce formats to make grep easier, added missing spaces when coalescing formats o Use %s, __func__ instead of embedded function name o Removed unnecessary "cifs: " prefixes o Convert kzalloc with multiply to kcalloc o Remove unused cifswarn macro Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smbencrypt.c')
-rw-r--r--fs/cifs/smbencrypt.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index a0a58fbe2c10..43eb1367b103 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -78,7 +78,7 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
78 tfm_des = crypto_alloc_blkcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC); 78 tfm_des = crypto_alloc_blkcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC);
79 if (IS_ERR(tfm_des)) { 79 if (IS_ERR(tfm_des)) {
80 rc = PTR_ERR(tfm_des); 80 rc = PTR_ERR(tfm_des);
81 cERROR(1, "could not allocate des crypto API"); 81 cifs_dbg(VFS, "could not allocate des crypto API\n");
82 goto smbhash_err; 82 goto smbhash_err;
83 } 83 }
84 84
@@ -91,7 +91,7 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
91 91
92 rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, 8); 92 rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, 8);
93 if (rc) 93 if (rc)
94 cERROR(1, "could not encrypt crypt key rc: %d", rc); 94 cifs_dbg(VFS, "could not encrypt crypt key rc: %d\n", rc);
95 95
96 crypto_free_blkcipher(tfm_des); 96 crypto_free_blkcipher(tfm_des);
97smbhash_err: 97smbhash_err:
@@ -139,14 +139,14 @@ mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len)
139 md4 = crypto_alloc_shash("md4", 0, 0); 139 md4 = crypto_alloc_shash("md4", 0, 0);
140 if (IS_ERR(md4)) { 140 if (IS_ERR(md4)) {
141 rc = PTR_ERR(md4); 141 rc = PTR_ERR(md4);
142 cERROR(1, "%s: Crypto md4 allocation error %d", __func__, rc); 142 cifs_dbg(VFS, "%s: Crypto md4 allocation error %d\n",
143 __func__, rc);
143 return rc; 144 return rc;
144 } 145 }
145 size = sizeof(struct shash_desc) + crypto_shash_descsize(md4); 146 size = sizeof(struct shash_desc) + crypto_shash_descsize(md4);
146 sdescmd4 = kmalloc(size, GFP_KERNEL); 147 sdescmd4 = kmalloc(size, GFP_KERNEL);
147 if (!sdescmd4) { 148 if (!sdescmd4) {
148 rc = -ENOMEM; 149 rc = -ENOMEM;
149 cERROR(1, "%s: Memory allocation failure", __func__);
150 goto mdfour_err; 150 goto mdfour_err;
151 } 151 }
152 sdescmd4->shash.tfm = md4; 152 sdescmd4->shash.tfm = md4;
@@ -154,17 +154,17 @@ mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len)
154 154
155 rc = crypto_shash_init(&sdescmd4->shash); 155 rc = crypto_shash_init(&sdescmd4->shash);
156 if (rc) { 156 if (rc) {
157 cERROR(1, "%s: Could not init md4 shash", __func__); 157 cifs_dbg(VFS, "%s: Could not init md4 shash\n", __func__);
158 goto mdfour_err; 158 goto mdfour_err;
159 } 159 }
160 rc = crypto_shash_update(&sdescmd4->shash, link_str, link_len); 160 rc = crypto_shash_update(&sdescmd4->shash, link_str, link_len);
161 if (rc) { 161 if (rc) {
162 cERROR(1, "%s: Could not update with link_str", __func__); 162 cifs_dbg(VFS, "%s: Could not update with link_str\n", __func__);
163 goto mdfour_err; 163 goto mdfour_err;
164 } 164 }
165 rc = crypto_shash_final(&sdescmd4->shash, md4_hash); 165 rc = crypto_shash_final(&sdescmd4->shash, md4_hash);
166 if (rc) 166 if (rc)
167 cERROR(1, "%s: Could not genereate md4 hash", __func__); 167 cifs_dbg(VFS, "%s: Could not generate md4 hash\n", __func__);
168 168
169mdfour_err: 169mdfour_err:
170 crypto_free_shash(md4); 170 crypto_free_shash(md4);
@@ -238,7 +238,8 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24,
238 238
239 rc = E_md4hash(passwd, p16, codepage); 239 rc = E_md4hash(passwd, p16, codepage);
240 if (rc) { 240 if (rc) {
241 cFYI(1, "%s Can't generate NT hash, error: %d", __func__, rc); 241 cifs_dbg(FYI, "%s Can't generate NT hash, error: %d\n",
242 __func__, rc);
242 return rc; 243 return rc;
243 } 244 }
244 memcpy(p21, p16, 16); 245 memcpy(p21, p16, 16);