/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Helper functions for SMB signing using PKCS#11
*
* There are two implementations of these functions:
* This one (for user space) and another for kernel.
* See: uts/common/fs/smbsrv/smb_sign_kcf.c
*/
#include <stdlib.h>
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_signing.h>
#include <security/cryptoki.h>
/*
* SMB1 signing helpers:
* (getmech, init, update, final)
*/
int
{
mech->ulParameterLen = 0;
return (0);
}
/*
* Start PKCS#11 session.
*/
int
{
return (-1);
}
/*
* Digest one segment
*/
int
{
(void) C_CloseSession(ctx);
}
/*
* Get the final digest.
*/
int
{
(void) C_CloseSession(ctx);
}
/*
* SMB2 signing helpers:
* (getmech, init, update, final)
*/
int
{
mech->ulParameterLen = 0;
return (0);
}
/*
* Start PKCS#11 session, load the key.
*/
int
{
return (-1);
return (-1);
}
/*
* Digest one segment
*/
int
{
(void) C_CloseSession(ctx);
}
/*
* Note, the SMB2 signature is the first 16 bytes of the
* 32-byte SHA256 HMAC digest.
*/
int
{
(void) C_CloseSession(ctx);
}