#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 …
static const uuid_t tee_client_uuid_ns = …;
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)
{ … }
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)
{ … }
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(…);
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)
{ … }
void tee_device_unregister(struct tee_device *teedev)
{ … }
EXPORT_SYMBOL_GPL(…);
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(…) …;