kernel-brax3-ubuntu-touch/drivers/tee/teei/500/tz_driver/teei_fp.c
erascape f319b992b1 kernel-5.15: Initial import brax3 UT kernel
* halium configs enabled

Signed-off-by: erascape <erascape@proton.me>
2025-09-23 15:17:10 +00:00

54 lines
1.3 KiB
C
Executable file

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2015-2019, MICROTRUST Incorporated
* All Rights Reserved.
*
*/
#include <linux/slab.h>
#include "teei_fp.h"
#include "teei_client_transfer_data.h"
#define IMSG_TAG "[tz_driver]"
#include <imsg_log.h>
#include <linux/vmalloc.h>
static struct TEEC_Context context;
static int context_initialized;
struct TEEC_UUID uuid_fp = { 0x7778c03f, 0xc30c, 0x4dd0,
{ 0xa3, 0x19, 0xea, 0x29, 0x64, 0x3d, 0x4d, 0x4b } };
EXPORT_SYMBOL_GPL(uuid_fp);
int send_fp_command(void *buffer, unsigned long size)
{
int ret = 0;
IMSG_INFO("TEEI start %s\n", __func__);
if (buffer == NULL || size < 1)
return -1;
if (context_initialized == 0) {
memset(&context, 0, sizeof(context));
ret = ut_pf_gp_initialize_context(&context);
if (ret) {
IMSG_ERROR("Failed to initialize fp context ,err: %x",
ret);
goto release_1;
}
context_initialized = 1;
}
printk("isee microtrust debug fp uuid num is --->%x, %x ,%x ,%s\n", uuid_fp.timeLow,uuid_fp.timeMid,uuid_fp.timeHiAndVersion,uuid_fp.clockSeqAndNode);
ret = ut_pf_gp_transfer_user_data(&context, &uuid_fp, 1, buffer, size);
if (ret) {
IMSG_ERROR("Failed to transfer data,err: %x", ret);
goto release_2;
}
release_2:
if (ret) {
ut_pf_gp_finalize_context(&context);
context_initialized = 0;
}
release_1:
IMSG_INFO("TEEI end of %s\n", __func__);
return ret;
}