/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
#include <string.h>
#include <security/cryptoki.h>
#include <cryptoutil.h>
/*
* randomize
*
* Randomize the contents of the specified buffer.
*/
void
{
char *p = data;
return;
/*
* Implement a "fall back", because current callers
* don't expect an error from this. In practice,
* we never use this fall back.
*/
while (len--) {
*p++ = (random() >> 24);
}
}
/*
* smb_auth_md4
*
* Compute an MD4 digest.
*/
int
{
return (SMBAUTH_SUCCESS);
}
int
int data_len,
unsigned char *key,
int key_len,
unsigned char *digest)
{
mechanism.pParameter = 0;
mechanism.ulParameterLen = 0;
return (SMBAUTH_FAILURE);
}
(void) C_CloseSession(hSession);
return (SMBAUTH_FAILURE);
}
/* Initialize the digest operation in the session */
(void) C_CloseSession(hSession);
return (SMBAUTH_FAILURE);
}
(void) C_CloseSession(hSession);
return (SMBAUTH_FAILURE);
}
(void) C_CloseSession(hSession);
return (SMBAUTH_FAILURE);
}
(void) C_CloseSession(hSession);
if (diglen != MD_DIGEST_LEN) {
return (SMBAUTH_FAILURE);
}
return (SMBAUTH_SUCCESS);
}
int
{
int error = 0;
int K, D;
int k, d;
/*
* Calculate proper number of iterations.
* Known call cases include:
* ResultLen=16, KeyLen=14, DataLen=8
* ResultLen=24, KeyLen=21, DataLen=8
* ResultLen=16, KeyLen=14, DataLen=16
*/
K = KeyLen / 7;
D = DataLen / 8;
return (EINVAL);
if (K == 0 || D == 0)
return (EINVAL);
if (ResultLen < (K * 8))
return (EINVAL);
/*
* Use SUNW convenience function to initialize the cryptoki
* library, and open a session with a slot that supports
* the mechanism we plan on using.
*/
mechanism.ulParameterLen = 0;
return (SMBAUTH_FAILURE);
}
for (d = k = 0; k < K; k++, d++) {
/* Cycle the input again, as necessary. */
if (d == D)
d = 0;
error = 1;
goto exit_session;
}
/* Initialize the encryption operation in the session */
error = 1;
goto exit_encrypt;
}
ciphertext_len = 8;
/* Read in the data and encrypt this portion */
error = 1;
goto exit_encrypt;
}
}
goto exit_session;
(void) C_CloseSession(hSession);
if (error)
return (SMBAUTH_FAILURE);
return (SMBAUTH_SUCCESS);
}
/*
* See "Netlogon Credential Computation" section of MS-NRPC document.
*/
static void
{
int i;
for (i = 0; i < 8; i++)
}
/*
* CKM_RC4
*/
int
{
/*
* Use SUNW convenience function to initialize the cryptoki
* library, and open a session with a slot that supports
* the mechanism we plan on using.
*/
mechanism.ulParameterLen = 0;
return (SMBAUTH_FAILURE);
}
goto exit_session;
/* Initialize the encryption operation in the session */
goto exit_encrypt;
error = 0;
(void) C_CloseSession(hSession);
return (error);
}