Commit c2b0a383 authored by Steve French's avatar Steve French Committed by Steve French

[CIFS] remove sparse warnings

Signed-off-by: Steve French (sfrench@us.ibm.com)
parent 04914174
/*
* fs/cifs/cifsencrypt.h
*
* Copyright (c) International Business Machines Corp., 2005
* Author(s): Steve French (sfrench@us.ibm.com)
*
* Externs for misc. small encryption routines
* so we do not have to put them in cifsproto.h
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* md4.c */
extern void mdfour(unsigned char *out, unsigned char *in, int n);
/* smbdes.c */
extern void E_P16(unsigned char *p14, unsigned char *p16);
extern void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
extern void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
extern void E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out);
...@@ -203,6 +203,16 @@ extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, ...@@ -203,6 +203,16 @@ extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
const __u64 lseek, unsigned int *nbytes, const __u64 lseek, unsigned int *nbytes,
const char *buf, const char __user *ubuf, const char *buf, const char __user *ubuf,
const int long_op); const int long_op);
#ifdef CONFIG_CIFS_EXPERIMENTAL
extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
const int netfid, const unsigned int count,
const __u64 offset, unsigned int *nbytes,
const char __user *buf,const int long_op);
extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
const unsigned char *searchName, __u64 * inode_number,
const struct nls_table *nls_codepage);
#endif /* CONFIG_CIFS_EXPERIMENTAL */
extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
const __u16 netfid, const __u64 len, const __u16 netfid, const __u64 len,
const __u64 offset, const __u32 numUnlock, const __u64 offset, const __u32 numUnlock,
......
...@@ -2239,9 +2239,8 @@ CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -2239,9 +2239,8 @@ CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
} }
#ifdef CONFIG_CIFS_EXPERIMENTAL /* function unused at present */ #if 0 /* function unused at present */
int int CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
const char *searchName, FILE_ALL_INFO * findData, const char *searchName, FILE_ALL_INFO * findData,
const struct nls_table *nls_codepage) const struct nls_table *nls_codepage)
{ {
...@@ -2318,7 +2317,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -2318,7 +2317,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
} }
#endif /* CIFS_EXPERIMENTAL */ #endif /* end unused (temporarily) function */
/* xid, tcon, searchName and codepage are input parms, rest are returned */ /* xid, tcon, searchName and codepage are input parms, rest are returned */
int int
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/fs.h> #include <linux/fs.h>
#include "cifsencrypt.h"
/* NOTE: This code makes no attempt to be fast! */ /* NOTE: This code makes no attempt to be fast! */
static __u32 static __u32
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
up with a different answer to the one above) up with a different answer to the one above)
*/ */
#include <linux/slab.h> #include <linux/slab.h>
#include "cifsencrypt.h"
#define uchar unsigned char #define uchar unsigned char
static uchar perm1[56] = { 57, 49, 41, 33, 25, 17, 9, static uchar perm1[56] = { 57, 49, 41, 33, 25, 17, 9,
...@@ -376,7 +377,9 @@ E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out) ...@@ -376,7 +377,9 @@ E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out)
smbhash(out, in, p14, 1); smbhash(out, in, p14, 1);
smbhash(out + 8, in + 8, p14 + 7, 1); smbhash(out + 8, in + 8, p14 + 7, 1);
} }
#if 0
/* these routines are currently unneeded, but may be
needed later */
void void
cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key) cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key)
{ {
...@@ -406,3 +409,4 @@ cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw) ...@@ -406,3 +409,4 @@ cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
key2[0] = key[7]; key2[0] = key[7];
smbhash(out + 8, in + 8, key2, forw); smbhash(out + 8, in + 8, key2, forw);
} }
#endif /* unneeded routines */
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "cifspdu.h" #include "cifspdu.h"
#include "md5.h" #include "md5.h"
#include "cifs_debug.h" #include "cifs_debug.h"
#include "cifsencrypt.h"
#ifndef FALSE #ifndef FALSE
#define FALSE 0 #define FALSE 0
...@@ -45,27 +46,12 @@ ...@@ -45,27 +46,12 @@
#define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8) #define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((__u16)(val))) #define SSVAL(buf,pos,val) SSVALX((buf),(pos),((__u16)(val)))
/*The following definitions come from lib/md4.c */
void mdfour(unsigned char *out, unsigned char *in, int n);
/*The following definitions come from libsmb/smbdes.c */
void E_P16(unsigned char *p14, unsigned char *p16);
void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out);
void E_old_pw_hash(unsigned char *p14, unsigned char *in, unsigned char *out);
void cred_hash1(unsigned char *out, unsigned char *in, unsigned char *key);
void cred_hash2(unsigned char *out, unsigned char *in, unsigned char *key);
void cred_hash3(unsigned char *out, unsigned char *in, unsigned char *key,
int forw);
/*The following definitions come from libsmb/smbencrypt.c */ /*The following definitions come from libsmb/smbencrypt.c */
void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
void E_md4hash(const unsigned char *passwd, unsigned char *p16); void E_md4hash(const unsigned char *passwd, unsigned char *p16);
void nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]); void nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16]);
void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8, static void SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
unsigned char p24[24]); unsigned char p24[24]);
void NTLMSSPOWFencrypt(unsigned char passwd[8], void NTLMSSPOWFencrypt(unsigned char passwd[8],
unsigned char *ntlmchalresp, unsigned char p24[24]); unsigned char *ntlmchalresp, unsigned char p24[24]);
...@@ -223,7 +209,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, ...@@ -223,7 +209,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
#endif #endif
/* Does the des encryption from the NT or LM MD4 hash. */ /* Does the des encryption from the NT or LM MD4 hash. */
void static void
SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8, SMBOWFencrypt(unsigned char passwd[16], unsigned char *c8,
unsigned char p24[24]) unsigned char p24[24])
{ {
...@@ -262,8 +248,11 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) ...@@ -262,8 +248,11 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
SMBOWFencrypt(p21, c8, p24); SMBOWFencrypt(p21, c8, p24);
} }
/* Does the md5 encryption from the NT hash for NTLMv2. */ /* Does the md5 encryption from the NT hash for NTLMv2. */
void /* These routines will be needed later */
#if 0
static void
SMBOWFencrypt_ntv2(const unsigned char kr[16], SMBOWFencrypt_ntv2(const unsigned char kr[16],
const struct data_blob * srv_chal, const struct data_blob * srv_chal,
const struct data_blob * cli_chal, unsigned char resp_buf[16]) const struct data_blob * cli_chal, unsigned char resp_buf[16])
...@@ -276,7 +265,7 @@ SMBOWFencrypt_ntv2(const unsigned char kr[16], ...@@ -276,7 +265,7 @@ SMBOWFencrypt_ntv2(const unsigned char kr[16],
hmac_md5_final(resp_buf, &ctx); hmac_md5_final(resp_buf, &ctx);
} }
void static void
SMBsesskeygen_ntv2(const unsigned char kr[16], SMBsesskeygen_ntv2(const unsigned char kr[16],
const unsigned char *nt_resp, __u8 sess_key[16]) const unsigned char *nt_resp, __u8 sess_key[16])
{ {
...@@ -287,9 +276,10 @@ SMBsesskeygen_ntv2(const unsigned char kr[16], ...@@ -287,9 +276,10 @@ SMBsesskeygen_ntv2(const unsigned char kr[16],
hmac_md5_final((unsigned char *) sess_key, &ctx); hmac_md5_final((unsigned char *) sess_key, &ctx);
} }
void static void
SMBsesskeygen_ntv1(const unsigned char kr[16], SMBsesskeygen_ntv1(const unsigned char kr[16],
const unsigned char *nt_resp, __u8 sess_key[16]) const unsigned char *nt_resp, __u8 sess_key[16])
{ {
mdfour((unsigned char *) sess_key, (unsigned char *) kr, 16); mdfour((unsigned char *) sess_key, (unsigned char *) kr, 16);
} }
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment