xref: /titanic_52/usr/src/uts/common/inet/kssl/kssl.h (revision 9df12a23948bd40cbe37ce88d84e272c3894e675)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_INET_KSSL_KSSL_H
28 #define	_INET_KSSL_KSSL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 #include <sys/crypto/common.h>
39 
40 /* These are re-definition from <crypto/ioctl.h>  */
41 typedef struct kssl_object_attribute {
42 	uint64_t	ka_type;		/* attribute type */
43 	uint32_t	ka_value_offset;	/* offset to attribute value */
44 	uint32_t	ka_value_len;		/* length of attribute value */
45 } kssl_object_attribute_t;
46 
47 
48 typedef struct kssl_key {
49 	crypto_key_format_t ks_format;	/* format identifier */
50 	uint32_t ks_count;		/* number of attributes */
51 	uint32_t ks_attrs_offset;	/* offset to the attributes */
52 } kssl_key_t;
53 
54 
55 typedef struct kssl_certs_s {
56 	uint32_t sc_count;		/* number of certificates */
57 	uint32_t sc_sizes_offset;	/* offset to certificates sizes array */
58 	uint32_t sc_certs_offset;	/* offset to certificates array */
59 } kssl_certs_t;
60 
61 
62 #define	SSL_RSA_WITH_NULL_SHA		0x0002
63 #define	SSL_RSA_WITH_RC4_128_MD5	0x0004
64 #define	SSL_RSA_WITH_RC4_128_SHA	0x0005
65 #define	SSL_RSA_WITH_DES_CBC_SHA	0x0009
66 #define	SSL_RSA_WITH_3DES_EDE_CBC_SHA	0x000a
67 #define	CIPHER_SUITE_COUNT		5
68 #define	CIPHER_NOTSET			0xffff
69 
70 #define	DEFAULT_SID_TIMEOUT		86400	/* 24 hours in seconds */
71 #define	DEFAULT_SID_CACHE_NENTRIES	5000
72 
73 typedef struct kssl_params_s {
74 	uint64_t		kssl_params_size; /* total params buf len */
75 	/* address and port number */
76 	struct sockaddr_in	kssl_addr;
77 	uint16_t		kssl_proxy_port;
78 
79 	uint32_t		kssl_session_cache_timeout;	/* In seconds */
80 	uint32_t		kssl_session_cache_size;
81 
82 	/*
83 	 * Contains ordered list of cipher suites. We do not include
84 	 * the one suite with no encryption. Hence the -1.
85 	 */
86 	uint16_t		kssl_suites[CIPHER_SUITE_COUNT - 1];
87 
88 	/* certificates */
89 	kssl_certs_t		kssl_certs;
90 
91 	/* private key */
92 	kssl_key_t		kssl_privkey;
93 } kssl_params_t;
94 
95 /* The ioctls to /dev/kssl */
96 #define	KSSL_IOC(x)		(('s' << 24) | ('s' << 16) | ('l' << 8) | (x))
97 #define	KSSL_ADD_ENTRY		KSSL_IOC(1)
98 #define	KSSL_DELETE_ENTRY	KSSL_IOC(2)
99 
100 #ifdef	_KERNEL
101 
102 extern int kssl_add_entry(kssl_params_t *);
103 extern int kssl_delete_entry(struct sockaddr_in *);
104 
105 #endif	/* _KERNEL */
106 
107 #ifdef	__cplusplus
108 }
109 #endif
110 
111 #endif /* _INET_KSSL_KSSL_H */
112