From dlichteblau at common-lisp.net Sat Jul 7 15:25:09 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 7 Jul 2007 11:25:09 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070707152509.87CCE6B577@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv3482 Modified Files: LICENSE cl+ssl.asd index.html streams.lisp Added Files: ffi-buffer-all.lisp ffi-buffer-clisp.lisp ffi-buffer.lisp Log Message: clisp patch by Pixel // pinterface --- /project/cl-plus-ssl/cvsroot/cl+ssl/LICENSE 2007/01/16 19:49:03 1.3 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/LICENSE 2007/07/07 15:25:09 1.4 @@ -1,6 +1,7 @@ Copyright (C) 2001, 2003 Eric Marsden Copyright (C) ???? Jochen Schmidt Copyright (C) 2005 David Lichteblau +Copyright (C) 2007 Pixel // pinterface * License first changed by Eric Marsden, Jochen Schmidt, and David Lichteblau from plain LGPL to Lisp-LGPL in December 2005. --- /project/cl-plus-ssl/cvsroot/cl+ssl/cl+ssl.asd 2006/11/18 09:52:21 1.4 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/cl+ssl.asd 2007/07/07 15:25:09 1.5 @@ -2,6 +2,7 @@ ;;; ;;; Copyright (C) 2001, 2003 Eric Marsden ;;; Copyright (C) 2005 David Lichteblau +;;; Copyright (C) 2007 Pixel // pinterface ;;; "the conditions and ENSURE-SSL-FUNCALL are by Jochen Schmidt." ;;; ;;; See LICENSE for details. @@ -19,5 +20,8 @@ (:file "reload") (:file "conditions") (:file "ffi") + (:file "ffi-buffer-all") + #-clisp (:file "ffi-buffer") + #+clisp (:file "ffi-buffer-clisp") (:file "streams") (:file "bio"))) --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/01/16 19:49:03 1.8 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 15:25:09 1.9 @@ -17,6 +17,12 @@

News

+ 2007-07-07: Improved clisp support, thanks + to Pixel + // pinterface. +

+

2007-01-16: CL+SSL is now available under an MIT-style license.

--- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2006/11/18 09:52:21 1.5 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 15:25:09 1.6 @@ -1,5 +1,6 @@ ;;; Copyright (C) 2001, 2003 Eric Marsden ;;; Copyright (C) 2005 David Lichteblau +;;; Copyright (C) 2007 Pixel // pinterface ;;; "the conditions and ENSURE-SSL-FUNCALL are by Jochen Schmidt." ;;; ;;; See LICENSE for details. @@ -9,8 +10,6 @@ (in-package :cl+ssl) -(defconstant +initial-buffer-size+ 2048) - (defclass ssl-stream (fundamental-binary-input-stream fundamental-binary-output-stream @@ -22,13 +21,13 @@ :initform nil :accessor ssl-stream-handle) (output-buffer - :initform (cffi-sys::make-shareable-byte-vector +initial-buffer-size+) + :initform (make-buffer +initial-buffer-size+) :accessor ssl-stream-output-buffer) (output-pointer :initform 0 :accessor ssl-stream-output-pointer) (input-buffer - :initform (cffi-sys::make-shareable-byte-vector +initial-buffer-size+) + :initform (make-buffer +initial-buffer-size+) :accessor ssl-stream-input-buffer) (peeked-byte :initform nil @@ -70,7 +69,7 @@ (or (ssl-stream-peeked-byte stream) (let ((buf (ssl-stream-input-buffer stream))) (handler-case - (cffi-sys::with-pointer-to-vector-data (ptr buf) + (with-pointer-to-vector-data (ptr buf) (ensure-ssl-funcall (ssl-stream-socket stream) (ssl-stream-handle stream) #'ssl-read @@ -78,7 +77,7 @@ (ssl-stream-handle stream) ptr 1) - (elt buf 0)) + (buffer-elt buf 0)) (ssl-error-zero-return () ;SSL_read returns 0 on end-of-file :eof))))) @@ -90,11 +89,11 @@ (incf start)) (let ((buf (ssl-stream-input-buffer stream))) (loop - for length = (min (- end start) (length buf)) + for length = (min (- end start) (buffer-length buf)) while (plusp length) do (handler-case - (cffi-sys::with-pointer-to-vector-data (ptr buf) + (with-pointer-to-vector-data (ptr buf) (ensure-ssl-funcall (ssl-stream-socket stream) (ssl-stream-handle stream) #'ssl-read @@ -102,7 +101,7 @@ (ssl-stream-handle stream) ptr length) - (replace thing buf :start1 start :end1 (+ start length)) + (v/b-replace thing buf :start1 start :end1 (+ start length)) (incf start length)) (ssl-error-zero-return () ;SSL_read returns 0 on end-of-file (return)))) @@ -110,28 +109,28 @@ (defmethod stream-write-byte ((stream ssl-stream) b) (let ((buf (ssl-stream-output-buffer stream))) - (when (eql (length buf) (ssl-stream-output-pointer stream)) + (when (eql (buffer-length buf) (ssl-stream-output-pointer stream)) (force-output stream)) - (setf (elt buf (ssl-stream-output-pointer stream)) b) + (setf (buffer-elt buf (ssl-stream-output-pointer stream)) b) (incf (ssl-stream-output-pointer stream))) b) (defmethod stream-write-sequence ((stream ssl-stream) thing start end &key) (check-type thing (simple-array (unsigned-byte 8) (*))) (let ((buf (ssl-stream-output-buffer stream))) - (when (> (+ (- end start) (ssl-stream-output-pointer stream)) (length buf)) + (when (> (+ (- end start) (ssl-stream-output-pointer stream)) (buffer-length buf)) ;; not enough space left? flush buffer. (force-output stream) ;; still doesn't fit? - (while (> (- end start) (length buf)) - (replace buf thing :start2 start) - (incf start (length buf)) - (setf (ssl-stream-output-pointer stream) (length buf)) + (while (> (- end start) (buffer-length buf)) + (b/v-replace buf thing :start2 start) + (incf start (buffer-length buf)) + (setf (ssl-stream-output-pointer stream) (buffer-length buf)) (force-output stream))) - (replace buf thing - :start1 (ssl-stream-output-pointer stream) - :start2 start - :end2 end) + (b/v-replace buf thing + :start1 (ssl-stream-output-pointer stream) + :start2 start + :end2 end) (incf (ssl-stream-output-pointer stream) (- end start))) thing) @@ -144,7 +143,7 @@ (handle (ssl-stream-handle stream)) (socket (ssl-stream-socket stream))) (when (plusp fill-ptr) - (cffi-sys::with-pointer-to-vector-data (ptr buf) + (with-pointer-to-vector-data (ptr buf) (ensure-ssl-funcall socket handle #'ssl-write 0.5 handle ptr fill-ptr)) (setf (ssl-stream-output-pointer stream) 0)))) --- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-all.lisp 2007/07/07 15:25:09 NONE +++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-all.lisp 2007/07/07 15:25:09 1.1 (in-package :cl+ssl) (defconstant +initial-buffer-size+ 2048) (declaim (inline make-buffer buffer-length buffer-elt set-buffer-elt v/b-replace b/v-replace)) --- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-clisp.lisp 2007/07/07 15:25:09 NONE +++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-clisp.lisp 2007/07/07 15:25:09 1.1 (in-package :cl+ssl) (defun make-buffer (size) (cffi-sys:%foreign-alloc size)) (defun buffer-length (buf) (declare (ignore buf)) +initial-buffer-size+) (defun buffer-elt (buf index) (ffi:memory-as buf 'ffi:uint8 index)) (defun set-buffer-elt (buf index val) (setf (ffi:memory-as buf 'ffi:uint8 index) val)) (defsetf buffer-elt set-buffer-elt) (defun v/b-replace (vec buf &key (start1 0) end1 (start2 0) (end2 +initial-buffer-size+)) (replace vec (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end2 start2))) start2) :start1 start1 :end1 end1)) (defun b/v-replace (buf vec &key (start1 0) (end1 +initial-buffer-size+) (start2 0) end2) (setf (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end1 start1))) start1) (subseq vec start2 end2))) (defmacro with-pointer-to-vector-data ((ptr buf) &body body) `(let ((,ptr ,buf)) , at body)) --- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer.lisp 2007/07/07 15:25:09 NONE +++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer.lisp 2007/07/07 15:25:09 1.1 (in-package :cl+ssl) (defun make-buffer (size) (cffi-sys::make-shareable-byte-vector size)) (defun buffer-length (buf) (length buf)) (defun buffer-elt (buf index) (elt buf index)) (defun set-buffer-elt (buf index val) (setf (elt buf index) val)) (defsetf buffer-elt set-buffer-elt) (defun v/b-replace (vec buf &key (start1 0) end1 (start2 0) end2) (replace vec buf :start1 start1 :end1 end1 :start2 start2 :end2 end2)) (defun b/v-replace (buf vec &key (start1 0) end1 (start2 0) end2) (replace buf vec :start1 start1 :end1 end1 :start2 start2 :end2 end2)) (defmacro with-pointer-to-vector-data ((ptr buf) &body body) `(cffi-sys::with-pointer-to-vector-data (,ptr ,buf) , at body)) From dlichteblau at common-lisp.net Sat Jul 7 15:26:13 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 7 Jul 2007 11:26:13 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070707152613.6B7616B577@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv3573 Modified Files: index.html streams.lisp Log Message: client cert support by pixel --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 15:25:09 1.9 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 15:26:13 1.10 @@ -19,8 +19,8 @@

2007-07-07: Improved clisp support, thanks to Pixel - // pinterface. + href="http://web.kepibu.org/code/lisp/cl+ssl/">Pixel + // pinterface, as well as client certificate support.

2007-01-16: CL+SSL is now available under an MIT-style license. @@ -118,10 +118,13 @@

API functions

-

Function CL+SSL:MAKE-SSL-CLIENT-STREAM (stream &key external-format)
+
Function CL+SSL:MAKE-SSL-CLIENT-STREAM (stream &key external-format certificate key)
Return an SSL stream for the client socket stream. All reads and writes to this SSL stream will be pushed through the SSL connection can be closed using the standard close function. + certificate is the path to a file containing the PEM-encoded + certificate for your client. key is the path to the PEM-encoded + key for the client, which must not be associated with a passphrase.

If external-format is nil (the default), a plain --- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 15:25:09 1.6 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 15:26:13 1.7 @@ -151,14 +151,28 @@ ;;; interface functions ;;; (defun make-ssl-client-stream - (socket &key (method 'ssl-v23-method) external-format) - "Returns an SSL stream for the client socket descriptor SOCKET." + (socket &key certificate key (method 'ssl-v23-method) external-format) + "Returns an SSL stream for the client socket descriptor SOCKET. +CERTIFICATE is the path to a file containing the PEM-encoded certificate for + your client. KEY is the path to the PEM-encoded key for the client, which +must not be associated with a passphrase." (ensure-initialized method) (let ((stream (make-instance 'ssl-stream :socket socket)) (handle (ssl-new *ssl-global-context*))) (setf (ssl-stream-handle stream) handle) (ssl-set-bio handle (bio-new-lisp) (bio-new-lisp)) (ssl-set-connect-state handle) + (when key + (unless (eql 1 (ssl-use-rsa-privatekey-file handle + key + +ssl-filetype-pem+)) + (error 'ssl-error-initialize :reason "Can't load RSA private key ~A"))) + (when certificate + (unless (eql 1 (ssl-use-certificate-file handle + certificate + +ssl-filetype-pem+)) + (error 'ssl-error-initialize + :reason "Can't load certificate ~A" certificate))) (ensure-ssl-funcall socket handle #'ssl-connect 0.25 handle) (if external-format (flexi-streams:make-flexi-stream stream From dlichteblau at common-lisp.net Sat Jul 7 16:26:11 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 7 Jul 2007 12:26:11 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070707162611.EA1B11D0DB@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv15254 Modified Files: index.html package.lisp streams.lisp test.lisp Log Message: + Re-introduced support for direct access to file descriptors as + an optimization. New function stream-fd. --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 15:26:13 1.10 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 16:26:11 1.11 @@ -17,11 +17,20 @@

News

- 2007-07-07: Improved clisp support, thanks - to Pixel - // pinterface, as well as client certificate support. + 2007-07-07

+

2007-01-16: CL+SSL is now available under an MIT-style license.

@@ -118,8 +127,17 @@

API functions

-

Function CL+SSL:MAKE-SSL-CLIENT-STREAM (stream &key external-format certificate key)
- Return an SSL stream for the client socket stream. +
Function CL+SSL:STREAM-FD (stream) + Return stream's file descriptor as an integer, if + known. Otherwise return stream itself. Pass the + return value of this function to make-ssl-client-stream + or make-ssl-servre-stream, which are faster when + accessing file descriptors directly. +
+

+

+

Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key)
+ Return an SSL stream for the client socket fd-or-stream. All reads and writes to this SSL stream will be pushed through the SSL connection can be closed using the standard close function. certificate is the path to a file containing the PEM-encoded @@ -134,8 +152,8 @@ as its initial external format.

-

Function CL+SSL:MAKE-SSL-SERVER-STREAM (stream &key external-format certificate key)
- Return an SSL stream for the server socket stream. All +
Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key)
+ Return an SSL stream for the server socket fd-or-stream. All reads and writes to this server stream will be pushed through the OpenSSL library. The SSL connection can be closed using the standard close function. --- /project/cl-plus-ssl/cvsroot/cl+ssl/package.lisp 2005/11/16 17:07:53 1.2 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/package.lisp 2007/07/07 16:26:11 1.3 @@ -10,5 +10,6 @@ (:use :common-lisp :trivial-gray-streams) (:export #:ensure-initialized #:reload + #:stream-fd #:make-ssl-client-stream #:make-ssl-server-stream)) --- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 15:26:13 1.7 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 16:26:11 1.8 @@ -53,7 +53,8 @@ (force-output stream) (ssl-free (ssl-stream-handle stream)) (setf (ssl-stream-handle stream) nil) - (close (ssl-stream-socket stream))) + (when (streamp (ssl-stream-socket stream)) + (close (ssl-stream-socket stream)))) (defmethod open-stream-p ((stream ssl-stream)) (and (ssl-stream-handle stream) t)) @@ -160,7 +161,9 @@ (let ((stream (make-instance 'ssl-stream :socket socket)) (handle (ssl-new *ssl-global-context*))) (setf (ssl-stream-handle stream) handle) - (ssl-set-bio handle (bio-new-lisp) (bio-new-lisp)) + (etypecase socket + (integer (ssl-set-fd handle socket)) + (stream (ssl-set-bio handle (bio-new-lisp) (bio-new-lisp)))) (ssl-set-connect-state handle) (when key (unless (eql 1 (ssl-use-rsa-privatekey-file handle @@ -190,10 +193,14 @@ :socket socket :certificate certificate :key key)) - (handle (ssl-new *ssl-global-context*)) - (bio (bio-new-lisp))) + (handle (ssl-new *ssl-global-context*))) (setf (ssl-stream-handle stream) handle) - (ssl-set-bio handle bio bio) + (etypecase socket + (integer + (ssl-set-fd handle socket)) + (stream + (let ((bio (bio-new-lisp))) + (ssl-set-bio handle bio bio)))) (ssl-set-accept-state handle) (when (zerop (ssl-set-cipher-list handle "ALL")) (error 'ssl-error-initialize :reason "Can't set SSL cipher list")) @@ -213,3 +220,23 @@ (flexi-streams:make-flexi-stream stream :external-format external-format) stream))) + +(defgeneric stream-fd (stream)) +(defmethod stream-fd (stream) stream) + +#+sbcl +(defmethod stream-fd ((stream sb-sys:fd-stream)) + (sb-sys:fd-stream-fd stream)) + +#+cmu +(defmethod stream-fd ((stream system:fd-stream)) + (system:fd-stream-fd stream)) + +#+openmcl +(defmethod stream-fd ((stream ccl::basic-stream)) + (ccl::ioblock-device (ccl::stream-ioblock stream t))) + +#+clisp +(defmethod stream-fd ((stream stream)) + ;; sockets appear to be direct instances of STREAM + (ignore-errors (socket:stream-handles stream))) --- /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2005/11/25 20:14:04 1.2 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/test.lisp 2007/07/07 16:26:11 1.3 @@ -45,9 +45,13 @@ ;; open an HTTPS connection to a secure web server and make a ;; HEAD request (defun test-https-client (host &optional (port 443)) - (let* ((fd (trivial-sockets:open-stream host port - :element-type '(unsigned-byte 8))) - (https (cl+ssl:make-ssl-client-stream fd :external-format :iso-8859-1))) + (let* ((socket (trivial-sockets:open-stream + host + port + :element-type '(unsigned-byte 8))) + (https (cl+ssl:make-ssl-client-stream + (cl+ssl:stream-fd socket) + :external-format :iso-8859-1))) (unwind-protect (progn (format https "HEAD / HTTP/1.0~%Host: ~a~%~%" host) @@ -55,6 +59,7 @@ (loop :for line = (read-line-crlf https nil) :while line :do (format t "HTTPS> ~a~%" line))) + (close socket) (close https)))) ;; start a simple HTTPS server. See the mod_ssl documentation at @@ -72,13 +77,14 @@ (format t "~&SSL server listening on port ~d~%" port) (trivial-sockets:with-server (server (:port port)) (loop - (let ((client (cl+ssl:make-ssl-server-stream - (trivial-sockets:accept-connection + (let* ((socket (trivial-sockets:accept-connection server - :element-type '(unsigned-byte 8)) - :external-format :iso-8859-1 - :certificate cert - :key key))) + :element-type '(unsigned-byte 8))) + (client (cl+ssl:make-ssl-server-stream + (cl+ssl:stream-fd socket) + :external-format :iso-8859-1 + :certificate cert + :key key))) (unwind-protect (progn (loop :for line = (read-line-crlf client nil) @@ -93,4 +99,5 @@ (format client "CL+SSL running in ~A ~A~%" (lisp-implementation-type) (lisp-implementation-version))) + (close socket) (close client)))))) From dlichteblau at common-lisp.net Sat Jul 7 16:47:57 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 7 Jul 2007 12:47:57 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070707164757.ACD89431B7@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv18763 Modified Files: index.html streams.lisp Log Message: New keyword argument close-callback. --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 16:26:11 1.11 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 16:47:57 1.12 @@ -28,7 +28,8 @@
  • Re-introduced support for direct access to file descriptors as - an optimization. New function stream-fd. + an optimization. New function stream-fd. New keyword + argument close-callback.
  • @@ -136,10 +137,15 @@

    -

    Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key)
    +
    Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key close-callback)
    Return an SSL stream for the client socket fd-or-stream. All reads and writes to this SSL stream will be pushed through the - SSL connection can be closed using the standard close function. + SSL connection. If fd-or-stream is a lisp stream, it can + the SSL stream will close it automatically. File descriptors are + not closed automatically. However, if close-callback is + non-nil, it will be called with zero arguments when the SSL stream + is closed. + certificate is the path to a file containing the PEM-encoded certificate for your client. key is the path to the PEM-encoded key for the client, which must not be associated with a passphrase. @@ -152,11 +158,15 @@ as its initial external format.

    -

    Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key)
    +
    Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key close-callback)
    Return an SSL stream for the server socket fd-or-stream. All reads and writes to this server stream will be pushed through the - OpenSSL library. The SSL connection can be closed using the - standard close function. + OpenSSL library. If fd-or-stream is a lisp stream, it can + the SSL stream will close it automatically. File descriptors are + not closed automatically. However, if close-callback is + non-nil, it will be called with zero arguments when the SSL stream + is closed. + certificate is the path to a file containing the PEM-encoded certificate for your server. key is the path to the PEM-encoded key for the server, which must not be associated with a @@ -188,11 +198,7 @@ OpenMCLWorking SBCLWorking CMU CLWorking - - CLISP - Working - Extremely slow? - + CLISPWorking LispWorksWorking Allegro @@ -208,7 +214,6 @@

    TODO

    @@ -232,7 +237,7 @@

    - README + README

    @@ -244,7 +249,7 @@

    - README + README

    --- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 16:26:11 1.8 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp 2007/07/07 16:47:57 1.9 @@ -17,6 +17,9 @@ ((ssl-stream-socket :initarg :socket :accessor ssl-stream-socket) + (close-callback + :initarg :close-callback + :accessor ssl-close-callback) (handle :initform nil :accessor ssl-stream-handle) @@ -54,7 +57,9 @@ (ssl-free (ssl-stream-handle stream)) (setf (ssl-stream-handle stream) nil) (when (streamp (ssl-stream-socket stream)) - (close (ssl-stream-socket stream)))) + (close (ssl-stream-socket stream))) + (when (functionp (ssl-close-callback stream)) + (funcall (ssl-close-callback stream)))) (defmethod open-stream-p ((stream ssl-stream)) (and (ssl-stream-handle stream) t)) @@ -152,13 +157,16 @@ ;;; interface functions ;;; (defun make-ssl-client-stream - (socket &key certificate key (method 'ssl-v23-method) external-format) + (socket &key certificate key (method 'ssl-v23-method) external-format + close-callback) "Returns an SSL stream for the client socket descriptor SOCKET. CERTIFICATE is the path to a file containing the PEM-encoded certificate for your client. KEY is the path to the PEM-encoded key for the client, which must not be associated with a passphrase." (ensure-initialized method) - (let ((stream (make-instance 'ssl-stream :socket socket)) + (let ((stream (make-instance 'ssl-stream + :socket socket + :close-callback close-callback)) (handle (ssl-new *ssl-global-context*))) (setf (ssl-stream-handle stream) handle) (etypecase socket @@ -183,7 +191,8 @@ stream))) (defun make-ssl-server-stream - (socket &key certificate key (method 'ssl-v23-method) external-format) + (socket &key certificate key (method 'ssl-v23-method) external-format + close-callback) "Returns an SSL stream for the server socket descriptor SOCKET. CERTIFICATE is the path to a file containing the PEM-encoded certificate for your server. KEY is the path to the PEM-encoded key for the server, which @@ -191,6 +200,7 @@ (ensure-initialized method) (let ((stream (make-instance 'ssl-server-stream :socket socket + :close-callback close-callback :certificate certificate :key key)) (handle (ssl-new *ssl-global-context*))) From dlichteblau at common-lisp.net Sat Jul 7 17:42:22 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 7 Jul 2007 13:42:22 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070707174222.B50CD5F042@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv30757 Modified Files: index.html Log Message: fixed the description of stream-fd --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 16:47:57 1.12 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 17:42:22 1.13 @@ -128,19 +128,24 @@

    API functions

    -

    Function CL+SSL:STREAM-FD (stream) - Return stream's file descriptor as an integer, if - known. Otherwise return stream itself. Pass the - return value of this function to make-ssl-client-stream - or make-ssl-servre-stream, which are faster when - accessing file descriptors directly. -
    +
    Function CL+SSL:STREAM-FD (stream)
    + Return stream's file descriptor as an integer, if + known. Otherwise return stream itself. +

    +

    + Pass the + return value of this function to make-ssl-client-stream + or make-ssl-servre-stream, which are faster when + accessing file descriptors directly.

    Function CL+SSL:MAKE-SSL-CLIENT-STREAM (fd-or-stream &key external-format certificate key close-callback)
    Return an SSL stream for the client socket fd-or-stream. All reads and writes to this SSL stream will be pushed through the - SSL connection. If fd-or-stream is a lisp stream, it can + SSL connection. +

    +

    + If fd-or-stream is a lisp stream, it can the SSL stream will close it automatically. File descriptors are not closed automatically. However, if close-callback is non-nil, it will be called with zero arguments when the SSL stream @@ -161,7 +166,10 @@

    Function CL+SSL:MAKE-SSL-SERVER-STREAM (fd-or-stream &key external-format certificate key close-callback)
    Return an SSL stream for the server socket fd-or-stream. All reads and writes to this server stream will be pushed through the - OpenSSL library. If fd-or-stream is a lisp stream, it can + OpenSSL library. +

    +

    + If fd-or-stream is a lisp stream, it can the SSL stream will close it automatically. File descriptors are not closed automatically. However, if close-callback is non-nil, it will be called with zero arguments when the SSL stream From dlichteblau at common-lisp.net Sat Jul 14 11:49:29 2007 From: dlichteblau at common-lisp.net (dlichteblau) Date: Sat, 14 Jul 2007 07:49:29 -0400 (EDT) Subject: [cl-plus-ssl-cvs] CVS cl+ssl Message-ID: <20070714114929.E8E80450B3@common-lisp.net> Update of /project/cl-plus-ssl/cvsroot/cl+ssl In directory clnet:/tmp/cvs-serv17119 Modified Files: ffi.lisp index.html reload.lisp Log Message: + Fixed windows support, thanks to Matthew Kennedy and Vodonosov Anton. --- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi.lisp 2006/11/18 09:52:21 1.4 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi.lisp 2007/07/14 11:49:29 1.5 @@ -243,5 +243,6 @@ (defun reload () (cffi:load-foreign-library 'libssl) + (cffi:load-foreign-library 'libeay32) (setf *ssl-global-context* nil) (setf *ssl-global-method* nil)) --- /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/07 17:42:22 1.13 +++ /project/cl-plus-ssl/cvsroot/cl+ssl/index.html 2007/07/14 11:49:29 1.14 @@ -17,6 +17,14 @@

    News

    + 2007-xx-yy +

    + +

    2007-07-07