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