8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / uts / common / smbsrv / smb_signing.h
blob0d6c6bff91ee2630646c9fe9cabbffe1ea46148f
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.
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
26 #ifdef _KERNEL
27 #include <sys/crypto/api.h>
28 #else
29 #include <security/cryptoki.h>
30 #include <security/pkcs11.h>
31 #endif
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
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
41 #ifdef _KERNEL
42 /* KCF variant */
43 typedef crypto_mechanism_t smb_sign_mech_t;
44 typedef crypto_context_t smb_sign_ctx_t;
45 #else /* _KERNEL */
46 /* PKCS11 variant */
47 typedef CK_MECHANISM smb_sign_mech_t;
48 typedef CK_SESSION_HANDLE smb_sign_ctx_t;
49 #endif /* _KERNEL */
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 *);
69 #ifdef __cplusplus
71 #endif
73 #endif /* _SMB_SIGNING_H_ */