.\" Copyright (c) 2001-2002 Packet Design, LLC. .\" All rights reserved. .\" .\" Subject to the following obligations and disclaimer of warranty, .\" use and redistribution of this software, in source or object code .\" forms, with or without modifications are expressly permitted by .\" Packet Design; provided, however, that: .\" .\" (i) Any and all reproductions of the source or object code .\" must include the copyright notice above and the following .\" disclaimer of warranties; and .\" (ii) No rights are granted, in any manner or form, to use .\" Packet Design trademarks, including the mark "PACKET DESIGN" .\" on advertising, endorsements, or otherwise except as such .\" appears in the above copyright notice or in the software. .\" .\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING .\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, .\" OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE, .\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS .\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, .\" RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE .\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE .\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL .\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF .\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" Author: Archie Cobbs .\" .\" $Id: ssl_fp.3,v 1.1 2012/02/21 23:25:53 misho Exp $ .\" .Dd April 22, 2002 .Dt SSL_FP 3 .Os .Sh NAME .Nm ssl_fdopen , .Nm ssl_log .Nd SSL utility routines .Sh LIBRARY PDEL Library (libpdel, \-lpdel) .Sh SYNOPSIS .In sys/types.h .In openssl/ssl.h .In pdel/io/ssl_fp.h .Ft "FILE *" .Fn ssl_fdopen "SSL_CTX *ssl_ctx" "int fd" "int server" "const char *mtype" "ssl_logger_t *logger" "void *logarg" "u_int timeout" .Ft void .Fn ssl_log "ssl_logger_t *logger" "void *arg" .Sh DESCRIPTION .Fn ssl_fdopen converts an encrypted SSL file descriptor into an unencrypted stream. When the returned stream is closed via .Xr fclose 3 , so too is the underlying file descriptor. .Pp .Fa ssl_ctx is the SSL context. .Fa fd is the original file descriptor, over which the SSL protocol is spoken. .Fa server should be non-zero if the local side is the server. The stream's private state is allocated with .Xr typed_mem 3 type .Fa mtype . An idle timeout may be specified by setting .Fa timeout to the number of seconds. .Pp .Fa logger , if not .Dv NULL , is a pointer to a logging function having this type: .Pp .Bd -literal -compact -offset 3n typedef void ssl_logger_t(void *arg, int sev, const char *fmt, ...); .Ed .Pp The .Fa logarg is passed to .Fn logger as .Fa arg . .Fa sev is a .Xr syslog 3 severity level, and .Fa fmt is a .Xr printf 3 like format string with subsequent arguments. .Pp .Fn ssl_log is a routine for logging any SSL error. It takes a .Fa logger and .Fa arg as specified above. .Sh RETURN VALUES .Fn ssl_fdopen returns .Dv NULL if an error occurs, with .Va errno set appropriately. .Sh SEE ALSO .Xr libpdel 3 , .Xr syslog 3 , .Xr typed_mem 3 .Sh HISTORY The PDEL library was developed at Packet Design, LLC. .Dv "http://www.packetdesign.com/" .Sh AUTHORS .An Archie Cobbs Aq archie@freebsd.org