int secure_check(void *data)
{
	const at91_secure_header_t *header;
	void *file;
	int ret = -1;

	if (secure_decrypt(data, sizeof(*header), 0))
		goto secure_wipe_keys;

	header = (const at91_secure_header_t *)data;
	if (header->magic != AT91_SECURE_MAGIC)
		goto secure_wipe_keys;

	file = (unsigned char *)data + sizeof(*header);
	ret = secure_decrypt(file, header->file_size, 1);

secure_wipe_keys:
	wipe_keys();
	return ret;
}
int secure_check(void *data)
{
	const at91_secure_header_t *header;
	void *file;
	int ret = -1;

	if (secure_decrypt(data, sizeof(*header), 0))
		goto secure_wipe_keys;

	header = (const at91_secure_header_t *)data;
	if (header->magic != AT91_SECURE_MAGIC)
		goto secure_wipe_keys;

	file = (unsigned char *)data + sizeof(*header);
	ret = secure_decrypt(file, header->file_size, 1);

secure_wipe_keys:
	wipe_keys();
	return ret;
}