/*
* 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
*/
/*
*/
/*
* Crypto support, using libpkcs11
*
* Some code copied from the server: libsmb smb_crypt.c
* with minor changes, i.e. errno.h return values.
* XXX: Move this to a common library (later).
*/
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <security/cryptoki.h>
#include <cryptoutil.h>
#include "smbfs_crypt.h"
static void
/*
* Like libsmb smb_auth_DES,
* but use uchar_t, return errno.
*/
int
{
int error = 0;
int K, D;
int k, d;
/* Calculate proper number of iterations */
K = KeyLen / 7;
D = DataLen / 8;
if (ResultLen < (K * 8 * D)) {
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 (ENOTSUP);
}
for (k = 0; k < K; k++) {
goto exit_session;
}
/* Initialize the encryption operation in the session */
goto exit_encrypt;
}
for (d = 0; d < D; d++) {
/* Read in the data and encrypt this portion */
goto exit_encrypt;
}
}
}
goto exit_session;
(void) C_CloseSession(hSession);
return (error);
}
/*
* See "Netlogon Credential Computation" section of MS-NRPC document.
* Same as in libsmb, but output arg first.
*/
static void
{
int i;
for (i = 0; i < 8; i++)
}
/*
*
* There may be a preferred way to call this via libpkcs11
* XXX: (see: C_GenerateRandom, etc. -- later...)
*/
int
{
if (fd < 0)
return (errno);
if (rlen < 0)
return (errno);
return (EIO);
return (0);
}