static LUA_FUNCTION(openssl_bio_new_mem) { size_t l = 0; BIO *bio = BIO_new(BIO_s_mem()); if (lua_isnumber(L, 1)) { l = lua_tointeger(L, 1); BIO_set_buffer_size(bio, l); } else if (lua_isstring(L, 1)) { const char* d = (char*)luaL_checklstring(L, 1, &l); BIO_write(bio, d, l); } BIO_set_close(bio, BIO_CLOSE); PUSH_OBJECT(bio, "openssl.bio"); return 1; }
int HsOpenSSL_BIO_set_buffer_size(BIO* bio, int bufSize) { return BIO_set_buffer_size(bio, bufSize); }