You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Asyncnet crashes with OpenSSL 1.0.x (OpenSSL 1.0.x works fine with net module). When sniffing with wireshark it seems, that no handshake is done but the server/client are already reading/sending data. I've also get an SSL_ERROR_SSL when printing SSLGetError result in asyncnet's getSslError function.
Example Server
{.passL: "-Lopenssl-1.0.2s -lcrypto -lssl".}
import asyncnet, asyncdispatch, net
prochandle(client: AsyncSocket) {.async.} =var line: stringwhiletrue:
line =await client.recvLine()
echo"Line: ", line
if line =="":
echo"client disconnected"ifnot client.isClosed:
client.close()
breakprocmain() {.async.} =var ctx: SslContext=newContext(certFile ="publicKey.pem", keyFile ="secretKey.pem")
var server: AsyncSocket=newAsyncSocket()
server.setSockOpt(OptReuseAddr, true)
server.setSockOpt(OptReusePort, true)
server.bindAddr(Port(9000))
server.listen()
whiletrue:
var (address, client) =await server.acceptAddr()
echo"connection from: ", address
wrapConnectedSocket(ctx, client, handshakeAsServer)
asyncCheck client.handle()
waitFormain()
Example Client
{.passL: "-Lopenssl-1.0.2s -lcrypto -lssl".}
import asyncnet, asyncdispatch, net
prochandle(client: AsyncSocket) {.async.} =## We speek to the ssl server.whiletrue:
await client.send("TEST\n")
awaitsleepAsync(1000)
procmain() {.async.} =var ctx: SslContext=newContext(verifyMode =CVerifyNone)
var client: AsyncSocket=newAsyncSocket()
wrapSocket(ctx, client)
await client.connect("127.0.0.1", Port(9000))
await client.handle()
waitFormain()
Compiling and start server: nim c -d:ssl -d:openssl10 --dynlibOverride:ssl asyncSsl10Bug.nim; LD_LIBRARY_PATH=openssl-1.0.2s ./asyncSsl10Bug
Compiling and start client: nim c -d:ssl -d:openssl10 --dynlibOverride:ssl asyncSsl10BugCli.nim; LD_LIBRARY_PATH=openssl-1.0.2s ./asyncSsl10BugCli
$ nim -v
Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2019-06-02
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: d67a9f024eeeb2bc26fb38a98be9a53956003290
active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
Dankr4d
changed the title
SSL 1.0.x breaks with asyncnet
asyncnet crashes with SSL 1.0.x
Jun 2, 2019
Dankr4d
changed the title
asyncnet crashes with SSL 1.0.x
asyncnet crashes with OpenSSL 1.0.x
Jun 2, 2019
It's just asyncnet! The net modul works fine with OpenSSL 1.0.x. Momently as a workaround I'm working with the net module and threads for my project. Please let me know if I can help in any case to fix this problem!
If you're feeling adventurous you can try digging into the asyncnet source code to try and figure out why this crash happens. It's likely that we are simply calling OpenSSL functions incorrectly and/or need to call some new functions.
Asyncnet crashes with OpenSSL 1.0.x (OpenSSL 1.0.x works fine with net module). When sniffing with wireshark it seems, that no handshake is done but the server/client are already reading/sending data. I've also get an SSL_ERROR_SSL when printing SSLGetError result in asyncnet's getSslError function.
Example Server
Example Client
Compiling and start server:
nim c -d:ssl -d:openssl10 --dynlibOverride:ssl asyncSsl10Bug.nim; LD_LIBRARY_PATH=openssl-1.0.2s ./asyncSsl10Bug
Compiling and start client:
nim c -d:ssl -d:openssl10 --dynlibOverride:ssl asyncSsl10BugCli.nim; LD_LIBRARY_PATH=openssl-1.0.2s ./asyncSsl10BugCli
Output server
Output client
Additional Information
The text was updated successfully, but these errors were encountered: