Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with event loop libraries #690

Closed
ghost opened this issue Nov 13, 2016 · 2 comments
Closed

Integration with event loop libraries #690

ghost opened this issue Nov 13, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 13, 2016

libevent, libuv, etc.

I understand there are BIO functions in mbedtls. Can these be used to integrate with asynchronous eventloop libraries like libuv (which is used in node.js) ?

@NWilson
Copy link
Contributor

NWilson commented Nov 15, 2016

Yes. mbedTLS can be used to integrate with any I/O framework of your choosing. mbedTLS is not tied to any I/O framework, and can be used in a completely non-blocking manner. You simply provide a read and write callback, which consume data from any stream/buffer/event queue of your choosing. The read callback supports returning "no more data" and the write callback allows applying backpressure. When you receive readability and writability notifications from your I/O framework, you simply call mbedtls_ssl_read/write to prompt it to consume/generate fresh data.

It's pretty much an ideal API, from my point of view as a user. At my company, we use mbedTLS in desktop & mobile applications, with a cross-platform event loop that runs on a wide variety of frameworks (WinSock, CoreFoundation, unix select, Android NDK Looper, etc) - each of these is able to feed our cross-platform I/O streams, and those streams are used to feed mbedTLS without any platform-specific code needed. I found it pretty painless to integrate mbedTLS with our streams, including backpressure and lazy buffering on read/write; hopefully libuv shouldn't either present a mismatch with the mbedTLS model.

@simonbutcher
Copy link
Contributor

This is just a question, and hopefully @NWilson's answer is sufficient, so I'll close this issue.

For further questions, I really recommend posting to the mbed TLS forum here, as wider number of people are more likely to see the question and answer it.

yanesca pushed a commit that referenced this issue Jul 1, 2020
…2004329

Merge development into development restricted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants