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
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.
13 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
16 #ifndef _SMB_SIGNING_H_
17 #define _SMB_SIGNING_H_
20 * SMB signing routines used in {smb,smb2}_signing.c
21 * Two implementations of these (kernel/user) in:
22 * uts/common/fs/smbsrv/smb_sign_kcf.c
23 * lib/smbsrv/libfksmbsrv/common/fksmb_sign_pkcs.c
27 #include <sys/crypto/api.h>
29 #include <security/cryptoki.h>
30 #include <security/pkcs11.h>
37 #define MD5_DIGEST_LENGTH 16 /* MD5 digest length in bytes */
38 #define SHA256_DIGEST_LENGTH 32 /* SHA256 digest length in bytes */
39 #define SMB2_SIG_SIZE 16
43 typedef crypto_mechanism_t smb_sign_mech_t
;
44 typedef crypto_context_t smb_sign_ctx_t
;
47 typedef CK_MECHANISM smb_sign_mech_t
;
48 typedef CK_SESSION_HANDLE smb_sign_ctx_t
;
52 * SMB signing routines used in smb_signing.c
55 int smb_md5_getmech(smb_sign_mech_t
*);
56 int smb_md5_init(smb_sign_ctx_t
*, smb_sign_mech_t
*);
57 int smb_md5_update(smb_sign_ctx_t
, void *, size_t);
58 int smb_md5_final(smb_sign_ctx_t
, uint8_t *);
61 * SMB2 signing routines used in smb2_signing.c
64 int smb2_hmac_getmech(smb_sign_mech_t
*);
65 int smb2_hmac_init(smb_sign_ctx_t
*, smb_sign_mech_t
*, uint8_t *, size_t);
66 int smb2_hmac_update(smb_sign_ctx_t
, uint8_t *, size_t);
67 int smb2_hmac_final(smb_sign_ctx_t
, uint8_t *);
73 #endif /* _SMB_SIGNING_H_ */