1c28749e9Skais /* 2c28749e9Skais * CDDL HEADER START 3c28749e9Skais * 4c28749e9Skais * The contents of this file are subject to the terms of the 5c892ebf1Skrishna * Common Development and Distribution License (the "License"). 6c892ebf1Skrishna * You may not use this file except in compliance with the License. 7c28749e9Skais * 8c28749e9Skais * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9c28749e9Skais * or http://www.opensolaris.org/os/licensing. 10c28749e9Skais * See the License for the specific language governing permissions 11c28749e9Skais * and limitations under the License. 12c28749e9Skais * 13c28749e9Skais * When distributing Covered Code, include this CDDL HEADER in each 14c28749e9Skais * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15c28749e9Skais * If applicable, add the following below this CDDL HEADER, with the 16c28749e9Skais * fields enclosed by brackets "[]" replaced with your own identifying 17c28749e9Skais * information: Portions Copyright [yyyy] [name of copyright owner] 18c28749e9Skais * 19c28749e9Skais * CDDL HEADER END 20c28749e9Skais */ 21c28749e9Skais /* 22*11d0a659SVladimir Kotal * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23c28749e9Skais */ 24c28749e9Skais 25c28749e9Skais #ifndef _INET_KSSL_KSSL_H 26c28749e9Skais #define _INET_KSSL_KSSL_H 27c28749e9Skais 28c28749e9Skais #ifdef __cplusplus 29c28749e9Skais extern "C" { 30c28749e9Skais #endif 31c28749e9Skais 32c28749e9Skais #include <sys/types.h> 33c28749e9Skais #include <netinet/in.h> 34c28749e9Skais #include <sys/crypto/common.h> 35c28749e9Skais 36c28749e9Skais /* These are re-definition from <crypto/ioctl.h> */ 37c28749e9Skais typedef struct kssl_object_attribute { 38c28749e9Skais uint64_t ka_type; /* attribute type */ 39c28749e9Skais uint32_t ka_value_offset; /* offset to attribute value */ 40c28749e9Skais uint32_t ka_value_len; /* length of attribute value */ 41c28749e9Skais } kssl_object_attribute_t; 42c28749e9Skais 43c28749e9Skais typedef struct kssl_key { 44c28749e9Skais crypto_key_format_t ks_format; /* format identifier */ 45c28749e9Skais uint32_t ks_count; /* number of attributes */ 46c28749e9Skais uint32_t ks_attrs_offset; /* offset to the attributes */ 47c28749e9Skais } kssl_key_t; 48c28749e9Skais 49c28749e9Skais typedef struct kssl_certs_s { 50c28749e9Skais uint32_t sc_count; /* number of certificates */ 51c28749e9Skais uint32_t sc_sizes_offset; /* offset to certificates sizes array */ 52c28749e9Skais uint32_t sc_certs_offset; /* offset to certificates array */ 53c28749e9Skais } kssl_certs_t; 54c28749e9Skais 55c892ebf1Skrishna #define MAX_PIN_LENGTH 1024 56c892ebf1Skrishna 57c892ebf1Skrishna typedef struct kssl_tokinfo_s { 58c892ebf1Skrishna uint8_t toklabel[CRYPTO_EXT_SIZE_LABEL]; 59c892ebf1Skrishna uint32_t pinlen; 60c892ebf1Skrishna uint32_t tokpin_offset; /* offset to the pin */ 61c892ebf1Skrishna uint32_t ck_rv; /* PKCS #11 specific error */ 62c892ebf1Skrishna } kssl_tokinfo_t; 63c28749e9Skais 64*11d0a659SVladimir Kotal /* Code point for Signalling Cipher Suite Value (SCSV) */ 65*11d0a659SVladimir Kotal #define SSL_SCSV 0x00ff 66*11d0a659SVladimir Kotal 67*11d0a659SVladimir Kotal /* Cipher suites */ 68c28749e9Skais #define SSL_RSA_WITH_NULL_SHA 0x0002 69c28749e9Skais #define SSL_RSA_WITH_RC4_128_MD5 0x0004 70c28749e9Skais #define SSL_RSA_WITH_RC4_128_SHA 0x0005 71c28749e9Skais #define SSL_RSA_WITH_DES_CBC_SHA 0x0009 72c28749e9Skais #define SSL_RSA_WITH_3DES_EDE_CBC_SHA 0x000a 732bd70d4bSkrishna #define TLS_RSA_WITH_AES_128_CBC_SHA 0x002f 742bd70d4bSkrishna #define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035 75*11d0a659SVladimir Kotal /* total number of cipher suites supported */ 762bd70d4bSkrishna #define CIPHER_SUITE_COUNT 7 77c28749e9Skais #define CIPHER_NOTSET 0xffff 78c28749e9Skais 79*11d0a659SVladimir Kotal /* TLS extension types */ 80*11d0a659SVladimir Kotal #define TLSEXT_RENEGOTIATION_INFO 0xff01 81*11d0a659SVladimir Kotal 82c28749e9Skais #define DEFAULT_SID_TIMEOUT 86400 /* 24 hours in seconds */ 83c28749e9Skais #define DEFAULT_SID_CACHE_NENTRIES 5000 84c28749e9Skais 85c28749e9Skais typedef struct kssl_params_s { 86c28749e9Skais uint64_t kssl_params_size; /* total params buf len */ 87c28749e9Skais /* address and port number */ 882ec7cc7fSKrishna Yenduri struct sockaddr_in6 kssl_addr; 89c28749e9Skais uint16_t kssl_proxy_port; 90c28749e9Skais 91c28749e9Skais uint32_t kssl_session_cache_timeout; /* In seconds */ 92c28749e9Skais uint32_t kssl_session_cache_size; 93c28749e9Skais 94c28749e9Skais /* 95c28749e9Skais * Contains ordered list of cipher suites. We do not include 96c28749e9Skais * the one suite with no encryption. Hence the -1. 97c28749e9Skais */ 98c28749e9Skais uint16_t kssl_suites[CIPHER_SUITE_COUNT - 1]; 99c28749e9Skais 100c892ebf1Skrishna uint8_t kssl_is_nxkey; 101c892ebf1Skrishna kssl_tokinfo_t kssl_token; 102c892ebf1Skrishna 103c28749e9Skais /* certificates */ 104c28749e9Skais kssl_certs_t kssl_certs; 105c28749e9Skais 106c28749e9Skais /* private key */ 107c28749e9Skais kssl_key_t kssl_privkey; 108c28749e9Skais } kssl_params_t; 109c28749e9Skais 110c28749e9Skais /* The ioctls to /dev/kssl */ 1115cd9bd63Skrishna #define KSSL_IOC(x) (('s' << 24) | ('s' << 16) | ('l' << 8) | (x)) 112c28749e9Skais #define KSSL_ADD_ENTRY KSSL_IOC(1) 113c28749e9Skais #define KSSL_DELETE_ENTRY KSSL_IOC(2) 114c28749e9Skais 115c28749e9Skais #ifdef _KERNEL 116c28749e9Skais 117c28749e9Skais extern int kssl_add_entry(kssl_params_t *); 1182ec7cc7fSKrishna Yenduri extern int kssl_delete_entry(struct sockaddr_in6 *); 119c28749e9Skais 120c28749e9Skais #endif /* _KERNEL */ 121c28749e9Skais 122c28749e9Skais #ifdef __cplusplus 123c28749e9Skais } 124c28749e9Skais #endif 125c28749e9Skais 126c28749e9Skais #endif /* _INET_KSSL_KSSL_H */ 127