crypto: use better memory BIO implementation

/cc @bnoordhuis