1898Skais /* 2898Skais * CDDL HEADER START 3898Skais * 4898Skais * The contents of this file are subject to the terms of the 55850Svk199839 * Common Development and Distribution License (the "License"). 65850Svk199839 * You may not use this file except in compliance with the License. 7898Skais * 8898Skais * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9898Skais * or http://www.opensolaris.org/os/licensing. 10898Skais * See the License for the specific language governing permissions 11898Skais * and limitations under the License. 12898Skais * 13898Skais * When distributing Covered Code, include this CDDL HEADER in each 14898Skais * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15898Skais * If applicable, add the following below this CDDL HEADER, with the 16898Skais * fields enclosed by brackets "[]" replaced with your own identifying 17898Skais * information: Portions Copyright [yyyy] [name of copyright owner] 18898Skais * 19898Skais * CDDL HEADER END 20898Skais */ 21898Skais /* 22*12644SAnders.Persson@Sun.COM * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23898Skais */ 24898Skais 25898Skais #ifndef _INET_KSSL_KSSLAPI_H 26898Skais #define _INET_KSSL_KSSLAPI_H 27898Skais 28898Skais /* 29898Skais * The kernel SSL proxy interface 30898Skais */ 31898Skais 32898Skais 33898Skais #ifdef __cplusplus 34898Skais extern "C" { 35898Skais #endif 36898Skais 37898Skais #include <sys/socket.h> 38898Skais #include <netinet/in.h> 39898Skais 40898Skais /* return status for the kssl API functions */ 41898Skais 42898Skais typedef enum { 43898Skais KSSL_STS_OK, /* No further processing required */ 44898Skais KSSL_STS_ERR /* bogus argument ... */ 45898Skais } kssl_status_t; 46898Skais 47898Skais /* Endpoint type */ 48898Skais typedef enum { 49898Skais KSSL_NO_PROXY = 0, /* Not configured for use with KSSL */ 50898Skais KSSL_IS_PROXY, /* Acts as a proxy for someone else */ 51898Skais KSSL_HAS_PROXY /* A proxy is handling its work */ 52898Skais } kssl_endpt_type_t; 53898Skais 54898Skais /* Return codes/commands from kssl_handle_record */ 55898Skais typedef enum { 56898Skais KSSL_CMD_NOT_SUPPORTED, /* Not supported */ 57898Skais KSSL_CMD_SEND, /* send this packet out on the wire */ 58898Skais KSSL_CMD_DELIVER_PROXY, /* deliver this packet to proxy listener */ 59898Skais KSSL_CMD_DELIVER_SSL, /* Deliver to the SSL listener */ 60898Skais KSSL_CMD_NONE, /* consider it consumed. (ACK it, ... */ 61898Skais KSSL_CMD_QUEUED /* Queued, a call back will finish it */ 62898Skais } kssl_cmd_t; 63898Skais 64898Skais /* Un opaque context of an SSL connection */ 65898Skais typedef void *kssl_ctx_t; 66898Skais 67898Skais /* Un opaque handle for an SSL map entry */ 68898Skais typedef void *kssl_ent_t; 69898Skais 70898Skais #define SSL3_HDR_LEN 5 71898Skais #define SSL3_WROFFSET 7 /* 5 hdr + 2 byte-alignment */ 72898Skais #define SSL3_MAX_TAIL_LEN 36 /* 16 AES blocks + 20 SHA1 digest */ 73898Skais #define SSL3_MAX_RECORD_LEN 16384 - 1 - SSL3_HDR_LEN - SSL3_MAX_TAIL_LEN 74898Skais 75898Skais 76*12644SAnders.Persson@Sun.COM kssl_endpt_type_t kssl_check_proxy(struct sockaddr *, socklen_t, void *, 77*12644SAnders.Persson@Sun.COM kssl_ent_t *); 78898Skais 79*12644SAnders.Persson@Sun.COM kssl_status_t kssl_init_context(kssl_ent_t, struct sockaddr *, int, 80*12644SAnders.Persson@Sun.COM kssl_ctx_t *); 81*12644SAnders.Persson@Sun.COM void kssl_set_mss(kssl_ctx_t, uint32_t); 82898Skais 83898Skais void kssl_hold_ent(kssl_ent_t); 84898Skais void kssl_release_ent(kssl_ent_t, void *, kssl_endpt_type_t); 85898Skais void *kssl_find_fallback(kssl_ent_t); 86898Skais 87898Skais void kssl_release_ctx(kssl_ctx_t); 88*12644SAnders.Persson@Sun.COM void kssl_async_done(kssl_ctx_t); 89898Skais 90898Skais typedef void (*kssl_callback_t)(void *arg, mblk_t *mp, kssl_cmd_t cmd); 91898Skais 92898Skais kssl_cmd_t kssl_input(kssl_ctx_t, mblk_t *, mblk_t **, boolean_t *, 93898Skais kssl_callback_t cbfn, void *arg); 94898Skais 955850Svk199839 kssl_cmd_t kssl_handle_mblk(kssl_ctx_t, mblk_t **, mblk_t **); 96898Skais 97898Skais mblk_t *kssl_build_record(kssl_ctx_t, mblk_t *); 98898Skais 99898Skais 100898Skais #ifdef __cplusplus 101898Skais } 102898Skais #endif 103898Skais 104898Skais #endif /* _INET_KSSL_KSSLAPI_H */ 105