zynqmp: pm: Added APIs for xilsecure linux support

Added SHA to calculate SHA3 hash,RSA to encrypt data with
public key and decrypt with private key and AES to do symmetric
encryption with User key or device key.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
This commit is contained in:
Siva Durga Prasad Paladugu 2018-05-01 11:12:55 +05:30
parent 915d4872cb
commit c95b2dfae4
3 changed files with 44 additions and 0 deletions

View File

@ -1138,3 +1138,29 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
return ret;
}
enum pm_ret_status pm_sha_hash(uint32_t address_high,
uint32_t address_low,
uint32_t size,
uint32_t flags)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMU */
PM_PACK_PAYLOAD5(payload, PM_SECURE_SHA, address_high, address_low,
size, flags);
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
}
enum pm_ret_status pm_rsa_core(uint32_t address_high,
uint32_t address_low,
uint32_t size,
uint32_t flags)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMU */
PM_PACK_PAYLOAD5(payload, PM_SECURE_RSA, address_high, address_low,
size, flags);
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
}

View File

@ -153,4 +153,12 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
unsigned int arg2,
unsigned int arg3,
unsigned int *data);
enum pm_ret_status pm_sha_hash(uint32_t address_high,
uint32_t address_low,
uint32_t size,
uint32_t flags);
enum pm_ret_status pm_rsa_core(uint32_t address_high,
uint32_t address_low,
uint32_t size,
uint32_t flags);
#endif /* _PM_API_SYS_H_ */

View File

@ -387,6 +387,16 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
ret = pm_set_suspend_mode(pm_arg[0]);
SMC_RET1(handle, (uint64_t)ret);
case PM_SECURE_SHA:
ret = pm_sha_hash(pm_arg[0], pm_arg[1], pm_arg[2],
pm_arg[3]);
SMC_RET1(handle, (uint64_t)ret);
case PM_SECURE_RSA:
ret = pm_rsa_core(pm_arg[0], pm_arg[1], pm_arg[2],
pm_arg[3]);
SMC_RET1(handle, (uint64_t)ret);
default:
WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
SMC_RET1(handle, SMC_UNK);