orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
273 stars 40 forks source link

[uv] ssl support #101

Closed orthecreedence closed 9 years ago

orthecreedence commented 9 years ago

libuv doesn't provide SSL like libevent, so we need to build SSL client/server operations over the existing tcp-server/tcp-connect functions. This will most likely happen by hijacking the read/write/connect callbacks and injecting the SSL encryption/decryption stuff into them.

From what I've read, doing this async requires two in-memory BIOs that talk to each other.

Any comments or code from anyone is appreciated. Whenever touching crypto stuff it's best to get as many eyes as possible reviewing.

Here's the list of links I've found that may help (mostly in C, obviously):

ivan4th commented 9 years ago

Don't know whether this may help or not, but here are some links to teepeedee2 async SSL code: https://github.com/vii/teepeedee2/blob/master/src/io/ssl.lisp https://github.com/vii/teepeedee2/blob/master/src/io/openssl.lisp

May be it provide some ideas (although it has incompatible LLGPL license)

EDIT: understood the problem a bit more, this approach would need direct access to fd which isn't the most correct approach. It became a possibility in recent libuv though: https://github.com/joyent/libuv/commit/4ca9a363897cfa60f4e2229e4f15ac5abd7fd103 http://docs.libuv.org/en/latest/handle.html?highlight=uv_fileno#c.uv_fileno ... but still may not actually work. Dunno whether its worth trying, but if it works, it may serve as a temporary workaround until "two BIOs" approach is implemented.

orthecreedence commented 9 years ago

Thanks, this is a great place for me to start even if the methods used are different. I think between the C tutorials floating around and teepeedee2 I should be able to get SSL working.

orthecreedence commented 9 years ago

completed in 6b82808. i'm sure bugs will crop up, but i'll open issues one at a time.