#207 Problem with cffi and cl+sll

Stable_release
closed
nobody
None
1
2012-12-02
2012-09-22
No

I'm trying to use cl+ssl with ECL and I've found that this piece of code fails:

(ql:quickload "usocket")
(ql:quickload "cl+ssl")

(defun test-ssl-sockets ()
  (let (stream-usocket ssl-stream)
    (format *debug-io* "connect: trying to connect to www.google.com...~%")
    (setf stream-usocket (usocket:socket-connect
                          "www.google.com"
                          443
                          :element-type '(unsigned-byte 8)))
    (format *debug-io* "connect: socket-stream is ~a.~%" (usocket:socket-stream stream-usocket))
    (setf ssl-stream (cl+ssl:make-ssl-client-stream
                      (usocket:socket-stream stream-usocket)
                      :external-format :utf-8))
    (format *debug-io* "connect: ssl-stream is ~a.~%" ssl-stream)))

(test-ssl-sockets)

It fails on cl+ssl:make-ssl-client-stream. I've traced the problem to a function call to ssl-ctx-new (in cl+ssl/ffi.lisp function initialize). That function seems to be generated using CFFI. The error can be this:

An error occurred during initialization:
#\U5CDBEF is not of type (INTEGER 0 2305843009213693951)..

Or a segmentation fault like this:

An error occurred during initialization:
#\

Condition of type: SEGMENTATION-VIOLATION
Detected access to an invalid or protected memory address.

Has anybody had any success using cl+ssl on ECL?

Discussion

  • cl-ssl is broken. It does not provide a method for cl+ssl:stream-fd that works with ECL.

    cl+ssl.../streams.lisp:

    (defgeneric stream-fd (stream))
    ;; This useless method returns a very stupid value
    (defmethod stream-fd (stream) stream)

     


Anonymous


Cancel   Add attachments