linux/drivers/tee/tee_core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2016, Linaro Limited
 */

#define pr_fmt(fmt)

#include <linux/cdev.h>
#include <linux/cred.h>
#include <linux/fs.h>
#include <linux/idr.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/tee_core.h>
#include <linux/uaccess.h>
#include <crypto/hash.h>
#include <crypto/sha1.h>
#include "tee_private.h"

#define TEE_NUM_DEVICES

#define TEE_IOCTL_PARAM_SIZE(x)

#define TEE_UUID_NS_NAME_SIZE

/*
 * TEE Client UUID name space identifier (UUIDv4)
 *
 * Value here is random UUID that is allocated as name space identifier for
 * forming Client UUID's for TEE environment using UUIDv5 scheme.
 */
static const uuid_t tee_client_uuid_ns =;

/*
 * Unprivileged devices in the lower half range and privileged devices in
 * the upper half range.
 */
static DECLARE_BITMAP(dev_mask, TEE_NUM_DEVICES);
static DEFINE_SPINLOCK(driver_lock);

static const struct class tee_class =;

static dev_t tee_devt;

struct tee_context *teedev_open(struct tee_device *teedev)
{}
EXPORT_SYMBOL_GPL();

void teedev_ctx_get(struct tee_context *ctx)
{}

static void teedev_ctx_release(struct kref *ref)
{}

void teedev_ctx_put(struct tee_context *ctx)
{}

void teedev_close_context(struct tee_context *ctx)
{}
EXPORT_SYMBOL_GPL();

static int tee_open(struct inode *inode, struct file *filp)
{}

static int tee_release(struct inode *inode, struct file *filp)
{}

/**
 * uuid_v5() - Calculate UUIDv5
 * @uuid: Resulting UUID
 * @ns: Name space ID for UUIDv5 function
 * @name: Name for UUIDv5 function
 * @size: Size of name
 *
 * UUIDv5 is specific in RFC 4122.
 *
 * This implements section (for SHA-1):
 * 4.3.  Algorithm for Creating a Name-Based UUID
 */
static int uuid_v5(uuid_t *uuid, const uuid_t *ns, const void *name,
		   size_t size)
{}

int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
				 const u8 connection_data[TEE_IOCTL_UUID_LEN])
{}
EXPORT_SYMBOL_GPL();

static int tee_ioctl_version(struct tee_context *ctx,
			     struct tee_ioctl_version_data __user *uvers)
{}

static int tee_ioctl_shm_alloc(struct tee_context *ctx,
			       struct tee_ioctl_shm_alloc_data __user *udata)
{}

static int
tee_ioctl_shm_register(struct tee_context *ctx,
		       struct tee_ioctl_shm_register_data __user *udata)
{}

static int params_from_user(struct tee_context *ctx, struct tee_param *params,
			    size_t num_params,
			    struct tee_ioctl_param __user *uparams)
{}

static int params_to_user(struct tee_ioctl_param __user *uparams,
			  size_t num_params, struct tee_param *params)
{}

static int tee_ioctl_open_session(struct tee_context *ctx,
				  struct tee_ioctl_buf_data __user *ubuf)
{}

static int tee_ioctl_invoke(struct tee_context *ctx,
			    struct tee_ioctl_buf_data __user *ubuf)
{}

static int tee_ioctl_cancel(struct tee_context *ctx,
			    struct tee_ioctl_cancel_arg __user *uarg)
{}

static int
tee_ioctl_close_session(struct tee_context *ctx,
			struct tee_ioctl_close_session_arg __user *uarg)
{}

static int params_to_supp(struct tee_context *ctx,
			  struct tee_ioctl_param __user *uparams,
			  size_t num_params, struct tee_param *params)
{}

static int tee_ioctl_supp_recv(struct tee_context *ctx,
			       struct tee_ioctl_buf_data __user *ubuf)
{}

static int params_from_supp(struct tee_param *params, size_t num_params,
			    struct tee_ioctl_param __user *uparams)
{}

static int tee_ioctl_supp_send(struct tee_context *ctx,
			       struct tee_ioctl_buf_data __user *ubuf)
{}

static long tee_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{}

static const struct file_operations tee_fops =;

static void tee_release_device(struct device *dev)
{}

/**
 * tee_device_alloc() - Allocate a new struct tee_device instance
 * @teedesc:	Descriptor for this driver
 * @dev:	Parent device for this device
 * @pool:	Shared memory pool, NULL if not used
 * @driver_data: Private driver data for this device
 *
 * Allocates a new struct tee_device instance. The device is
 * removed by tee_device_unregister().
 *
 * @returns a pointer to a 'struct tee_device' or an ERR_PTR on failure
 */
struct tee_device *tee_device_alloc(const struct tee_desc *teedesc,
				    struct device *dev,
				    struct tee_shm_pool *pool,
				    void *driver_data)
{}
EXPORT_SYMBOL_GPL();

static ssize_t implementation_id_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(implementation_id);

static struct attribute *tee_dev_attrs[] =;

ATTRIBUTE_GROUPS();

/**
 * tee_device_register() - Registers a TEE device
 * @teedev:	Device to register
 *
 * tee_device_unregister() need to be called to remove the @teedev if
 * this function fails.
 *
 * @returns < 0 on failure
 */
int tee_device_register(struct tee_device *teedev)
{}
EXPORT_SYMBOL_GPL();

void tee_device_put(struct tee_device *teedev)
{}

bool tee_device_get(struct tee_device *teedev)
{}

/**
 * tee_device_unregister() - Removes a TEE device
 * @teedev:	Device to unregister
 *
 * This function should be called to remove the @teedev even if
 * tee_device_register() hasn't been called yet. Does nothing if
 * @teedev is NULL.
 */
void tee_device_unregister(struct tee_device *teedev)
{}
EXPORT_SYMBOL_GPL();

/**
 * tee_get_drvdata() - Return driver_data pointer
 * @teedev:	Device containing the driver_data pointer
 * @returns the driver_data pointer supplied to tee_device_alloc().
 */
void *tee_get_drvdata(struct tee_device *teedev)
{}
EXPORT_SYMBOL_GPL();

struct match_dev_data {};

static int match_dev(struct device *dev, const void *data)
{}

struct tee_context *
tee_client_open_context(struct tee_context *start,
			int (*match)(struct tee_ioctl_version_data *,
				     const void *),
			const void *data, struct tee_ioctl_version_data *vers)
{}
EXPORT_SYMBOL_GPL();

void tee_client_close_context(struct tee_context *ctx)
{}
EXPORT_SYMBOL_GPL();

void tee_client_get_version(struct tee_context *ctx,
			    struct tee_ioctl_version_data *vers)
{}
EXPORT_SYMBOL_GPL();

int tee_client_open_session(struct tee_context *ctx,
			    struct tee_ioctl_open_session_arg *arg,
			    struct tee_param *param)
{}
EXPORT_SYMBOL_GPL();

int tee_client_close_session(struct tee_context *ctx, u32 session)
{}
EXPORT_SYMBOL_GPL();

int tee_client_system_session(struct tee_context *ctx, u32 session)
{}
EXPORT_SYMBOL_GPL();

int tee_client_invoke_func(struct tee_context *ctx,
			   struct tee_ioctl_invoke_arg *arg,
			   struct tee_param *param)
{}
EXPORT_SYMBOL_GPL();

int tee_client_cancel_req(struct tee_context *ctx,
			  struct tee_ioctl_cancel_arg *arg)
{}

static int tee_client_device_match(struct device *dev,
				   const struct device_driver *drv)
{}

static int tee_client_device_uevent(const struct device *dev,
				    struct kobj_uevent_env *env)
{}

const struct bus_type tee_bus_type =;
EXPORT_SYMBOL_GPL();

static int __init tee_init(void)
{}

static void __exit tee_exit(void)
{}

subsys_initcall(tee_init);
module_exit(tee_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();