[cl-plus-ssl-devel] error in defcfun (and maybe close?)

Peter Wood pete_wood at runbox.com
Mon Jul 15 09:53:52 UTC 2013


Hi

Using cl+ssl-20130420-git (from last quicklisp update) on sbcl-1.1.9.

In ffi.lisp I think this is wrong:

(cffi:defcfun ("SSL_shutdown" ssh-shutdown)
                                            ^^^
    :void
     ^^^^
  (ssl ssl-pointer))

Should be:

(cffi:defcfun ("SSL_shutdown" ssl-shutdown)
    :int
  (ssl ssl-pointer))

Also: my knowledge of ssl is shallow so this might be wrong, but maybe in streams.lisp,  cl+ssl::close should call ssl-shutdown

For reference: https://www.openssl.org/docs/ssl/SSL_shutdown.html

"SSL_shutdown() tries to send the ``close notify'' shutdown alert to the peer. Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and a currently open session is considered closed and good and will be kept in the session cache for further reuse.

The shutdown procedure consists of 2 steps: the sending of the ``close notify'' shutdown alert and the reception of the peer's ``close notify'' shutdown alert. According to the TLS standard, ***it is acceptable for an application to only send its shutdown alert and then close the underlying connection without waiting for the peer's response (this way resources can be saved, as the process can already terminate or serve another connection)***. When the underlying connection shall be used for more communications, the complete shutdown procedure (bidirectional ``close notify'' alerts) must be performed, so that the peers stay synchronized."

Regards
Peter


More information about the cl-plus-ssl-devel mailing list