
#if (defined(OWN_ALLOCATOR) || defined(CUSTOM_LIBC))
#include "libc_functions/libc_functions.h"
#endif

#include "openssl/evp/evp.h"
#include "pd_rand/pd_rand.h"
#include "drbg/ctr_drbg_ossl.h"

#include "cryptolib_init.h"

int cryptolib_init()
{
	int ret = 1;

#if (defined(OWN_ALLOCATOR) || defined(CUSTOM_LIBC))

	ret = libc_init();
	if(!ret)
	{
		return 0;
	}
#endif

#ifndef USE_MD_RAND
	/* use pd_rand as source of entropy input */
	drbg_ossl_init(pd_rand, NULL, 0);
#endif

	OPENSSL_add_all_algorithms_noconf();

	ret = 1;
	return ret;
}
