1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved. 14 */ 15 16 #ifndef _SMB_SIGNING_H_ 17 #define _SMB_SIGNING_H_ 18 19 #ifdef _KERNEL 20 #include <sys/crypto/api.h> 21 #else 22 #include <security/cryptoki.h> 23 #include <security/pkcs11.h> 24 #endif 25 26 #define MD5_DIGEST_LENGTH 16 /* MD5 digest length in bytes */ 27 28 #ifdef _KERNEL 29 /* KCF variant */ 30 typedef crypto_mechanism_t smb_sign_mech_t; 31 typedef crypto_context_t smb_sign_ctx_t; 32 #else /* _KERNEL */ 33 /* PKCS11 variant */ 34 typedef CK_MECHANISM smb_sign_mech_t; 35 typedef CK_SESSION_HANDLE smb_sign_ctx_t; 36 #endif /* _KERNEL */ 37 38 /* 39 * SMB1 signing routines used in smb_signing.c 40 * Two implementations of these (kernel/user) in: 41 * uts/common/fs/smbsrv/smb_sign_kcf.c 42 * lib/smbsrv/libfksmbsrv/common/fksmb_sign_pkcs.c 43 */ 44 45 int smb_md5_getmech(smb_sign_mech_t *); 46 int smb_md5_init(smb_sign_ctx_t *, smb_sign_mech_t *); 47 int smb_md5_update(smb_sign_ctx_t, void *, size_t); 48 int smb_md5_final(smb_sign_ctx_t, uint8_t *); 49 50 #endif /* _SMB_SIGNING_H_ */ 51