The C objects SSL and SSL_CTX are represented in LispWorks by foreign pointers with type
, which correspond to the C types SSL* and SSL_CTX*. These foreign types should be used for any foreign function that takes or returns these C types, and must be used when passing a foreign pointer as the value of the
Making SSL objects is a way of getting access to them to perform configuration, but, especially in the case of the SSL_CTX, it is a useful way to avoid repeated calls to the configuration routines which may be time consuming. For example, if we have defined a function
, and we want to read once every 60 seconds from some URL, we can write:
(str (comm:open-tcp-stream some-url 443 :ssl-ctx t
This will cause
to be called each time. If it is expensive, we can call it only once by changing the code to:
(let ((ctx (comm:make-ssl-ctx :ssl-side :client)))
(str (comm:open-tcp-stream some-url 443 :ssl-ctx ctx))
The SSL objects could be made either by
or by user code that calls the C functions SSL_CTX_new and SSL_new.
frees the SSL_CTX object. To free an SSL object you would call
. See the entries in the
LispWorks Reference Manual
for full descriptions of these functions.