io.sockets.secure: Another fix for cross-platform openssl.

db4
Doug Coleman 2014-07-07 18:45:22 -07:00
parent 075a86f5d9
commit 59c5373263
4 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,8 @@ USING: accessors alien alien.c-types alien.data alien.strings
assocs byte-arrays classes.struct combinators destructors fry io
io.backend io.buffers io.encodings.8-bit.latin1
io.encodings.utf8 io.files io.pathnames io.ports io.sockets
io.sockets.secure io.sockets.secure.unix io.timeouts kernel libc
io.sockets.secure io.timeouts kernel libc
locals math math.order math.parser namespaces openssl
openssl.libcrypto openssl.libssl random sequences splitting
unicode.case ;
@ -175,6 +176,12 @@ SYMBOL: default-secure-context
swap >>file
] with-destructors ;
: <ssl-socket> ( winsock -- ssl )
[
socket-handle BIO_NOCLOSE BIO_new_socket dup ssl-error
] keep <ssl-handle>
[ handle>> swap dup SSL_set_bio ] keep ;
! Error handling
: syscall-error ( r -- event )
ERR_get_error [

View File

@ -104,6 +104,8 @@ M: upgrade-buffers-full summary
HOOK: non-ssl-socket? os ( obj -- ? )
HOOK: socket-handle os ( obj -- ? )
HOOK: send-secure-handshake secure-socket-backend ( -- )
HOOK: accept-secure-handshake secure-socket-backend ( -- )

View File

@ -16,10 +16,7 @@ M: openssl ssl-certificate-verification-supported? t ;
M: ssl-handle handle-fd file>> handle-fd ;
! Client sockets
: <ssl-socket> ( fd -- ssl )
[ fd>> BIO_NOCLOSE BIO_new_socket dup ssl-error ] keep <ssl-handle>
[ handle>> swap dup SSL_set_bio ] keep ;
M: unix socket-handle fd>> ;
M: secure ((client)) ( addrspec -- handle )
addrspec>> ((client)) <ssl-socket> ;

View File

@ -6,6 +6,8 @@ IN: io.sockets.secure.windows
M: openssl ssl-supported? t ;
M: openssl ssl-certificate-verification-supported? f ;
M: windows socket-handle handle>> alien-address ;
: <ssl-socket> ( winsock -- ssl )
[
handle>> alien-address BIO_NOCLOSE BIO_new_socket dup ssl-error