libcrypto: wrap more parts of the BIO_ api and add unit tests