aboutsummaryrefslogtreecommitdiff
path: root/jessl.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-01 11:21:05 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-01 11:21:05 -0400
commitc7a908cc5adede6ca34519059f2e324dc6737ff6 (patch)
tree98a32e703bac397e37c38d1fdbfa16123e2d46af /jessl.f90
parent690395a50cd55401a9cfee598638bef482d164bd (diff)
downloadLR-87-c7a908cc5adede6ca34519059f2e324dc6737ff6.tar.gz
LR-87-c7a908cc5adede6ca34519059f2e324dc6737ff6.zip
SSL network connections now seem to work, including on windows
Diffstat (limited to 'jessl.f90')
-rw-r--r--jessl.f9020
1 files changed, 14 insertions, 6 deletions
diff --git a/jessl.f90 b/jessl.f90
index a27803e..34fb2a2 100644
--- a/jessl.f90
+++ b/jessl.f90
@@ -5,7 +5,7 @@ implicit none
interface
- subroutine library_init() bind(c, name="SSL_library_init")
+ subroutine library_init() bind(c, name="OPENSSL_init_ssl")
end subroutine library_init
subroutine add_ssl_algorithms() bind(c, name="SSLeay_add_ssl_algorithms")
@@ -46,7 +46,7 @@ implicit none
function ssl_connect(ssl) bind(c, name="SSL_connect")
use iso_c_binding
- integer(kind=c_int)::connect
+ integer(kind=c_int)::ssl_connect
type(c_ptr), value::ssl
end function ssl_connect
@@ -80,6 +80,12 @@ implicit none
integer(kind=c_int)::get_error
end function get_error
+ function ssl_pending(ssl) bind(c, name="SSL_pending")
+ use iso_c_binding
+ type(c_ptr), value::ssl
+ integer(kind=c_int)::ssl_pending
+ end function ssl_pending
+
end interface
contains
@@ -91,12 +97,13 @@ contains
type(c_ptr)::ssl
character, dimension(:), intent(inout)::buf
integer::ssl_read
+ integer::bufsize
character(kind=c_char), dimension(:), allocatable::cbuf
+ bufsize = size(buf)
+ allocate(cbuf(bufsize))
- allocate(cbuf(size(buf)))
-
- ssl_read = read_c(ssl, cbuf, size(buf))
+ ssl_read = read_c(ssl, cbuf, 1)
buf = cbuf
deallocate(cbuf)
@@ -116,8 +123,9 @@ contains
allocate(cbuf(size(buf)))
cbuf = buf
+ cbuf(size(buf)) = c_null_char
ssl_write = write_c(ssl, cbuf, size(buf))
-
+
deallocate(cbuf)
end function ssl_write