/* Function invokes the get_entropy callback in driver to get the random data and fill to passed buffer  */
static int get_entropy(void)
/* Function invokes the get_entropy callback in driver to get the random data and fill to passed buffer  */
static int get_entropy(void)
{
	const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
	int ret;
	if (!device_is_ready(dev)) {
		TC_PRINT("error: random device not ready\n");
		return TC_FAIL;
	}
	TC_PRINT("random device is %p, name is %s\n",
		 dev, dev->name);
	ret = random_entropy(dev, entropy_buffer, 0);
	if (ret == RECHECK_RANDOM_ENTROPY) {
		ret = random_entropy(dev, entropy_buffer, 0xa5);
		if (ret == RECHECK_RANDOM_ENTROPY) {
			return TC_FAIL;
		} else {
			return ret;
		}
	}
	return ret;
}