ssl: switch to using memory BIOs

This patch includes a backport of the upstream Memory BIO support.
Merge pull request #13 from geertj/feat-memory-bio

ssl: switch to using memory BIOs