smb_sign_kcf.c revision a90cf9f29973990687fa61de9f1f6ea22e924e40
/*
* 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 the
* Kernel Cryptographic Framework (KCF)
*
* There are two implementations of these functions:
* This one (for kernel) and another for user space:
* See: lib/smbsrv/libfksmbsrv/common/fksmb_sign_pkcs.c
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_signing.h>
/*
* SMB1 signing helpers:
* (getmech, init, update, final)
*/
int
{
t = crypto_mech2id(SUN_CKM_MD5);
if (t == CRYPTO_MECH_INVALID)
return (-1);
return (0);
}
/*
* Start the KCF session, load the key
*/
int
{
int rv;
}
/*
* Digest one segment
*/
int
{
int rv;
}
/*
* Get the final digest.
*/
int
{
int rv;
}
/*
* SMB2 signing helpers:
* (getmech, init, update, final)
*/
int
{
if (t == CRYPTO_MECH_INVALID)
return (-1);
return (0);
}
/*
* Start the KCF session, load the key
*/
int
{
int rv;
}
/*
* Digest one segment
*/
int
{
int rv;
}
/*
* Note, the SMB2 signature is the first 16 bytes of the
* 32-byte SHA256 HMAC digest.
*/
int
{
int rv;
if (rv == CRYPTO_SUCCESS)
}