smb_crypt.c revision 4bff34e37def8a90f9194d81bc345c52ba20086a
/*
* Copyright (c) 2000-2001, Boris Popov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Boris Popov.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: smb_crypt.c,v 1.13 2005/01/26 23:50:50 lindak Exp $
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <netsmb/smb_osdep.h>
#include <netsmb/smb_conn.h>
#include <netsmb/smb_subr.h>
static void
{
int rv;
/*
* 'Key' here is the username - 7-bytes. Convert that to
* to a 8-byte string.
*/
mech.cm_param_len = 0;
if (rv != CRYPTO_SUCCESS)
SMBSDEBUG("crypto_encrypt failed.\n");
}
/*
* Compute the LM hash, which is used to compute the LM response.
*/
void
{
/* Convert apwd to upper case, zero extend. */
/*
* lmhash = concat(Ex(P14, N8), zeros(5));
*/
}
/*
* Compute an LM or NTLM response given the LM or NTLM hash and a
* challenge. Note: This now replaces smb_ntlmresponse which
* used to compute a different hash and then do the same
* response computation as found here. Now that the hash
* is computed by the caller, this is used for both.
*/
int
{
return (0);
}
/*
* Compute the NTLMv1 hash, which is used to compute both NTLMv1 and
* NTLMv2 responses.
*/
void
{
/*
* v1hash = concat(MD4(U(apwd)), zeros(5));
*/
}
/*
* Note: smb_ntlmresponse() is gone.
* Use: smb_lmresponse() instead.
*/
static void
{
int i;
/* if key is longer than 64 bytes use only the first 64 bytes */
if (key_len > 64)
key_len = 64;
/*
* The HMAC-MD5 (and HMACT64) transform looks like:
*
* MD5(K XOR opad, MD5(K XOR ipad, data))
*
* where K is an n byte key
* ipad is the byte 0x36 repeated 64 times
* opad is the byte 0x5c repeated 64 times
* and data is the data being protected.
*/
/* start out by storing key in pads */
/* XOR key with ipad and opad values */
for (i = 0; i < 64; i++) {
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
/*
* perform inner MD5
*/
/*
* perform outer MD5
*/
}
/*
* Compute an NTLMv2 response given the 21 byte NTLM(v1) hash,
* a challenge, and the blob.
*/
int
{
/*
* v2hash=HMACT64(v1hash, 16, concat(upcase(user), upcase(destination))
* We assume that user and destination are supplied to us as
* upper-case UTF-8.
*/
return (0);
}