orthecreedence / cl-async

Asynchronous IO library for Common Lisp.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSL init

mmontone opened this issue · comments

I have a problem loading cl-async-ssl:

The alien function "SSL_library_init" is undefined.
   [Condition of type SB-KERNEL::UNDEFINED-ALIEN-FUNCTION-ERROR]

I guess that's because I have libssl-1.0.0 installed, but SSL_library_init does not have that function:

https://www.openssl.org/docs/man1.1.0/ssl/OPENSSL_init_ssl.html

Am I correct?

Strange thing is cl-async-ssl seems to support libssl-1.0.0 in linux, which is what I'm using:

(cffi:define-foreign-library libssl
    (:windows "libssl32.dll")
    (:darwin "libssl.dylib")
    (:openbsd (:or "libssl.so.18.0" "libssl.so.17.1"
                   "libssl.so.16.0" "libssl.so.15.1"))
    (:solaris (:or "/lib/64/libssl.so"
                   "libssl.so.0.9.8" "libssl.so" "libssl.so.4"))
    (:unix (:or "libssl.so.1.0.0" "libssl.so.0.9.8" "libssl.so" "libssl.so.4"))
    (:cygwin "cygssl-1.0.0.dll")
    (t (:default "libssl3")))

To "fix" the load I changed:

(defun ensure-init (&key from-load)
    (unless *ssl-init*
      (cffi:foreign-funcall ("SSL_library_init") :void)
      (cffi:foreign-funcall ("SSL_load_error_strings") :void)
      (cffi:foreign-funcall ("ERR_load_BIO_strings") :void)
      (unless from-load
        (setf *ssl-init* t))))

to:

(defun ensure-init (&key from-load)
    (unless *ssl-init*
      (cffi:foreign-funcall ("OPENSSL_init_ssl") :void)
      ;(cffi:foreign-funcall ("SSL_load_error_strings") :void)
      ;(cffi:foreign-funcall ("ERR_load_BIO_strings") :void)
      (unless from-load
        (setf *ssl-init* t)))))

(it had problems loading SSL_load_error_strings too)

But I havent' tested if this runs correctly yet. In any case, my "fix" is not good.

I am running into the same issue on a Debian stretch system. Your diagnostic seems better than mine. :)

Could you make any progress on this since you posted the issue?

@orthecreedence @mmontone Juste a gentle ping on this. :-)

Hi, sorry for the lag, I've merged #155 so this should be ready to test now. Cl-async makes the FFI calls directly so you shouldn't need to load any other deps (just do a pull on cl-async#master) and hopefully this will be fixed. Thanks, @michipili for your work on this.