One-way SSL with CL + SSL

In Lispworks on XP, when I do this:

  CL-USER 489> (cl + ssl: make-ssl-client-stream (cl + ssl: stream-fd * standard-output *))

I get:

  Error: A failure in the SSL library occurred on handle #.  (Return code: 1) SSL error queue: error: 140C5042: SSL routines: SSL_UNDEFINED_FUNCTION: called a function you should not call

Am I doing something wrong?

+4
source share
2 answers

There are two possibilities.

Either you forgot to call some initialization function that you had to call before creating the stream, or there is an error in CL + SSL, perhaps such that only the surface is on Lispworks or Windows XP (maybe the last one).

Does the CL + SSL test suite run without problems?

Edit: just tested this on SBCL / Linux, same error. The problem should be with CL + SSL.

+1
source

The error message here is not helpful. I believe the real problem is that CL + SSL expects an octet stream, while the main standard input stream in Common Lisp is a character stream. Instead, try using an octet stream. This should work on SBCL on Linux:

(let ((stdin (sb-sys:make-fd-stream 0 :input t :buffering :full :element-type '(unsigned-byte 8))) (cl+ssl:make-ssl-client-stream (cl+ssl:stream-fd stdin))) 

It depends on the fact that Unix has standard input available as a file descriptor of 0. I am not sure how to perform such a trick on Windows.

For a real application, you probably really don't want to work with standard input, something like this will work using the usocket library:

 (let ((sock (usocket:socket-connect host port :element-type '(unsigned-byte 8)))) (cl+ssl:make-ssl-client-stream (usocket:socket-stream sock))) 
+1
source

All Articles