void fips_set_rand_check(void *rand_check)
	{
	int owning_thread = fips_is_owning_thread();

	if (fips_is_started())
		{
		if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
		fips_rand_check = rand_check;
		if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
		}
	}
void fips_set_mode(int onoff)
	{
	int owning_thread = fips_is_owning_thread();

	if (fips_is_started())
		{
		if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
		fips_mode = onoff;
		if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
		}
	}
Esempio n. 3
0
int fips_is_owning_thread(void)
	{
	int ret = 0;

	if (fips_is_started())
		{
		CRYPTO_r_lock(CRYPTO_LOCK_FIPS2);
		if (fips_thread != 0 && fips_thread == CRYPTO_thread_id())
			ret = 1;
		CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2);
		}
	return ret;
	}
void *FIPS_rand_check(void)
	{
	void *ret = 0;
	int owning_thread = fips_is_owning_thread();

	if (fips_is_started())
		{
		if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
		ret = fips_rand_check;
		if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
		}
	return ret;
	}
int FIPS_mode(void)
	{
	int ret = 0;
	int owning_thread = fips_is_owning_thread();

	if (fips_is_started())
		{
		if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
		ret = fips_mode;
		if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
		}
	return ret;
	}
Esempio n. 6
0
int fips_clear_owning_thread(void)
	{
	int ret = 0;

	if (fips_is_started())
		{
		CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
		if (fips_thread == CRYPTO_thread_id())
			{
			fips_thread = 0;
			ret = 1;
			}
		CRYPTO_w_unlock(CRYPTO_LOCK_FIPS2);
		}
	return ret;
	}