Пример #1
0
void TEE_CopyObjectAttributes(TEE_ObjectHandle destObject,
                              TEE_ObjectHandle srcObject)
{
    TEE_Result res;
    TEE_ObjectInfo dst_info;
    TEE_ObjectInfo src_info;

    res = utee_cryp_obj_get_info((uint32_t)destObject, &dst_info);
    if (res != TEE_SUCCESS)
        TEE_Panic(0);

    res = utee_cryp_obj_get_info((uint32_t)srcObject, &src_info);
    if (res != TEE_SUCCESS)
        TEE_Panic(0);

    if ((src_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0)
        TEE_Panic(0);
    if ((dst_info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0)
        TEE_Panic(0);
    if ((dst_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0)
        TEE_Panic(0);

    res = utee_cryp_obj_copy((uint32_t)destObject, (uint32_t)srcObject);
    if (res != TEE_SUCCESS)
        TEE_Panic(0);
}
Пример #2
0
TEE_Result TEE_CopyObjectAttributes1(TEE_ObjectHandle destObject,
			      TEE_ObjectHandle srcObject)
{
	TEE_Result res;
	TEE_ObjectInfo dst_info;
	TEE_ObjectInfo src_info;

	res = utee_cryp_obj_get_info((unsigned long)destObject, &dst_info);
	if (res != TEE_SUCCESS)
		goto exit;

	res = utee_cryp_obj_get_info((unsigned long)srcObject, &src_info);
	if (res != TEE_SUCCESS)
		goto exit;

	if (!(src_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED))
		TEE_Panic(0);

	if ((dst_info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT))
		TEE_Panic(0);

	if ((dst_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED))
		TEE_Panic(0);

	res = utee_cryp_obj_copy((unsigned long)destObject,
				 (unsigned long)srcObject);

exit:
	if (res != TEE_SUCCESS &&
	    res != TEE_ERROR_CORRUPT_OBJECT &&
	    res != TEE_ERROR_STORAGE_NOT_AVAILABLE)
		TEE_Panic(res);

	return res;
}
Пример #3
0
TEE_Result TEE_CopyObjectAttributes1(TEE_ObjectHandle destObject,
			      TEE_ObjectHandle srcObject)
{
	TEE_Result res;
	TEE_ObjectInfo dst_info;
	TEE_ObjectInfo src_info;

	res = utee_cryp_obj_get_info((uint32_t)destObject, &dst_info);
	if (res != TEE_SUCCESS)
		goto err;

	res = utee_cryp_obj_get_info((uint32_t)srcObject, &src_info);
	if (res != TEE_SUCCESS)
		goto err;

	if ((src_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0)
		TEE_Panic(0);
	if ((dst_info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0)
		TEE_Panic(0);
	if ((dst_info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0)
		TEE_Panic(0);

	res = utee_cryp_obj_copy((uint32_t)destObject, (uint32_t)srcObject);
	if (res != TEE_SUCCESS)
		TEE_Panic(0);

	goto out;

err:
	if (res == TEE_ERROR_CORRUPT_OBJECT) {
		res = utee_storage_obj_del(srcObject);
		if (res != TEE_SUCCESS)
			TEE_Panic(0);
		return TEE_ERROR_CORRUPT_OBJECT;
	}
	if (res == TEE_ERROR_STORAGE_NOT_AVAILABLE)
		return res;
	TEE_Panic(0);
out:
	return TEE_SUCCESS;
}