7

OpenSSL example using memory BIO with non-blocking socket IO

 1 year ago
source link: https://gist.github.com/darrenjs/4645f115d10aa4b5cebf57483ec82eca
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Instantly share code, notes, and snippets.

OpenSSL example using memory BIO with non-blocking socket IO

MaG21 commented Feb 16, 2018

edited

Where's the non-blocking setup snippet located ? I observed the code above and it seems it doesn't do any no-blocking IO whatsoever (in terms of what a socket descriptor concerns) but rather, it implements multiplexing using poll. am I wrong?

Author

darrenjs commented Mar 10, 2018

correct .... any waiting of the main thread happens in the call to poll(). The thread will wait in there for any of the sockets to become ready to read or write.

Would you be able to help with some openssl config issues?

laybatin commented Sep 20, 2018

edited

Thanks. It is a reference to my development.
so.. how can i close the ssl socket? graceful shutdown..
ex) ssl_shutdown()

plz help me

at line 283, is it possible the error SSLSTATUS_WANT_IO means more bytes to read?

Author

darrenjs commented Nov 30, 2019

Yes. Could be either SSL_ERROR_WANT_WRITE or SSL_ERROR_WANT_READ. If it wants write then the following block does the BIO_read. If it wants read, then we will stay within the outer while (len > 0) loop, so there will a further call to BIO_write.

ramatin commented Jun 27, 2020

edited

Where is the code to do the handshake: SSL_do_handshake?

Author

darrenjs commented Jul 29, 2020

the handshake is initiated in the client (rather than in the server, which is shown above), see the client example at https://github.com/darrenjs/openssl_examples

thanks very much, this example really helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK