int CONF_dump_fp(LHASH *conf, FILE *out) { BIO *btmp; int ret; if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); return 0; } ret = CONF_dump_bio(conf, btmp); BIO_free(btmp); return ret; }
static LUA_FUNCTION(openssl_lhash_export) { LHASH* lhash = CHECK_OBJECT(1, LHASH, "openssl.lhash"); BIO *bio = BIO_new(BIO_s_mem()); BUF_MEM *bptr = NULL; CONF_dump_bio(lhash, bio); BIO_get_mem_ptr(bio, &bptr); lua_pushlstring(L, bptr->data, bptr->length); BIO_free(bio); return 1; }