/* SPDX-License-Identifier: GPL-2.0-only */


#ifndef _CRYPTO_QTI_VIRT_H
#define _CRYPTO_QTI_VIRT_H

#include <linux/errno.h>
#include <linux/types.h>
#include <linux/blk-crypto.h>

#define RAW_SECRET_SIZE 32

#if IS_ENABLED(CONFIG_QTI_CRYPTO_VIRTUALIZATION)

int crypto_qti_virt_program_key(const struct blk_crypto_key *key,
					unsigned int slot);

int crypto_qti_virt_invalidate_key(unsigned int slot);


int crypto_qti_virt_derive_raw_secret_platform(const u8 *wrapped_key,
				unsigned int wrapped_key_size, u8 *secret,
				unsigned int secret_size);


int crypto_qti_virt_ice_get_info(uint32_t *total_num_slots);
int crypto_qti_virt_get_crypto_capabilities(unsigned int *crypto_modes_supported,
					    uint32_t crypto_array_size);
#else
static inline int crypto_qti_virt_program_key(const struct blk_crypto_key *key,
						unsigned int slot)
{
	return -EOPNOTSUPP;
}
static inline int crypto_qti_virt_invalidate_key(unsigned int slot)
{
	return -EOPNOTSUPP;
}
static inline int crypto_qti_virt_derive_raw_secret_platform(
				const u8 *wrapped_key,
				unsigned int wrapped_key_size, u8 *secret,
				unsigned int secret_size)
{
	return -EOPNOTSUPP;
}

static inline int crypto_qti_virt_ice_get_info(uint32_t *total_num_slots)
{
	return -EOPNOTSUPP;
}
static inline int crypto_qti_virt_get_crypto_capabilities(unsigned int *crypto_modes_supported,
							  uint32_t crypto_array_size)
{
	return -EOPNOTSUPP;
}
#endif 
#endif 

