summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi Soo Shin <jisshin@google.com>2023-02-08 00:39:19 +0100
committerJi Soo Shin <jisshin@google.com>2023-02-09 17:39:20 +0100
commit4609bfa4d9d39210e953322fdc73dd4a3cd46c5c (patch)
tree5a3b15c9c4e80724de6a34c9f7e003263fac0e30
parentbec75f7f9eb1c79c18949632e8799078d8f9d0a3 (diff)
downloadsamsung-4609bfa4d9d39210e953322fdc73dd4a3cd46c5c.tar.gz
zuma: trusty integration
In this code: 1) we delete all the unused code 2) we redirect LDFW smc calls to Trusty TIPC calls. Bug: 265774740 Change-Id: I9708f83486d612b0342210936406aa6151231fd4 Signed-off-by: Ji Soo Shin <jisshin@google.com>
-rw-r--r--Kbuild17
-rw-r--r--Makefile18
-rw-r--r--exynos-hdcp2-config.h20
-rw-r--r--exynos-hdcp2-crypto.c64
-rw-r--r--exynos-hdcp2-crypto.h20
-rw-r--r--exynos-hdcp2-dplink-auth.c7
-rw-r--r--exynos-hdcp2-dplink-if.c137
-rw-r--r--exynos-hdcp2-dplink-if.h2
-rw-r--r--exynos-hdcp2-dplink-inter.c28
-rw-r--r--exynos-hdcp2-dplink-protocol-msg.c4
-rw-r--r--exynos-hdcp2-dplink-selftest.c322
-rw-r--r--exynos-hdcp2-dplink-selftest.h15
-rw-r--r--exynos-hdcp2-dplink.c20
-rw-r--r--exynos-hdcp2-dplink.h4
-rw-r--r--exynos-hdcp2-encrypt.c93
-rw-r--r--exynos-hdcp2-encrypt.h18
-rw-r--r--exynos-hdcp2-main.c (renamed from exynos-hdcp2.c)77
-rw-r--r--exynos-hdcp2-misc.c27
-rw-r--r--exynos-hdcp2-misc.h15
-rw-r--r--exynos-hdcp2-protocol-msg.c86
-rw-r--r--exynos-hdcp2-selftest.c280
-rw-r--r--exynos-hdcp2-selftest.h13
-rw-r--r--exynos-hdcp2-session.c2
-rw-r--r--exynos-hdcp2-teeif.c338
-rw-r--r--exynos-hdcp2-teeif.h24
-rw-r--r--exynos-hdcp2-testvector.h447
-rw-r--r--hdcp2_if.h17
27 files changed, 613 insertions, 1502 deletions
diff --git a/Kbuild b/Kbuild
new file mode 100644
index 0000000..588be66
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the drm device driver. This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+exynos-hdcp2-y += exynos-hdcp2-main.o
+exynos-hdcp2-y += exynos-hdcp2-teeif.o
+exynos-hdcp2-y += exynos-hdcp2-session.o
+exynos-hdcp2-y += exynos-hdcp2-protocol-msg.o
+exynos-hdcp2-y += exynos-hdcp2-dplink-inter.o
+exynos-hdcp2-y += exynos-hdcp2-dplink.o
+exynos-hdcp2-y += exynos-hdcp2-dplink-if.o
+exynos-hdcp2-y += exynos-hdcp2-dplink-auth.o
+exynos-hdcp2-y += exynos-hdcp2-dplink-protocol-msg.o
+exynos-hdcp2-y += exynos-hdcp2-selftest.o
+
+obj-$(CONFIG_EXYNOS_HDCP2) += exynos-hdcp2.o
diff --git a/Makefile b/Makefile
index 69d960b..5ceb079 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,13 @@
-#
-# Exynos HDCP drivers
-#
+M ?= $(shell pwd)
-# HDCP
-hdcp2-objs := exynos-hdcp2.o exynos-hdcp2-teeif.o exynos-hdcp2-crypto.o exynos-hdcp2-session.o exynos-hdcp2-misc.o exynos-hdcp2-encrypt.o exynos-hdcp2-protocol-msg.o exynos-hdcp2-dplink-inter.o exynos-hdcp2-dplink.o exynos-hdcp2-dplink-if.o exynos-hdcp2-dplink-auth.o exynos-hdcp2-dplink-protocol-msg.o
-obj-$(CONFIG_EXYNOS_HDCP2) += hdcp2.o
+KBASE_PATH_RELATIVE = $(M)
-hdcp2-$(CONFIG_HDCP2_EMULATION_MODE) += exynos-hdcp2-dplink-selftest.o
+EXTRA_CFLAGS += -Werror
+
+include $(KERNEL_SRC)/../private/google-modules/soc/gs/Makefile.include
+
+KBUILD_OPTIONS += CONFIG_EXYNOS_HDCP2=m
+
+modules modules_install clean:
+ $(MAKE) -C $(KERNEL_SRC) M=$(M) W=1 \
+ $(KBUILD_OPTIONS) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" $(@)
diff --git a/exynos-hdcp2-config.h b/exynos-hdcp2-config.h
deleted file mode 100644
index 9dedcb8..0000000
--- a/exynos-hdcp2-config.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* todo: include/soc/samsung/exynos-hdcp2-config.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-#ifndef __EXYNOS_HDCP2_CONFIG_H__
-#define __EXYNOS_HDCP2_CONFIG_H__
-
-#define TEST_HDCP
-
-#define TEST_VECTOR_2
-
-#define HDCP_TX_VERSION_2_1
-#define HDCP_TX_LC_PRECOMPUTE_SUPPORT
-
-#endif
diff --git a/exynos-hdcp2-crypto.c b/exynos-hdcp2-crypto.c
deleted file mode 100644
index 7abb0ad..0000000
--- a/exynos-hdcp2-crypto.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-crypto.c
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/err.h>
-#include <linux/crypto.h>
-#include <linux/ctype.h>
-#include <crypto/hash.h>
-
-struct sdesc {
- struct shash_desc shash;
- char ctx[];
-};
-
-static struct sdesc *alloc_sdesc(struct crypto_shash *alg)
-{
- struct sdesc *sdesc;
- int size;
-
- size = sizeof(struct shash_desc) + crypto_shash_descsize(alg);
- sdesc = kmalloc(size, GFP_KERNEL);
- if (!sdesc)
- return ERR_PTR(-ENOMEM);
- sdesc->shash.tfm = alg;
-
- return sdesc;
-}
-
-int hdcp_calc_sha1(u8 *digest, const u8 *buf, unsigned int buflen)
-{
- struct crypto_shash *hashalg;
- const char hash_alg[] = "sha1";
- struct sdesc *sdesc;
- int ret;
-
- hashalg = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(hashalg)) {
- pr_info("encrypted_key: could not allocate crypto %s\n",
- hash_alg);
- return PTR_ERR(hashalg);
- }
-
- sdesc = alloc_sdesc(hashalg);
- if (IS_ERR(sdesc)) {
- pr_err("alloc_sdesc: can't alloc %s\n", hash_alg);
- if (hashalg)
- crypto_free_shash(hashalg);
- return PTR_ERR(sdesc);
- }
-
- ret = crypto_shash_digest(&sdesc->shash, buf, buflen, digest);
- kfree(sdesc);
-
- if (hashalg)
- crypto_free_shash(hashalg);
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(hdcp_calc_sha1);
diff --git a/exynos-hdcp2-crypto.h b/exynos-hdcp2-crypto.h
deleted file mode 100644
index 38440f9..0000000
--- a/exynos-hdcp2-crypto.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-crypto.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __EXYNOS_HDCP2_CRYPTO_H__
-#define __EXYNOS_HDCP2_CRYPTO_H__
-
-#define HDCP_SHA1_SIZE (160 / 8)
-
-int hdcp_calc_sha1(u8 *digest, const u8 *buf, unsigned int buflen);
-
-#endif
diff --git a/exynos-hdcp2-dplink-auth.c b/exynos-hdcp2-dplink-auth.c
index ed1d44f..b0ac0cc 100644
--- a/exynos-hdcp2-dplink-auth.c
+++ b/exynos-hdcp2-dplink-auth.c
@@ -10,7 +10,6 @@
#include <linux/delay.h>
#include <linux/module.h>
#include "exynos-hdcp2.h"
-#include "exynos-hdcp2-misc.h"
#include "exynos-hdcp2-log.h"
#include "exynos-hdcp2-dplink-auth.h"
#include "exynos-hdcp2-dplink-if.h"
@@ -177,7 +176,7 @@ static int dp_send_protocol_msg(struct hdcp_link_data *lk, uint8_t msg_id, struc
return TX_AUTH_SUCCESS;
}
-int dp_recv_protocol_msg(struct hdcp_link_data *lk, uint8_t msg_id, struct hdcp_msg_info *msg_info)
+static int dp_recv_protocol_msg(struct hdcp_link_data *lk, uint8_t msg_id, struct hdcp_msg_info *msg_info)
{
int ret = TX_AUTH_SUCCESS;
@@ -264,7 +263,7 @@ static int do_send_ake_init(struct hdcp_link_data *lk)
return 0;
}
-void parse_rxcaps_info(uint8_t *rxcaps, struct hdcp_link_data *lk)
+static void parse_rxcaps_info(uint8_t *rxcaps, struct hdcp_link_data *lk)
{
memcpy(lk->rx_ctx.caps, rxcaps, sizeof(lk->rx_ctx.caps));
if (rxcaps[2] & DP_RXCAPS_REPEATER) {
@@ -1166,5 +1165,3 @@ void dplink_clear_irqflag_all(void)
reauth_req = 0;
integrity_fail = 0;
}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink-if.c b/exynos-hdcp2-dplink-if.c
index 37a76a2..e5e7a9b 100644
--- a/exynos-hdcp2-dplink-if.c
+++ b/exynos-hdcp2-dplink-if.c
@@ -18,122 +18,9 @@
#include "exynos-hdcp2-dplink-reg.h"
#include "exynos-hdcp2-dplink-if.h"
-#if IS_ENABLED(CONFIG_DRM_SAMSUNG_DP)
static void (*pdp_hdcp22_enable)(u32 en);
static int (*pdp_dpcd_read_for_hdcp22)(u32 address, u32 length, u8 *data);
static int (*pdp_dpcd_write_for_hdcp22)(u32 address, u32 length, u8 *data);
-void dp_register_func_for_hdcp22(void (*func0)(u32 en), int (*func1)(u32 address, u32 length, u8 *data), int (*func2)(u32 address, u32 length, u8 *data));
-#else
-void pdp_hdcp22_enable(u32 en);
-int pdp_dpcd_read_for_hdcp22(u32 address, u32 length, u8 *data);
-int pdp_dpcd_write_for_hdcp22(u32 address, u32 length, u8 *data);
-#endif
-
-
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
-#define NETLINK_HDCP 31
-#define SOCK_BUF_SIZE (1024 * 512)
-#define NETLINK_PORT 1000
-
-struct sock *nl_sk = NULL;
-struct sk_buff sk_buf;
-uint8_t dplink_wait;
-uint8_t *nl_data;
-struct nlmsghdr *nlh;
-
-void cb_hdcp_nl_recv_msg(struct sk_buff *skb);
-
-int hdcp_dplink_init(void)
-{
- struct netlink_kernel_cfg cfg = {
- .input = cb_hdcp_nl_recv_msg,
- };
-
- nl_sk = netlink_kernel_create(&init_net, NETLINK_HDCP, &cfg);
- if (!nl_sk) {
- hdcp_err("Error creating socket.\n");
- return -EINVAL;
- }
-
- nl_data = (uint8_t *)kzalloc(SOCK_BUF_SIZE, GFP_KERNEL);
- if (!nl_data) {
- hdcp_err("Netlink Socket buffer alloc fail\n");
- return -EINVAL;
- }
-
- dplink_wait = 1;
-
- return 0;
-}
-
-/* callback for netlink driver */
-void cb_hdcp_nl_recv_msg(struct sk_buff *skb)
-{
- nlh = (struct nlmsghdr *)skb->data;
-
- memcpy(nl_data, (uint8_t *)nlmsg_data(nlh), nlmsg_len(nlh));
- dplink_wait = 0;
-}
-
-static void nl_recv_msg(uint8_t *data, uint32_t size)
-{
- /* todo: change to not a busy wait */
- while (dplink_wait) {
- hdcp_err("wait dplink_wait\n");
- msleep(1000);
- }
-
- memcpy(data, nl_data, size);
-
- dplink_wait = 1;
-}
-
-int hdcp_dplink_recv(uint32_t msg_name, uint8_t *data, uint32_t size)
-{
- nl_recv_msg(data, size);
- return 0;
-}
-
-int hdcp_dplink_send(uint32_t msg_name, uint8_t *data, uint32_t size)
-{
- struct sk_buff *skb_out;
- int ret;
-
- skb_out = nlmsg_new(size, 0);
- if (!skb_out) {
- hdcp_err("Failed to allocate new skb\n");
- return -1;
- }
- nlh = nlmsg_put(skb_out, 0, 0, 2, size, NLM_F_REQUEST);
- if (!nlh) {
- hdcp_err("fail to nlmsg_put()\n");
- return -1;
- }
-
- NETLINK_CB(skb_out).dst_group = 0; /* not in mcast group */
- memcpy(nlmsg_data(nlh), data, size);
-
- ret = nlmsg_unicast(nl_sk, skb_out, NETLINK_PORT);
- if (ret < 0) {
- hdcp_err("Error while sending bak to user\n");
- return -1;
- }
-
- return 0;
-}
-
-int hdcp_dplink_is_enabled_hdcp22(void)
-{
- /* todo: check hdcp22 enable */
- return 1;
-}
-
-void hdcp_dplink_config(int en)
-{
- /* dummy function */
-}
-#else
-
/* Address define for HDCP within DPCD address space */
static uint32_t dpcd_addr[NUM_HDCP22_MSG_NAME] = {
@@ -165,12 +52,6 @@ static uint32_t dpcd_addr[NUM_HDCP22_MSG_NAME] = {
DPCD_ADDR_HDCP22_Type,
};
-int hdcp_dplink_init(void)
-{
- /* todo */
- return 0;
-}
-
void hdcp_dplink_config(int en)
{
pdp_hdcp22_enable(en);
@@ -248,9 +129,7 @@ int hdcp_dplink_send(uint32_t msg_name, uint8_t *data, uint32_t size)
else
return pdp_dpcd_write_for_hdcp22(dpcd_addr[msg_name], size, data);
}
-#endif
-#if IS_ENABLED(CONFIG_DRM_SAMSUNG_DP)
void dp_register_func_for_hdcp22(void (*func0)(u32 en), int (*func1)(u32 address, u32 length, u8 *data), int (*func2)(u32 address, u32 length, u8 *data))
{
pdp_hdcp22_enable = func0;
@@ -258,19 +137,3 @@ void dp_register_func_for_hdcp22(void (*func0)(u32 en), int (*func1)(u32 address
pdp_dpcd_write_for_hdcp22 = func2;
}
EXPORT_SYMBOL_GPL(dp_register_func_for_hdcp22);
-#else
-int pdp_dpcd_read_for_hdcp22(u32 address, u32 length, u8 *data)
-{
- return 0;
-}
-int pdp_dpcd_write_for_hdcp22(u32 address, u32 length, u8 *data)
-{
- return 0;
-}
-void pdp_hdcp22_enable(u32 en)
-{
- return;
-}
-#endif
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink-if.h b/exynos-hdcp2-dplink-if.h
index 96ee762..140b204 100644
--- a/exynos-hdcp2-dplink-if.h
+++ b/exynos-hdcp2-dplink-if.h
@@ -44,11 +44,11 @@ enum hdcp22_msg_name {
#define DP_HDCP22_ENABLE 1
#define DP_HPD_STATUS_ZERO 2
-int hdcp_dplink_init(void);
void hdcp_dplink_config(int en);
int hdcp_dplink_is_enabled_hdcp22(void);
int hdcp_dplink_recv(uint32_t msg_name, uint8_t *data, uint32_t size);
int hdcp_dplink_send(uint32_t msg_name, uint8_t *data, uint32_t size);
int hdcp_dplink_get_stream_info(uint16_t *num, uint8_t *strm_id);
+void dp_register_func_for_hdcp22(void (*func0)(u32 en), int (*func1)(u32 address, u32 length, u8 *data), int (*func2)(u32 address, u32 length, u8 *data));
#endif
diff --git a/exynos-hdcp2-dplink-inter.c b/exynos-hdcp2-dplink-inter.c
index 843e9d2..47019e4 100644
--- a/exynos-hdcp2-dplink-inter.c
+++ b/exynos-hdcp2-dplink-inter.c
@@ -13,7 +13,7 @@
#include <linux/uaccess.h>
#include <linux/smc.h>
#include <asm/cacheflush.h>
-#include <soc/samsung/exynos-smc.h>
+#include <linux/soc/samsung/exynos-smc.h>
#include <linux/types.h>
#include <linux/delay.h>
@@ -23,6 +23,7 @@
#include "exynos-hdcp2-dplink-inter.h"
#include "exynos-hdcp2-dplink-if.h"
#include "exynos-hdcp2-dplink-auth.h"
+#include "exynos-hdcp2-teeif.h"
#define DRM_WAIT_RETRY_COUNT 1000
/* current link data */
@@ -35,14 +36,10 @@ int hdcp_dplink_auth_check(enum auth_signal hdcp_signal)
{
int ret = 0;
-#if defined(CONFIG_HDCP2_FUNC_TEST_MODE)
- ret = exynos_smc(SMC_DRM_HDCP_FUNC_TEST, 1, 0, 0);
-#endif
switch (hdcp_signal) {
case HDCP_DRM_OFF:
return ret;
case HDCP_DRM_ON:
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HDCP22_DISABLE, 0, 0);
dplink_clear_irqflag_all();
ret = hdcp_dplink_authenticate();
return ret;
@@ -93,30 +90,24 @@ EXPORT_SYMBOL_GPL(hdcp_dplink_set_rp_ready);
int hdcp_dplink_set_reauth(void)
{
- uint64_t ret = 0;
-
hdcp_info("reauth requested.\n");
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HDCP22_DISABLE, 0, 0);
+ hdcp_tee_send_cmd(HDCP_CMD_AUTH_CANCEL);
return dplink_set_reauth_req();
}
EXPORT_SYMBOL_GPL(hdcp_dplink_set_reauth);
int hdcp_dplink_set_integrity_fail(void)
{
- uint64_t ret = 0;
-
hdcp_info("integrity check fail.\n");
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HDCP22_DISABLE, 0, 0);
+ hdcp_tee_send_cmd(HDCP_CMD_AUTH_CANCEL);
return dplink_set_integrity_fail();
}
EXPORT_SYMBOL_GPL(hdcp_dplink_set_integrity_fail);
int hdcp_dplink_cancel_auth(void)
{
- uint64_t ret = 0;
-
hdcp_info("Cancel authenticate.\n");
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HPD_STATUS_ZERO, 0, 0);
+ hdcp_tee_send_cmd(HDCP_CMD_AUTH_CANCEL);
auth_proc_state = HDCP_AUTH_PROCESS_STOP;
return dplink_set_integrity_fail();
@@ -125,21 +116,16 @@ EXPORT_SYMBOL_GPL(hdcp_dplink_cancel_auth);
void hdcp_dplink_clear_all(void)
{
- uint64_t ret = 0;
-
hdcp_info("HDCP flag clear\n");
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HDCP22_DISABLE, 0, 0);
+ hdcp_tee_send_cmd(HDCP_CMD_AUTH_CANCEL);
dplink_clear_irqflag_all();
}
EXPORT_SYMBOL_GPL(hdcp_dplink_clear_all);
void hdcp_dplink_connect_state(enum dp_state state)
{
- uint64_t ret = 0;
-
dp_hdcp_state = state;
hdcp_info("Displayport connect info (%d)\n", dp_hdcp_state);
- ret = exynos_smc(SMC_DRM_DP_CONNECT_INFO, dp_hdcp_state, 0, 0);
+ exynos_smc(SMC_DRM_DP_CONNECT_INFO, dp_hdcp_state, 0, 0);
}
EXPORT_SYMBOL_GPL(hdcp_dplink_connect_state);
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink-protocol-msg.c b/exynos-hdcp2-dplink-protocol-msg.c
index 75f97c8..1c36f6d 100644
--- a/exynos-hdcp2-dplink-protocol-msg.c
+++ b/exynos-hdcp2-dplink-protocol-msg.c
@@ -12,10 +12,8 @@
#include <linux/kernel.h>
#include <linux/module.h>
-#include "exynos-hdcp2-config.h"
#include "exynos-hdcp2-protocol-msg.h"
#include "exynos-hdcp2.h"
-#include "exynos-hdcp2-misc.h"
#include "exynos-hdcp2-log.h"
#include "exynos-hdcp2-dplink-protocol-msg.h"
#include "exynos-hdcp2-dplink-if.h"
@@ -492,5 +490,3 @@ int dp_decap_protocol_msg(uint8_t msg_id,
else
return -1;
}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink-selftest.c b/exynos-hdcp2-dplink-selftest.c
deleted file mode 100644
index a459fa7..0000000
--- a/exynos-hdcp2-dplink-selftest.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * drivers/soc/samsung/exynos-hdcp/dplink/exynos-hdcp2-dplink-selftest.c
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <asm/cacheflush.h>
-
-#include "exynos-hdcp2.h"
-#include "exynos-hdcp2-config.h"
-#include "exynos-hdcp2-protocol-msg.h"
-#include "exynos-hdcp2-misc.h"
-#include "exynos-hdcp2-encrypt.h"
-#include "exynos-hdcp2-log.h"
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
-#include "exynos-hdcp2-testvector.h"
-#endif
-#include "exynos-hdcp2-dplink-protocol-msg.h"
-
-#define DP_AKE_INIT_LEN 11
-#define DP_AKE_NO_STORED_KM_LEN 128
-#define DP_LC_INIT_LEN 8
-#define DP_SKE_SEND_EKS_LEN 24
-
-/* todo: define DP test vector */
-static struct hdcp_tx_ctx g_tx_ctx;
-static struct hdcp_rx_ctx g_rx_ctx;
-static int dp_utc_ske_send_eks(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx)
-{
- uint8_t m[525];
- size_t m_len;
- int ret;
- int i;
-
- tx_ctx->share_skey = 0;
-
- ret = dp_cap_protocol_msg(SKE_SEND_EKS, m, &m_len, tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("SKE_Send_Eks is failed with 0x%x\n", ret);
- return -1;
- }
-
- if (m_len != DP_SKE_SEND_EKS_LEN) {
- hdcp_err("Message LENGTH ERROR\n");
- return -1;
- }
-
- /* compare encrypted session key with test vector */
- for (i = 0; i < HDCP_AKE_MKEY_BYTE_LEN; i++)
- if (tv_ske_eskey_v22[i] != m[i])
- break;
-
- if (i != HDCP_AKE_MKEY_BYTE_LEN) {
- hdcp_err("m doesn't match (%dth)\n", i);
- return -1;
- }
-
- return 0;
-}
-
-/* Test SKE APIs */
-static int dp_utc_ske(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx, int *cnt, int *fail)
-{
- int ret;
-
- ret = dp_utc_ske_send_eks(tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("utc_ske_send_eks() is failed with 0x%x\n", ret);
- return -1;
- }
-
- return 0;
-}
-static int dp_utc_lc_send_l_prime(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx)
-{
- int ret;
-
- ret = dp_decap_protocol_msg(LC_SEND_L_PRIME, msg_rx_lc_send_l_prime_v22,
- sizeof(msg_rx_send_h_prime_v22),
- tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("LC_Send_L_prime is failed with 0x%x\n", ret);
- return -1;
- }
-
- return 0;
-}
-
-static int dp_utc_lc_init(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx)
-{
- uint8_t m[525];
- size_t m_len;
- int ret;
-
- ret = dp_cap_protocol_msg(LC_INIT, m, &m_len, tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("LC_Init is failed with 0x%x\n", ret);
- return -1;
- }
-
- if (m_len != DP_LC_INIT_LEN) {
- hdcp_err("Invalid Message length. len(%zu)\n", m_len);
- return -1;
- }
-
- return 0;
-}
-
-/* Test LC APIs */
-static int dp_utc_lc(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx,
- int *cnt, int *fail)
-{
- int ret;
-
- ret = dp_utc_lc_init(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- ret = dp_utc_lc_send_l_prime(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
-static int dp_utc_ake_send_h_prime(struct hdcp_tx_ctx *tx_ctx,
- struct hdcp_rx_ctx *rx_ctx)
-{
- int ret;
-
- ret = dp_decap_protocol_msg(AKE_SEND_H_PRIME, msg_rx_send_h_prime_v22,
- sizeof(msg_rx_send_h_prime_v22),
- tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("AKE_Send_H_prime is failed with 0x%x\n", ret);
- return -1;
- }
-
- return 0;
-}
-
-static int dp_utc_ake_send_pairing_info(struct hdcp_tx_ctx *tx_ctx,
- struct hdcp_rx_ctx *rx_ctx)
-{
- /* todo: support pairing */
- int i;
- int ret;
- int found_km;
-
- ret = dp_decap_protocol_msg(AKE_SEND_PAIRING_INFO, msg_rx_send_pairing_info_v22,
- sizeof(msg_rx_send_pairing_info_v22),
- tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("AKE_Send_Pairing_Info is failed with 0x%x\n", ret);
- return -1;
- }
-
- ret = ake_find_masterkey(&found_km,
- tx_ctx->ekh_mkey, HDCP_AKE_EKH_MKEY_BYTE_LEN,
- tx_ctx->m, HDCP_AKE_M_BYTE_LEN);
- if (ret) {
- hdcp_err("find_masterkey() is failed with 0x%x\n", ret);
- return -1;
- }
-
- if (found_km) {
- for (i = 0; i < HDCP_AKE_MKEY_BYTE_LEN; i++)
- if (tx_ctx->ekh_mkey[i] != msg_rx_send_pairing_info_v22[i])
- break;
-
- if (i != HDCP_AKE_MKEY_BYTE_LEN) {
- hdcp_err("ekh(m) doesn't match (%dth)\n", i);
- return -1;
- }
- } else {
- hdcp_err("ekh(m) is not found\n");
- return -1;
- }
-
- return 0;
-}
-
-static int dp_utc_ake_no_stored_km(struct hdcp_tx_ctx *tx_ctx,
- struct hdcp_rx_ctx *rx_ctx)
-{
- uint8_t m[525];
- size_t m_len;
- int ret;
- int i;
-
- memcpy(rx_ctx->cert, cert_v22, HDCP_RX_CERT_LEN);
-
- ret = dp_cap_protocol_msg(AKE_NO_STORED_KM, m, &m_len, tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("AKE_No_Stored_km is failed with 0x%x\n", ret);
- return -1;
- }
-
- if (m_len != DP_AKE_NO_STORED_KM_LEN) {
- hdcp_err("Invalid Message length. len(%zu)\n", m_len);
- return -1;
- }
-
- for (i = 0; i < 128; i++)
- if (m[i] != tv_emkey_v22[i])
- break;
-
- if (i != 128) {
- hdcp_err("Encryption Master Key ERROR\n");
- return -1;
- }
-
- return 0;
-}
-
-static int dp_utc_ake_send_cert(struct hdcp_tx_ctx *tx_ctx,
- struct hdcp_rx_ctx *rx_ctx)
-{
- int ret;
-
- ret = dp_decap_protocol_msg(AKE_SEND_CERT, msg_rx_send_cert_v22,
- sizeof(msg_rx_send_cert_v22),
- tx_ctx, rx_ctx);
- if (ret) {
- hdcp_err("AKE_Send_Cert is failed with ret, 0x%x\n", ret);
- return -1;
- }
-
- return 0;
-}
-
-static int dp_utc_ake_init(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx)
-{
- uint8_t m[525];
- size_t m_len;
- int ret;
-
- ret = dp_cap_protocol_msg(DP_AKE_INIT, m, &m_len, tx_ctx, NULL);
- if (ret) {
- hdcp_err("AKE_Init is failed with 0x%x\n", ret);
- return -1;
- }
-
- /* check message length */
- if (m_len != DP_AKE_INIT_LEN) {
- hdcp_err("Invalid Message Length. len(%zu)\n", m_len);
- return -1;
- }
-
- return 0;
-}
-
-/* Test AKE APIs */
-static int dp_utc_ake(struct hdcp_tx_ctx *tx_ctx, struct hdcp_rx_ctx *rx_ctx,
- int *cnt, int *fail)
-{
- int ret;
-
- ret = dp_utc_ake_init(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- ret = dp_utc_ake_send_cert(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- ret = dp_utc_ake_no_stored_km(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- ret = dp_utc_ake_send_h_prime(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- ret = dp_utc_ake_send_pairing_info(tx_ctx, rx_ctx);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
-/* Test HDCP API functions */
-int dp_hdcp_protocol_self_test(void)
-{
- int total_cnt = 0, fail_cnt = 0;
-
- hdcp_info("[ AKE UTC]\n");
- if (dp_utc_ake(&g_tx_ctx, &g_rx_ctx, &total_cnt, &fail_cnt) < 0) {
- hdcp_info("AKE UTC: fail\n");
- return -1;
- } else {
- hdcp_info("AKE UTC: success\n");
- }
-
- hdcp_info("\n[ LC UTC]\n");
- if (dp_utc_lc(&g_tx_ctx, &g_rx_ctx, &total_cnt, &fail_cnt) < 0) {
- hdcp_info("LC UTC: fail\n");
- return -1;
- } else {
- hdcp_info("LC UTC: success\n");
- }
-
- hdcp_info("\n[ SKE UTC]\n");
- if (dp_utc_ske(&g_tx_ctx, &g_rx_ctx, &total_cnt, &fail_cnt) < 0) {
- hdcp_info("SKE UTC: fail\n");
- return -1;
- } else {
- hdcp_info("SKE UTC: success\n");
- }
-
- return 0;
-}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink-selftest.h b/exynos-hdcp2-dplink-selftest.h
deleted file mode 100644
index 08129e1..0000000
--- a/exynos-hdcp2-dplink-selftest.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* todo: include/soc/samsung/exynos-hdcp/dp_link/exynos-hdcp2-dplink-selftest.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-#ifndef __EXYNOS_HDCP2_DPLINK_SELFTEST_H__
-#define __EXYNOS_HDCP2_DPLINK_SELFTEST_H__
-
-int dp_hdcp_protocol_self_test(void);
-
-#endif
diff --git a/exynos-hdcp2-dplink.c b/exynos-hdcp2-dplink.c
index 559ccfe..3367458 100644
--- a/exynos-hdcp2-dplink.c
+++ b/exynos-hdcp2-dplink.c
@@ -13,7 +13,7 @@
#include <linux/uaccess.h>
#include <linux/smc.h>
#include <asm/cacheflush.h>
-#include <soc/samsung/exynos-smc.h>
+#include <linux/soc/samsung/exynos-smc.h>
#include <linux/types.h>
#include <linux/delay.h>
@@ -23,18 +23,11 @@
#include "exynos-hdcp2-dplink-if.h"
#include "exynos-hdcp2-dplink-auth.h"
#include "exynos-hdcp2-dplink-inter.h"
+#include "exynos-hdcp2-teeif.h"
#define HDCP_AUTH_RETRY_COUNT 5
#define RECVID_WAIT_RETRY_COUNT 5
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
-int dplink_emul_handler(int cmd)
-{
- /* todo: support hdcp22 emulator */
- return 0;
-}
-#endif
-
static DEFINE_MUTEX(hdcp_auth_mutex);
/* current link data */
static struct hdcp_link_data *lk_data;
@@ -141,13 +134,8 @@ int do_dplink_auth(struct hdcp_link_info *lk_handle)
if (dplink_evaluate_repeater(lk_data) == TRUE) {
/* if it is a repeater, verify Rcv ID list */
UPDATE_LINK_STATE(lk_data, LINK_ST_A6_WAIT_RECEIVER_ID_LIST);
-#if defined(CONFIG_HDCP2_FUNC_TEST_MODE)
- hdcp_enabled = 1;
- hdcp_info("it`s func test mode.\n");
-#else
hdcp_info("It`s repeater link !\n");
hdcp_enabled = 0;
-#endif
} else {
/* if it is not a repeater, complete authentication */
UPDATE_LINK_STATE(lk_data, LINK_ST_A5_AUTHENTICATED);
@@ -161,7 +149,7 @@ int do_dplink_auth(struct hdcp_link_info *lk_handle)
if (hdcp_enabled)
hdcp_dplink_config(DP_HDCP22_ENABLE);
/* Transmitter has completed the authentication protocol */
- ret = exynos_smc(SMC_DRM_HDCP_AUTH_INFO, DP_HDCP22_ENABLE, 0, 0);
+ ret = hdcp_tee_send_cmd(HDCP_CMD_AUTH_DONE);
return HDCP_SUCCESS;
case LINK_ST_A6_WAIT_RECEIVER_ID_LIST:
rval = dplink_wait_for_receiver_id_list(lk_data);
@@ -293,5 +281,3 @@ int hdcp_dplink_stream_manage(void)
/* todo: update stream manage information */
return 0;
}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-dplink.h b/exynos-hdcp2-dplink.h
index 5f909b6..6318c82 100644
--- a/exynos-hdcp2-dplink.h
+++ b/exynos-hdcp2-dplink.h
@@ -12,10 +12,6 @@
#include "exynos-hdcp2.h"
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
-int dplink_emul_handler(int cmd);
-#endif
-
enum auth_signal {
HDCP_DRM_OFF = 0x100,
HDCP_DRM_ON = 0x200,
diff --git a/exynos-hdcp2-encrypt.c b/exynos-hdcp2-encrypt.c
deleted file mode 100644
index b7cd23b..0000000
--- a/exynos-hdcp2-encrypt.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-encrypt.c
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include "exynos-hdcp2-protocol-msg.h"
-#include "exynos-hdcp2-log.h"
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-static void OS2BN(uint32_t *pdRes, uint8_t *pbSrc, size_t uSrcLen)
-{
- int i;
-
- for (i = 0; i < uSrcLen; i += 4)
- pdRes[i/4] = pbSrc[uSrcLen-i-1] ^ (pbSrc[uSrcLen-i-2]<<8)
- ^ (pbSrc[uSrcLen-i-3]<<16)
- ^ (pbSrc[uSrcLen-i-4]<<24);
-}
-
-static void BN2OS(uint8_t *pbRes, uint32_t *pdSrc, size_t uSrcLen)
-{
- int i;
-
- for (i = 0; i < uSrcLen; i++) {
- pbRes[4*i+0] = (uint8_t) (pdSrc[uSrcLen-1-i] >> 24);
- pbRes[4*i+1] = (uint8_t) (pdSrc[uSrcLen-1-i] >> 16);
- pbRes[4*i+2] = (uint8_t) (pdSrc[uSrcLen-1-i] >> 8);
- pbRes[4*i+3] = (uint8_t) (pdSrc[uSrcLen-1-i]);
- }
-}
-
-static uint32_t sec_bn_Add(uint32_t *pdDst, uint32_t *pdSrc1, size_t uSrcLen1,
- uint32_t *pdSrc2, size_t uSrcLen2)
-{
- int i;
- uint32_t carry, tmp;
-
- for (carry = i = 0; i < uSrcLen2; i++) {
- if ((pdSrc2[i] == 0xff) && (carry == 1))
- pdDst[i] = pdSrc1[i];
- else {
- tmp = pdSrc2[i] + carry;
- pdDst[i] = pdSrc1[i] + tmp;
- carry = ((pdDst[i]) < tmp) ? 1 : 0;
- }
- }
-
- for (i = uSrcLen2; i < uSrcLen1; i++) {
- pdDst[i] += carry;
- if (pdDst[i] >= carry)
- carry = 0;
- else
- carry = 1;
- }
-
- return carry;
-}
-
-static int make_priv_data(uint8_t *priv_data, uint8_t *str_ctr, uint8_t *input_ctr)
-{
- uint8_t marker_bit;
-
- marker_bit = 0x1;
-
- priv_data[0] = 0x0;
- priv_data[1] = (str_ctr[0] >> 5) | marker_bit;
- priv_data[2] = (str_ctr[0] << 2) ^ (str_ctr[1] >> 6);
- priv_data[3] = ((str_ctr[1] << 2) ^ (str_ctr[2] >> 6)) | marker_bit;
- priv_data[4] = (str_ctr[2] << 1) ^ (str_ctr[3] >> 7);
- priv_data[5] = (str_ctr[3] << 1) | marker_bit;
- priv_data[6] = 0x0;
- priv_data[7] = (input_ctr[0] >> 3) | marker_bit;
- priv_data[8] = (input_ctr[0] << 4) ^ (input_ctr[1] >> 4);
- priv_data[9] = ((input_ctr[1] << 4) ^ (input_ctr[2] >> 4)) | marker_bit;
- priv_data[10] = (input_ctr[2] << 3) ^ (input_ctr[3] >> 5);
- priv_data[11] = ((input_ctr[3] << 3) ^ (input_ctr[4] >> 5)) | marker_bit;
- priv_data[12] = (input_ctr[4] << 2) ^ (input_ctr[5] >> 6);
- priv_data[13] = ((input_ctr[5] << 2) ^ (input_ctr[6] >> 6)) | marker_bit;
- priv_data[14] = (input_ctr[6] << 1) ^ (input_ctr[7] >> 7);
- priv_data[15] = (input_ctr[7] << 1) | marker_bit;
-
- return 0;
-}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-encrypt.h b/exynos-hdcp2-encrypt.h
deleted file mode 100644
index d87a7a7..0000000
--- a/exynos-hdcp2-encrypt.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-encrypt.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-#ifndef __EXYNOS_HDCP2_ENCRYPT_H__
-#define __EXYNOS_HDCP2_ENCRYPT_H__
-
-#include <linux/types.h>
-#include "exynos-hdcp2-protocol-msg.h"
-
-#define HDCP_PRIVATE_DATA_LEN 16 /* PES priv_data length */
-
-#endif
diff --git a/exynos-hdcp2.c b/exynos-hdcp2-main.c
index 1afa7e8..68e6858 100644
--- a/exynos-hdcp2.c
+++ b/exynos-hdcp2-main.c
@@ -13,14 +13,13 @@
#include <linux/uaccess.h>
#include <linux/smc.h>
#include <asm/cacheflush.h>
-#include <soc/samsung/exynos-smc.h>
+#include <linux/soc/samsung/exynos-smc.h>
#include "exynos-hdcp2-teeif.h"
-#include "exynos-hdcp2-encrypt.h"
#include "exynos-hdcp2-log.h"
#include "exynos-hdcp2-dplink-if.h"
#include "exynos-hdcp2-dplink.h"
-#include "exynos-hdcp2-dplink-selftest.h"
#include "exynos-hdcp2-dplink-inter.h"
+#include "exynos-hdcp2-selftest.h"
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
@@ -33,7 +32,6 @@
static struct miscdevice hdcp;
struct device *device_hdcp;
static DEFINE_MUTEX(hdcp_lock);
-enum hdcp_result hdcp_link_ioc_authenticate(void);
extern enum dp_state dp_hdcp_state;
struct hdcp_ctx {
@@ -48,43 +46,17 @@ struct hdcp_ctx {
static struct hdcp_ctx h_ctx;
static uint32_t inst_num;
-static long hdcp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+static ssize_t hdcp_write(struct file *file, const char __user *buf,
+ size_t len, loff_t *ppos)
{
- int rval;
-
- switch (cmd) {
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
- case (uint32_t)HDCP_IOC_EMUL_DPLINK_TX:
- {
- uint32_t emul_cmd;
-
- if (copy_from_user(&emul_cmd, (void __user *)arg, sizeof(uint32_t)))
- return -EINVAL;
-
- return dplink_emul_handler(emul_cmd);
- }
-#endif
- case (uint32_t)HDCP_IOC_DPLINK_TX_AUTH:
- {
-#if defined(CONFIG_HDCP2_EMULATION_MODE)
-#if defined(CONFIG_HDCP2_DP_ENABLE)
- rval = dp_hdcp_protocol_self_test();
- if (rval) {
- hdcp_err("DP self_test fail. errno(%d)\n", rval);
- return rval;
- }
- hdcp_err("DP self_test success!!\n");
-#endif
-#endif
- rval = 0;
- return rval;
- }
-
- default:
- hdcp_err("HDCP: Invalid IOC num(%d)\n", cmd);
- return -ENOTTY;
- }
+ hdcp_info("Kicking off selftest\n");
+ dp_hdcp_protocol_self_test();
+ return len;
+}
+static ssize_t hdcp_read(struct file *filp, char __user *buf,
+ size_t count, loff_t *f_pos)
+{
return 0;
}
@@ -125,15 +97,13 @@ static int hdcp_release(struct inode *inode, struct file *file)
static void exynos_hdcp_worker(struct work_struct *work)
{
- int ret;
-
if (dp_hdcp_state == DP_DISCONNECT) {
hdcp_err("dp_disconnected\n");
return;
}
hdcp_info("Exynos HDCP interrupt occur by LDFW.\n");
- ret = hdcp_dplink_auth_check(HDCP_DRM_ON);
+ hdcp_dplink_auth_check(HDCP_DRM_ON);
}
static irqreturn_t exynos_hdcp_irq_handler(int irq, void *dev_id)
@@ -188,9 +158,10 @@ static int exynos_hdcp_probe(struct platform_device *pdev)
/* Set workqueue for Secure log as bottom half */
INIT_DELAYED_WORK(&h_ctx.work, exynos_hdcp_worker);
h_ctx.enabled = true;
- err = exynos_smc(SMC_HDCP_NOTIFY_INTR_NUM, 0, 0, hwirq);
- hdcp_info("Exynos HDCP driver probe done! (%d)\n", err);
+ err = hdcp_tee_notify_intr_num(hwirq);
+
+ hdcp_info("Exynos HDCP driver probe done! (%d)\n", err);
return err;
}
@@ -222,17 +193,7 @@ static int __init hdcp_init(void)
}
hdcp_session_list_init();
-#if defined(CONFIG_HDCP2_DP_ENABLE)
- if (hdcp_dplink_init() < 0) {
- hdcp_err("hdcp_dplink_init fail\n");
- return -EINVAL;
- }
-#endif
- ret = hdcp_tee_open();
- if (ret) {
- hdcp_err("hdcp_tee_open fail\n");
- return -EINVAL;
- }
+ hdcp_tee_init();
return platform_driver_register(&exynos_hdcp_driver);
}
@@ -250,10 +211,10 @@ static void __exit hdcp_exit(void)
static const struct file_operations hdcp_fops = {
.owner = THIS_MODULE,
+ .write = hdcp_write,
+ .read = hdcp_read,
.open = hdcp_open,
.release = hdcp_release,
- .compat_ioctl = hdcp_ioctl,
- .unlocked_ioctl = hdcp_ioctl,
};
static struct miscdevice hdcp = {
@@ -267,4 +228,4 @@ module_exit(hdcp_exit);
MODULE_DESCRIPTION("Exynos Secure hdcp driver");
MODULE_AUTHOR("<hakmin_1.kim@samsung.com>");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
diff --git a/exynos-hdcp2-misc.c b/exynos-hdcp2-misc.c
deleted file mode 100644
index 920a683..0000000
--- a/exynos-hdcp2-misc.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-misc.c
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-void hdcp_hexdump(uint8_t *buf, size_t len)
-{
- int i;
-
- for (i = 0; i < len; i++) {
- if (i > 0 && !(i % 16))
- printk(KERN_ERR "\n");
- printk(KERN_ERR "%02x ", buf[i]);
- }
- printk(KERN_ERR "\n");
-}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-misc.h b/exynos-hdcp2-misc.h
deleted file mode 100644
index 4f71247..0000000
--- a/exynos-hdcp2-misc.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* drivers/soc/samsung/exynos-hdcp/exynos-hdcp2-misc.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-#ifndef __EXYNOS_HDCP2_MISC_H__
-#define __EXYNOS_HDCP2_MISC_H__
-
-void hdcp_hexdump(uint8_t *buf, size_t len);
-
-#endif
diff --git a/exynos-hdcp2-protocol-msg.c b/exynos-hdcp2-protocol-msg.c
index 3fdf956..e87f151 100644
--- a/exynos-hdcp2-protocol-msg.c
+++ b/exynos-hdcp2-protocol-msg.c
@@ -10,12 +10,10 @@
*/
#include <linux/kernel.h>
-#include "exynos-hdcp2-config.h"
#include "exynos-hdcp2-protocol-msg.h"
#include "exynos-hdcp2-teeif.h"
#include "exynos-hdcp2.h"
#include "exynos-hdcp2-log.h"
-#include "exynos-hdcp2-misc.h"
#include "exynos-hdcp2-dplink-protocol-msg.h"
int ske_generate_sessionkey(uint32_t lk_type, uint8_t *enc_skey, int share_skey)
@@ -135,88 +133,12 @@ int ake_find_masterkey(int *found_km,
{
int ret;
- ret = teei_get_pairing_info(ekh_mkey, ekh_mkey_len, m, m_len);
+ ret = teei_get_pairing_info(ekh_mkey, ekh_mkey_len, m, m_len, found_km);
if (ret) {
- if (ret == E_HDCP_PRO_INVALID_RCV_ID) {
- hdcp_info("RCV id is not found\n");
- *found_km = 0;
- return 0;
- } else {
- *found_km = 0;
- hdcp_err("teei_store_pairing_info() is failed with %x\n", ret);
- return ERR_FIND_MASTERKEY;
- }
- }
-
- *found_km = 1;
-
- return 0;
-}
-
-int parse_rcvid_list(uint8_t *msg, struct hdcp_tx_ctx *tx_ctx)
-{
- /* get PRE META values */
- tx_ctx->rpauth_info.devs_exd = (uint8_t)*msg;
- tx_ctx->rpauth_info.cascade_exd = (uint8_t)*(msg + 1);
-
- /* get META values */
- msg += HDCP_RP_RCV_LIST_PRE_META_LEN;
- tx_ctx->rpauth_info.devs_count = (uint8_t)*msg;
- tx_ctx->rpauth_info.depth = (uint8_t)*(msg + 1);
- tx_ctx->rpauth_info.hdcp2_down = (uint8_t)*(msg + 2);
- tx_ctx->rpauth_info.hdcp1_down = (uint8_t)*(msg + 3);
- memcpy(tx_ctx->rpauth_info.seq_num_v, (uint8_t *)(msg + 4), 3);
- memcpy(tx_ctx->rpauth_info.v_prime, (uint8_t *)(msg + 7), 16);
-
- /* get receiver ID list */
- msg += HDCP_RP_RCV_LIST_META_LEN;
- if (tx_ctx->rpauth_info.devs_count > HDCP_RCV_DEVS_COUNT_MAX) {
- hdcp_err("invalid DEVS count (%d)\n", tx_ctx->rpauth_info.devs_count);
- return -1;
+ *found_km = 0;
+ hdcp_err("teei_store_pairing_info() is failed with %x\n", ret);
+ return ERR_FIND_MASTERKEY;
}
- memcpy(tx_ctx->rpauth_info.u_rcvid.arr, msg, tx_ctx->rpauth_info.devs_count * HDCP_RCV_ID_LEN);
-
return 0;
}
-
-void convert_rcvlist2authmsg(struct hdcp_rpauth_info *rpauth_info, uint8_t *src_msg, size_t *msg_len)
-{
- int i;
- *msg_len = 0;
-
- for (i = 0; i < rpauth_info->devs_count; i++) {
- memcpy(src_msg + *msg_len, rpauth_info->u_rcvid.arr[i], HDCP_RCV_ID_LEN);
- *msg_len += HDCP_RCV_ID_LEN;
- }
-
- /* concatinate DEPTH */
- memcpy(src_msg + *msg_len, &rpauth_info->depth, 1);
- *msg_len += 1;
-
- /* concatinate DEVICE COUNT */
- memcpy(src_msg + *msg_len, &rpauth_info->devs_count, 1);
- *msg_len += 1;
-
- /* concatinate MAX DEVS EXCEEDED */
- memcpy(src_msg + *msg_len, &rpauth_info->devs_exd, 1);
- *msg_len += 1;
-
- /* concatinate MAX CASCADE EXCEEDED */
- memcpy(src_msg + *msg_len, &rpauth_info->cascade_exd, 1);
- *msg_len += 1;
-
- /* concatinate HDCP2 REPEATER DOWNSTREAM */
- memcpy(src_msg + *msg_len, &rpauth_info->hdcp2_down, 1);
- *msg_len += 1;
-
- /* concatinate HDCP1 DEVICE DOWNSTREAM */
- memcpy(src_msg + *msg_len, &rpauth_info->hdcp1_down, 1);
- *msg_len += 1;
-
- /* concatinate seq_num_v */
- memcpy(src_msg + *msg_len, &rpauth_info->seq_num_v, 3);
- *msg_len += 3;
-}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-selftest.c b/exynos-hdcp2-selftest.c
new file mode 100644
index 0000000..8596a81
--- /dev/null
+++ b/exynos-hdcp2-selftest.c
@@ -0,0 +1,280 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Platform device driver for HDCP selftest.
+ *
+ * Copyright (C) 2023 Google LLC
+ */
+
+#include "exynos-hdcp2-selftest.h"
+
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include <linux/soc/samsung/exynos-smc.h>
+
+#include "exynos-hdcp2.h"
+#include "exynos-hdcp2-dplink.h"
+#include "exynos-hdcp2-dplink-if.h"
+#include "exynos-hdcp2-dplink-inter.h"
+#include "exynos-hdcp2-dplink-reg.h"
+#include "exynos-hdcp2-dplink-protocol-msg.h"
+#include "exynos-hdcp2-teeif.h"
+#include "exynos-hdcp2.h"
+#include "exynos-hdcp2-log.h"
+
+static const uint8_t cert_rx[] = {
+ 0x74, 0x5b, 0xb8, 0xbd, 0x04, 0xaf, 0xb5, 0xc5, 0xc6, 0x7b, 0xc5, 0x3a,
+ 0x34, 0x90, 0xa9, 0x54, 0xc0, 0x8f, 0xb7, 0xeb, 0xa1, 0x54, 0xd2, 0x4f,
+ 0x22, 0xde, 0x83, 0xf5, 0x03, 0xa6, 0xc6, 0x68, 0x46, 0x9b, 0xc0, 0xb8,
+ 0xc8, 0x6c, 0xdb, 0x26, 0xf9, 0x3c, 0x49, 0x2f, 0x02, 0xe1, 0x71, 0xdf,
+ 0x4e, 0xf3, 0x0e, 0xc8, 0xbf, 0x22, 0x9d, 0x04, 0xcf, 0xbf, 0xa9, 0x0d,
+ 0xff, 0x68, 0xab, 0x05, 0x6f, 0x1f, 0x12, 0x8a, 0x68, 0x62, 0xeb, 0xfe,
+ 0xc9, 0xea, 0x9f, 0xa7, 0xfb, 0x8c, 0xba, 0xb1, 0xbd, 0x65, 0xac, 0x35,
+ 0x9c, 0xa0, 0x33, 0xb1, 0xdd, 0xa6, 0x05, 0x36, 0xaf, 0x00, 0xa2, 0x7f,
+ 0xbc, 0x07, 0xb2, 0xdd, 0xb5, 0xcc, 0x57, 0x5c, 0xdc, 0xc0, 0x95, 0x50,
+ 0xe5, 0xff, 0x1f, 0x20, 0xdb, 0x59, 0x46, 0xfa, 0x47, 0xc4, 0xed, 0x12,
+ 0x2e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xff, 0x78, 0x92, 0x7f,
+ 0xa1, 0x7c, 0xa8, 0xfc, 0xb7, 0xf7, 0xa8, 0x52, 0xa9, 0xc6, 0x84, 0x72,
+ 0x3d, 0x1c, 0xc9, 0xdf, 0x35, 0xc6, 0xe6, 0x00, 0xe1, 0x48, 0x72, 0xce,
+ 0x83, 0x1b, 0xcc, 0xf8, 0x33, 0x2d, 0x4f, 0x98, 0x75, 0x00, 0x3c, 0x41,
+ 0xdf, 0x7a, 0xed, 0x38, 0x53, 0xb1 };
+static const uint8_t Rrx[] = { 0x3b, 0xa0, 0xbe, 0xde, 0x0c, 0x46, 0xa9, 0x91 };
+static const uint8_t RxCaps[] = { 0x02, 0x00, 0x03 };
+static const uint8_t Hprime[] = {
+ 0x2e, 0xf5, 0xed, 0xf8, 0x7f, 0xd8, 0xa3, 0xd0, 0xf4, 0xa9, 0xd8, 0xac,
+ 0x3a, 0xd0, 0xb4, 0x56, 0x2e, 0x32, 0x19, 0x11, 0x41, 0x16, 0xf1, 0xef,
+ 0x0f, 0x02, 0x3d, 0x3a, 0x78, 0xe2, 0x2a, 0xc6 };
+static const uint8_t Ekh_km_r[] = { 0xb8, 0x9f, 0xf9, 0x72, 0x6a, 0x6f, 0x2c, 0x1e,
+ 0x29, 0xb6, 0x44, 0x8d, 0xdc, 0xa3, 0x10, 0xbd };
+static const uint8_t Lprime[] = {
+ 0xbc, 0x20, 0x92, 0x33, 0x54, 0x91, 0xc1, 0x9e, 0xa4, 0xde, 0x8b, 0x30,
+ 0x49, 0xc2, 0x06, 0x6a, 0xd8, 0x11, 0xa2, 0x2a, 0xb1, 0x46, 0xdf, 0x74,
+ 0x58, 0x47, 0x05, 0xa8, 0xb7, 0x67, 0xfb, 0xdd };
+static const uint8_t RxInfo[] = { 0x02, 0x31 };
+static const uint8_t seq_num_V[] = { 0x0, 0x0, 0x0 };
+static const uint8_t Vprime[] = { 0xbc, 0xcc, 0x7d, 0x16, 0xe6, 0xbc, 0xb9, 0x02,
+ 0x60, 0x08, 0x1d, 0xf7, 0x4a, 0xb4, 0x5c, 0x8a };
+static const uint8_t Rec_ID_list[] = { 0x47, 0x8e, 0x71, 0xe2, 0x0f,
+ 0x35, 0x79, 0x6a, 0x17, 0x0e,
+ 0x74, 0xe8, 0x53, 0x97, 0xa2 };
+static const uint8_t Mprime[] = {
+ 0xdd, 0x26, 0xe9, 0x52, 0x6e, 0x0e, 0x1d, 0x69, 0xc8, 0x84, 0xe4, 0xcc,
+ 0xc8, 0x09, 0xaa, 0xc7, 0x71, 0xe9, 0x97, 0xb5, 0x61, 0x89, 0x09, 0x6e,
+ 0x4d, 0x94, 0x24, 0xc2, 0x1b, 0x64, 0x58, 0xc6 };
+static const uint8_t RxStatus[] = { DP_RXSTATUS_READY |
+ DP_RXSTATUS_HPRIME_AVAILABLE |
+ DP_RXSTATUS_PAIRING_AVAILABLE };
+
+static int pdp_dpcd_read_for_hdcp22_emu(u32 address, u32 length, u8 *data)
+{
+ int ret = 0;
+
+ const size_t banks[] = {
+ DPCD_ADDR_HDCP22_cert_rx, DPCD_ADDR_HDCP22_Rrx,
+ DPCD_ADDR_HDCP22_RxCaps, DPCD_ADDR_HDCP22_Hprime,
+ DPCD_ADDR_HDCP22_Ekh_km_r, DPCD_ADDR_HDCP22_Lprime,
+ DPCD_ADDR_HDCP22_RxInfo, DPCD_ADDR_HDCP22_seq_num_V,
+ DPCD_ADDR_HDCP22_Vprime, DPCD_ADDR_HDCP22_Rec_ID_list,
+ DPCD_ADDR_HDCP22_Mprime, DPCD_ADDR_HDCP22_RxStatus };
+ const size_t banks_size[] = {
+ sizeof(cert_rx), sizeof(Rrx), sizeof(RxCaps),
+ sizeof(Hprime), sizeof(Ekh_km_r), sizeof(Lprime),
+ sizeof(RxInfo), sizeof(seq_num_V), sizeof(Vprime),
+ sizeof(Rec_ID_list), sizeof(Mprime),
+ sizeof(RxStatus) };
+ const uint8_t *bank_ptr[] = {
+ cert_rx, Rrx, RxCaps, Hprime, Ekh_km_r, Lprime, RxInfo,
+ seq_num_V, Vprime, Rec_ID_list, Mprime, RxStatus };
+ size_t bank_idx;
+ size_t bank_offset = 0;
+
+ for (bank_idx = ARRAY_SIZE(banks) - 1; bank_idx >= 0; --bank_idx) {
+ if (address >= banks[bank_idx]) {
+ bank_offset = address - banks[bank_idx];
+ break;
+ }
+ }
+
+ if (bank_offset + length > banks_size[bank_idx]) {
+ hdcp_err("read impossible for DPCD[%x] with length(%u) as it "
+ "exceeds bank size (%zu) for bank(%zu)\n",
+ address, length, banks_size[bank_idx], bank_idx);
+ return -1;
+ }
+
+ memcpy(data, bank_ptr[bank_idx] + bank_offset, length);
+ return ret;
+}
+
+static const uint8_t Rtx[] = {0x18, 0xfa, 0xe4, 0x20, 0x6a, 0xfb, 0x51, 0x49};
+static const uint8_t TxCaps[] = {0x02, 0x00, 0x00};
+static const uint8_t Ekpub_km[] = {
+ 0x9b, 0x9f, 0x80, 0x19, 0xad, 0x0e, 0xa2, 0xf0, 0xdd, 0xa0, 0x29, 0x33,
+ 0xd9, 0x6d, 0x1c, 0x77, 0x31, 0x37, 0x57, 0xe0, 0xe5, 0xb2, 0xbd, 0xdd,
+ 0x36, 0x3e, 0x38, 0x4e, 0x7d, 0x40, 0x78, 0x66, 0x97, 0x7a, 0x4c, 0xce,
+ 0xc5, 0xc7, 0x5d, 0x01, 0x57, 0x26, 0xcc, 0xa2, 0xf6, 0xde, 0x34, 0xdd,
+ 0x29, 0xbe, 0x5e, 0x31, 0xe8, 0xf1, 0x34, 0xe8, 0x1a, 0x63, 0xa3, 0x6d,
+ 0x46, 0xdc, 0x0a, 0x06, 0x08, 0x99, 0x9d, 0xdb, 0x3c, 0xa2, 0x9c, 0x04,
+ 0xdd, 0x4e, 0xd9, 0x02, 0x7d, 0x20, 0x54, 0xec, 0xca, 0x86, 0x42, 0x1b,
+ 0x18, 0xda, 0x30, 0x9c, 0xc4, 0xcb, 0xac, 0xb4, 0x54, 0xde, 0x84, 0x68,
+ 0x71, 0x53, 0x6d, 0x92, 0x17, 0xca, 0x08, 0x8a, 0x7a, 0xf9, 0x98, 0x9a,
+ 0xb6, 0x7b, 0x22, 0x92, 0xac, 0x7d, 0x0d, 0x6b, 0xd6, 0x7f, 0x31, 0xab,
+ 0xf0, 0x10, 0xc5, 0x2a, 0x0f, 0x6d, 0x27, 0xa0 };
+static const uint8_t Ekh_km_w[] = {
+ 0xb8, 0x9f, 0xf9, 0x72, 0x6a, 0x6f, 0x2c, 0x1e, 0x29, 0xb6, 0x44, 0x8d,
+ 0xdc, 0xa3, 0x10, 0xbd };
+static const uint8_t m[] = {
+ 0x18, 0xfa, 0xe4, 0x20, 0x6a, 0xfb, 0x51, 0x49, 0x3b, 0xa0, 0xbe, 0xde,
+ 0x0c, 0x46, 0xa9, 0x91 };
+static const uint8_t rn[] = { 0x32, 0x75, 0x3e, 0xa8, 0x78, 0xa6, 0x38, 0x1c };
+static const uint8_t Edkey0_ks[] = {
+ 0x4c, 0x32, 0x47, 0x12, 0xc4, 0xbe, 0xc6, 0x69 };
+static const uint8_t Edkey1_ks[] = {
+ 0x0a, 0xc2, 0x19, 0x64, 0xde, 0x91, 0xf1, 0x83 };
+static const uint8_t riv[] = { 0x40, 0x2b, 0x6b, 0x43, 0xc5, 0xe8, 0x86, 0xd8 };
+static const uint8_t V[] = { 0x63, 0x6d, 0xc5, 0x08, 0x4d, 0x6c, 0xb1, 0x0e,
+ 0x93, 0xa5, 0x28, 0x67, 0x0f, 0x34, 0x1f, 0x88 };
+static const uint8_t seq_num_M[] = { 0x0, 0x0, 0x0 };
+static const uint8_t k[] = { 0x0, 0x1 };
+static const uint8_t stream_IDtype[] = { 0x0, 0x1 };
+
+static int pdp_dpcd_write_for_hdcp22_emu(u32 address, u32 length, u8 *data)
+{
+ size_t i;
+ const size_t banks[] = {
+ DPCD_ADDR_HDCP22_Rtx, DPCD_ADDR_HDCP22_TxCaps,
+ DPCD_ADDR_HDCP22_Ekpub_km, DPCD_ADDR_HDCP22_Ekh_km_w,
+ DPCD_ADDR_HDCP22_m, DPCD_ADDR_HDCP22_rn,
+ DPCD_ADDR_HDCP22_Edkey0_ks, DPCD_ADDR_HDCP22_Edkey1_ks,
+ DPCD_ADDR_HDCP22_riv, DPCD_ADDR_HDCP22_V,
+ DPCD_ADDR_HDCP22_seq_num_M, DPCD_ADDR_HDCP22_k,
+ DPCD_ADDR_HDCP22_stream_IDtype, DPCD_ADDR_HDCP22_Type };
+ const size_t banks_size[] = {
+ sizeof(Rtx), sizeof(TxCaps), sizeof(Ekpub_km), sizeof(Ekh_km_w),
+ sizeof(m), sizeof(rn), sizeof(Edkey0_ks), sizeof(Edkey1_ks),
+ sizeof(riv), sizeof(V), sizeof(seq_num_M), sizeof(k),
+ sizeof(stream_IDtype), 0 };
+ const uint8_t *bank_ptr[] = {
+ Rtx, TxCaps, Ekpub_km, Ekh_km_w, m, rn, Edkey0_ks,
+ Edkey1_ks, riv, V, seq_num_M, k, stream_IDtype, NULL };
+ size_t bank_idx;
+ size_t bank_offset = 0;
+
+ for (bank_idx = ARRAY_SIZE(banks) - 1; bank_idx >= 0; --bank_idx) {
+ if (address >= banks[bank_idx]) {
+ bank_offset = address - banks[bank_idx];
+ break;
+ }
+ }
+
+ if (bank_offset + length > banks_size[bank_idx]) {
+ hdcp_err("write impossible for DPCD[%x] with length(%u) as it "
+ "exceeds bank size (%zu) for bank(%zu)\n",
+ address, length, banks_size[bank_idx], bank_idx);
+ return -1;
+ }
+
+ if (memcmp(data, bank_ptr[bank_idx] + bank_offset, length) != 0) {
+ hdcp_err("unexpected write for DPCD[%08x] with length(%u) to"
+ "bank(%zu)\n", address, length, bank_idx);
+ for (i = 0; i < length; ++i) {
+ hdcp_err("%02x %02x\n", *(data + i),
+ *(bank_ptr[bank_idx] + bank_offset + i));
+ }
+ return -1;
+ }
+
+ return 0;
+}
+
+static void pdp_hdcp22_enable_emu(u32 en)
+{
+ return;
+}
+
+static int dp_hdcp_protocol_self_test_internal(void) {
+ size_t i;
+ int rc, version;
+
+ hdcp_dplink_connect_state(DP_CONNECT);
+
+ rc = hdcp_tee_send_cmd(HDCP_CMD_AUTH_START);
+ if (rc) {
+ hdcp_err("starting authentication failed: %d", rc);
+ return rc;
+ }
+
+ version = -1;
+ for (i = 0; i < 50; ++i) {
+ rc = hdcp_tee_check_protection(&version);
+ if (rc) {
+ hdcp_err("checking protection failed: %d", rc);
+ return rc;
+ }
+ if (version != -1)
+ break;
+ msleep(100);
+ }
+
+ if (version != 4) {
+ hdcp_err("FAIL selftest: %d\n", version);
+ return -1;
+ }
+
+ hdcp_info("SUCCESS selftest\n");
+ return 0;
+}
+
+int dp_hdcp_protocol_self_test(void) {
+ int rc;
+
+ rc = exynos_smc(SMC_HDCP_NOTIFY_INTR_NUM, 1, 0, 0);
+ if (!rc) {
+ hdcp_err("expected direct smc call to fail\n");
+ return rc;
+ }
+
+ dp_register_func_for_hdcp22(pdp_hdcp22_enable_emu,
+ pdp_dpcd_read_for_hdcp22_emu,
+ pdp_dpcd_write_for_hdcp22_emu);
+
+ rc = hdcp_tee_set_test_mode(true);
+ if (rc) {
+ hdcp_err("setting test mode failed: %d", rc);
+ return rc;
+ }
+ rc = dp_hdcp_protocol_self_test_internal();
+ hdcp_tee_set_test_mode(false);
+
+ return rc;
+}
diff --git a/exynos-hdcp2-selftest.h b/exynos-hdcp2-selftest.h
new file mode 100644
index 0000000..ded6a1a
--- /dev/null
+++ b/exynos-hdcp2-selftest.h
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Platform device driver for HDCP selftest.
+ *
+ * Copyright (C) 2023 Google LLC
+ */
+
+#ifndef __EXYNOS_HDCP2_DPLINK_SELFTEST_H__
+#define __EXYNOS_HDCP2_DPLINK_SELFTEST_H__
+
+int dp_hdcp_protocol_self_test(void);
+
+#endif
diff --git a/exynos-hdcp2-session.c b/exynos-hdcp2-session.c
index 881746d..0874ab0 100644
--- a/exynos-hdcp2-session.c
+++ b/exynos-hdcp2-session.c
@@ -514,5 +514,3 @@ void hdcp_link_list_destroy(struct hdcp_link_list *lk_list)
lk_head->prev = lk_head;
mutex_unlock(&lk_list->lk_mutex);
}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-teeif.c b/exynos-hdcp2-teeif.c
index baa8f68..25dcfef 100644
--- a/exynos-hdcp2-teeif.c
+++ b/exynos-hdcp2-teeif.c
@@ -8,8 +8,11 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <soc/samsung/exynos-smc.h>
+#include <linux/device.h>
+#include <linux/jiffies.h>
+#include <linux/soc/samsung/exynos-smc.h>
#include <linux/slab.h>
+#include <linux/trusty/trusty_ipc.h>
#include <linux/module.h>
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
@@ -18,106 +21,258 @@
#include "exynos-hdcp2.h"
#include "exynos-hdcp2-log.h"
-extern struct device *device_hdcp;
-extern void __dma_inv_area(const void *start, size_t size);
+#define TZ_CON_TIMEOUT 5000
+#define TZ_BUF_TIMEOUT 10000
+#define TZ_MSG_TIMEOUT 10000
+#define HDCP_TA_PORT "com.android.trusty.hdcp.auth"
-static struct hci_ctx hctx = {
- .msg = NULL,
- .state = HCI_DISCONNECTED
+struct hdcp_auth_req {
+ uint32_t cmd;
+ int32_t arg;
};
+struct hdcp_auth_rsp {
+ uint32_t cmd;
+ int32_t err;
+ int32_t arg;
+};
+
+struct hdcp_tz_chan_ctx {
+ struct tipc_chan *chan;
+ struct mutex rsp_lock;
+ struct completion reply_comp;
+ struct hdcp_auth_rsp rsp;
+ struct hci_message **msg_ptr;
+};
+static struct hdcp_tz_chan_ctx hdcp_ta_ctx;
+
+static size_t deduce_num_payload(size_t msg_len)
+{
+ switch (msg_len) {
+ case (sizeof(struct hdcp_auth_rsp)):
+ return 1;
+ case (sizeof(struct hdcp_auth_rsp) + sizeof(struct hci_message)):
+ return 2;
+ default:
+ return 0;
+ }
+}
+static struct tipc_msg_buf *tz_srv_handle_msg(void *data,
+ struct tipc_msg_buf* rxbuf)
+{
+ struct hdcp_tz_chan_ctx *ctx = data;
+ size_t len;
+ size_t payload_num;
+
+ len = mb_avail_data(rxbuf);
+ payload_num = deduce_num_payload(len);
+
+ if (payload_num == 0) {
+ hdcp_err("TZ: invalid RSP buffer size (%zd)\n", len);
+ }
+
+ if (payload_num > 0) {
+ memcpy(&ctx->rsp,
+ mb_get_data(rxbuf, sizeof(struct hdcp_auth_rsp)),
+ sizeof(struct hdcp_auth_rsp));
+ }
+ if (payload_num > 1 && ctx->msg_ptr) {
+ memcpy(*ctx->msg_ptr,
+ mb_get_data(rxbuf, sizeof(struct hci_message)),
+ sizeof(struct hci_message));
+ }
+
+ complete(&ctx->reply_comp);
+
+ return rxbuf;
+}
+
+static void tz_srv_handle_event(void *data, int event)
+{
+ struct hdcp_tz_chan_ctx *ctx = data;
+ complete(&ctx->reply_comp);
+}
+
+static const struct tipc_chan_ops tz_srv_ops = {
+ .handle_msg = tz_srv_handle_msg,
+ .handle_event = tz_srv_handle_event,
+};
+
+void hdcp_tee_init(void)
+{
+ init_completion(&hdcp_ta_ctx.reply_comp);
+ mutex_init(&hdcp_ta_ctx.rsp_lock);
+ hdcp_ta_ctx.msg_ptr = NULL;
+}
+
int hdcp_tee_open(void)
{
int ret = 0;
- u64 phys_addr = 0;
+ struct tipc_chan *chan;
- if (hctx.state == HCI_CONNECTED) {
+ if (hdcp_ta_ctx.chan) {
hdcp_info("HCI is already connected\n");
return 0;
}
- /* Allocate WSM for HDCP commnad interface */
- hctx.msg = (struct hci_message *)kzalloc(sizeof(struct hci_message), GFP_KERNEL);
- if (!hctx.msg) {
- hdcp_err("alloc wsm for HDCP SWd is failed\n");
- return -ENOMEM;
+ chan = tipc_create_channel(NULL, &tz_srv_ops, &hdcp_ta_ctx);
+ if (IS_ERR(chan)) {
+ hdcp_err("TZ: failed (%ld) to create chan\n", PTR_ERR(chan));
+ return PTR_ERR(chan);
}
- /* send WSM address to SWd */
- phys_addr = virt_to_phys((void *)hctx.msg);
+ reinit_completion(&hdcp_ta_ctx.reply_comp);
+
+ ret = tipc_chan_connect(chan, HDCP_TA_PORT);
+ if (ret < 0) {
+ hdcp_err("TZ: failed (%d) to connect\n", ret);
+ tipc_chan_destroy(chan);
+ return ret;
+ }
- ret = exynos_smc(SMC_HDCP_INIT, phys_addr, sizeof(struct hci_message), 0);
- if (ret) {
- hdcp_err("Fail to set up connection with SWd. ret(%d)\n", ret);
- kfree(hctx.msg);
- hctx.msg = NULL;
- return -ECONNREFUSED;
+ hdcp_ta_ctx.chan = chan;
+ ret = wait_for_completion_timeout(&hdcp_ta_ctx.reply_comp,
+ msecs_to_jiffies(TZ_CON_TIMEOUT));
+ if (ret <= 0) {
+ ret = (!ret) ? -ETIMEDOUT : ret;
+ hdcp_err("TZ: failed (%d) to wait for connect\n", ret);
+ hdcp_tee_close();
+ return ret;
}
- hctx.state = HCI_CONNECTED;
+ return 0;
+}
+
+int hdcp_tee_close(void)
+{
+ if (!hdcp_ta_ctx.chan) {
+ hdcp_info("HCI is already disconnected\n");
+ return 0;
+ }
+ tipc_chan_shutdown(hdcp_ta_ctx.chan);
+ tipc_chan_destroy(hdcp_ta_ctx.chan);
+ hdcp_ta_ctx.chan = NULL;
return 0;
}
-int hdcp_tee_close()
+static int hdcp_tee_comm_xchg_internal(uint32_t cmd, int32_t arg,
+ int32_t *rsp, struct hci_message *hci)
{
int ret;
+ struct tipc_msg_buf *txbuf;
+ struct hdcp_auth_req auth_req;
- if (hctx.state == HCI_DISCONNECTED) {
- hdcp_info("HCI is already disconnected\n");
- return 0;
+ ret = hdcp_tee_open();
+ if (ret)
+ return ret;
+
+ txbuf = tipc_chan_get_txbuf_timeout(hdcp_ta_ctx.chan, TZ_BUF_TIMEOUT);
+ if (IS_ERR(txbuf)) {
+ hdcp_err("TZ: failed (%ld) to get txbuf\n", PTR_ERR(txbuf));
+ return PTR_ERR(txbuf);
+ }
+
+ auth_req.cmd = cmd;
+ auth_req.arg = arg;
+ memcpy(mb_put_data(txbuf, sizeof(struct hdcp_auth_req)),
+ &auth_req, sizeof(struct hdcp_auth_req));
+
+ if (hci) {
+ memcpy(mb_put_data(txbuf, sizeof(struct hci_message)),
+ hci, sizeof(struct hci_message));
+ hdcp_ta_ctx.msg_ptr = &hci;
+ } else {
+ hdcp_ta_ctx.msg_ptr = NULL;
+ }
+
+ reinit_completion(&hdcp_ta_ctx.reply_comp);
+
+ ret = tipc_chan_queue_msg(hdcp_ta_ctx.chan, txbuf);
+ if (ret < 0) {
+ hdcp_err("TZ: failed(%d) to queue msg\n", ret);
+ tipc_chan_put_txbuf(hdcp_ta_ctx.chan, txbuf);
+ hdcp_tee_close();
+ return ret;
}
- if (hctx.msg) {
- kfree(hctx.msg);
- hctx.msg = NULL;
+ ret = wait_for_completion_timeout(&hdcp_ta_ctx.reply_comp,
+ msecs_to_jiffies(TZ_MSG_TIMEOUT));
+ if (ret <= 0) {
+ ret = (!ret) ? -ETIMEDOUT : ret;
+ hdcp_err("TZ: failed (%d) to wait for reply\n", ret);
+ hdcp_tee_close();
+ return ret;
}
- /* send terminate command to SWd */
- ret = exynos_smc(SMC_HDCP_TERMINATE, 0, 0, 0);
- if (ret) {
- hdcp_err("HDCP: Fail to set up connection with SWd. ret(%d)\n", ret);
- return -EFAULT;
+ if (hdcp_ta_ctx.rsp.cmd != (cmd | HDCP_CMD_AUTH_RESP)) {
+ hdcp_err("TZ: hdcp had an unexpected rsp cmd (%x vs %x)",
+ hdcp_ta_ctx.rsp.cmd, cmd | HDCP_CMD_AUTH_RESP);
+ return -EIO;
}
- hctx.state = HCI_DISCONNECTED;
+ if (hdcp_ta_ctx.rsp.err) {
+ hdcp_err("TZ: hdcp had an unexpected rsp err (%d)",
+ hdcp_ta_ctx.rsp.err);
+ return -EIO;
+ }
+ if (rsp)
+ *rsp = hdcp_ta_ctx.rsp.arg;
return 0;
}
-int hdcp_tee_comm(struct hci_message *hci)
-{
+static int hdcp_tee_comm_xchg(uint32_t cmd, int32_t arg, int32_t *rsp,
+ struct hci_message *hci) {
int ret;
+ int retries = 2;
+
+ mutex_lock(&hdcp_ta_ctx.rsp_lock);
+ while (retries) {
+ retries--;
+ ret = hdcp_tee_comm_xchg_internal(cmd, arg, rsp, hci);
+ if (!ret) {
+ mutex_unlock(&hdcp_ta_ctx.rsp_lock);
+ return 0;
+ }
+ }
+ mutex_unlock(&hdcp_ta_ctx.rsp_lock);
- if (!hci)
- return -EINVAL;
+ return ret;
+}
- /**
- * kernel & TEE does not share cache.
- * So, cache should be flushed before sending data to TEE
- * and invalidate after come back to kernel
- */
+static irq_hw_number_t saved_hwirq = 0;
- // mark on 5.4 __flush_dcache_area((void *)hci, sizeof(struct hci_message));
- dma_map_single(device_hdcp, (void *)hci, sizeof(struct hci_message), DMA_TO_DEVICE);
- ret = exynos_smc(SMC_HDCP_PROT_MSG, 0, 0, 0);
- // mark on 5.4 __inval_dcache_area((void *)hci, sizeof(struct hci_message));
- dma_map_single(device_hdcp, (void *)hci, sizeof(struct hci_message), DMA_FROM_DEVICE);
+int hdcp_tee_send_cmd(uint32_t cmd) {
+ if (HDCP_CMD_AUTH_START == cmd)
+ hdcp_tee_comm_xchg(HDCP_CMD_NOTIFY_INTR_NUM, saved_hwirq, NULL, NULL);
+ return hdcp_tee_comm_xchg(cmd, 0, NULL, NULL);
+}
- if (ret) {
- hdcp_info("SWd returned(%x)\n", ret);
- return ret;
- }
+int hdcp_tee_check_protection(int* version) {
+ return hdcp_tee_comm_xchg(HDCP_CMD_PROTECTION_CHECK, 0, version, NULL);
+}
+int hdcp_tee_notify_intr_num(irq_hw_number_t hwirq) {
+ saved_hwirq = hwirq;
return 0;
}
+int hdcp_tee_set_test_mode(bool enable) {
+ return hdcp_tee_comm_xchg(HDCP_CMD_SET_TEST_MODE, enable, NULL, NULL);
+}
+
+static int hdcp_tee_comm(struct hci_message *hci) {
+ return hdcp_tee_comm_xchg(HDCP_CMD_PROTOCOL, 0, NULL, hci);
+}
+
int teei_gen_rtx(uint32_t lk_type,
uint8_t *rtx, size_t rtx_len,
uint8_t *caps, uint32_t caps_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
@@ -143,7 +298,8 @@ int teei_verify_cert(uint8_t *cert, size_t cert_len,
uint8_t *rx_caps, size_t rx_caps_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -165,7 +321,8 @@ int teei_verify_cert(uint8_t *cert, size_t cert_len,
int teei_generate_master_key(uint32_t lk_type, uint8_t *emkey, size_t emkey_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -187,7 +344,8 @@ int teei_generate_master_key(uint32_t lk_type, uint8_t *emkey, size_t emkey_len)
int teei_compare_ake_hmac(uint8_t *rx_hmac, size_t rx_hmac_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -204,7 +362,8 @@ int teei_compare_ake_hmac(uint8_t *rx_hmac, size_t rx_hmac_len)
int teei_set_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
@@ -220,10 +379,12 @@ int teei_set_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len)
}
int teei_get_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len,
- uint8_t *m, size_t m_len)
+ uint8_t *m, size_t m_len,
+ int *found)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
@@ -236,6 +397,7 @@ int teei_get_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len,
memcpy(ekh_mkey, hci->getpairing.ekh_mkey, ekh_mkey_len);
memcpy(m, hci->getpairing.m, m_len);
+ *found = hci->getpairing.found ? 1 : 0;
return ret;
}
@@ -243,7 +405,8 @@ int teei_get_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len,
int teei_gen_rn(uint8_t *out, size_t len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
@@ -264,7 +427,8 @@ int teei_gen_rn(uint8_t *out, size_t len)
int teei_compare_lc_hmac(uint8_t *rx_hmac, size_t rx_hmac_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -281,7 +445,8 @@ int teei_compare_lc_hmac(uint8_t *rx_hmac, size_t rx_hmac_len)
int teei_generate_riv(uint8_t *out, size_t len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
@@ -304,7 +469,8 @@ int teei_generate_skey(uint32_t lk_type,
int share_skey)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -332,7 +498,8 @@ int teei_set_rcvlist_info(uint8_t *rx_info,
uint8_t *valid)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
hci->cmd_id = HDCP_TEEI_SET_RCV_ID_LIST;
@@ -364,7 +531,8 @@ int teei_gen_stream_manage(uint16_t stream_num,
uint8_t *streamid_type)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
/* todo: input check */
/* Update TCI buffer */
@@ -389,7 +557,8 @@ int teei_gen_stream_manage(uint16_t stream_num,
int teei_verify_m_prime(uint8_t *m_prime, uint8_t *input, size_t input_len)
{
int ret = 0;
- struct hci_message *hci = hctx.msg;
+ struct hci_message msg;
+ struct hci_message *hci = &msg;
hci->cmd_id = HDCP_TEEI_VERIFY_M_PRIME;
memcpy(hci->verifymprime.m_prime, m_prime, HDCP_RP_HMAC_M_LEN);
@@ -402,38 +571,3 @@ int teei_verify_m_prime(uint8_t *m_prime, uint8_t *input, size_t input_len)
return ret;
}
-
-int teei_wrapped_key(uint8_t *key, uint32_t wrapped, uint32_t key_len)
-{
- int ret = 0;
- struct hci_message *hci = hctx.msg;
-
- hci->cmd_id = HDCP_TEEI_WRAP_KEY;
-
- if (key_len > (sizeof(hci->wrap_key.enc_key) - HDCP_WRAP_AUTH_TAG)) {
- hdcp_err("(un)wraaping key size is wrong. 0x%x\n", key_len);
- return HDCP_ERROR_WRONG_SIZE;
- }
-
- if (key_len < HDCP_WRAP_AUTH_TAG || key_len > HDCP_WRAP_MAX_SIZE - HDCP_WRAP_AUTH_TAG)
- return HDCP_ERROR_WRONG_SIZE;
-
- if (wrapped == UNWRAP)
- memcpy(hci->wrap_key.enc_key, key, key_len + HDCP_WRAP_AUTH_TAG);
- else
- memcpy(hci->wrap_key.key, key, key_len);
-
- hci->wrap_key.wrapped = wrapped;
- hci->wrap_key.key_len = key_len;
-
- if ((ret = hdcp_tee_comm(hci)) < 0)
- return ret;
-
- if (hci->wrap_key.wrapped == WRAP) {
- memcpy(key, hci->wrap_key.enc_key, key_len + HDCP_WRAP_AUTH_TAG);
- }
-
- return ret;
-}
-
-MODULE_LICENSE("GPL");
diff --git a/exynos-hdcp2-teeif.h b/exynos-hdcp2-teeif.h
index 5f27021..f51a4e3 100644
--- a/exynos-hdcp2-teeif.h
+++ b/exynos-hdcp2-teeif.h
@@ -33,7 +33,6 @@ enum {
HDCP_TEEI_COMPARE_LC_HMAC,
HDCP_TEEI_GEN_RIV,
HDCP_TEEI_GEN_SKEY,
- HDCP_TEEI_ENC_PACKET,
HDCP_TEEI_SET_PAIRING_INFO,
HDCP_TEEI_GET_PAIRING_INFO,
HDCP_TEEI_SET_RCV_ID_LIST,
@@ -161,6 +160,7 @@ typedef struct {
uint32_t id;
uint8_t ekh_mkey[HDCP_AKE_EKH_MKEY_BYTE_LEN];
uint8_t m[HDCP_AKE_M_BYTE_LEN];
+ uint8_t found;
} hci_getpairing_t;
typedef struct {
@@ -251,9 +251,26 @@ struct hci_ctx {
uint8_t state;
};
+enum hdcp_auth_cmd {
+ HDCP_CMD_AUTH_RESP = (1U << 31),
+ HDCP_CMD_REINIT = 0,
+ HDCP_CMD_PROTOCOL,
+ HDCP_CMD_NOTIFY_INTR_NUM,
+ HDCP_CMD_AUTH_START,
+ HDCP_CMD_AUTH_DONE,
+ HDCP_CMD_AUTH_CANCEL,
+ HDCP_CMD_PROTECTION_CHECK,
+ HDCP_CMD_SESSION_SET,
+ HDCP_CMD_SET_TEST_MODE,
+};
+
+void hdcp_tee_init(void);
int hdcp_tee_open(void);
int hdcp_tee_close(void);
-int hdcp_tee_comm(struct hci_message *hci);
+int hdcp_tee_send_cmd(uint32_t cmd);
+int hdcp_tee_notify_intr_num(irq_hw_number_t hwirq);
+int hdcp_tee_check_protection(int* version);
+int hdcp_tee_set_test_mode(bool enable);
/* HDCP TEE interfaces */
int teei_gen_rtx(uint32_t lk_type,
@@ -269,7 +286,7 @@ int teei_generate_master_key(uint32_t lk_type,
int teei_compare_ake_hmac(uint8_t *hmac, size_t hamc_len);
int teei_set_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len);
int teei_get_pairing_info(uint8_t *ekh_mkey, size_t ekh_mkey_len,
- uint8_t *m, size_t m_len);
+ uint8_t *m, size_t m_len, int* found);
/* LC interface */
int teei_gen_rn(uint8_t *out, size_t len);
@@ -292,5 +309,4 @@ int teei_gen_stream_manage(uint16_t stream_num,
uint8_t *k,
uint8_t *streamid_type);
int teei_verify_m_prime(uint8_t *m_prime, uint8_t *input, size_t input_len);
-int teei_wrapped_key(uint8_t *key_str, uint32_t wrraped, uint32_t key_len);
#endif
diff --git a/exynos-hdcp2-testvector.h b/exynos-hdcp2-testvector.h
deleted file mode 100644
index 8b6d1b9..0000000
--- a/exynos-hdcp2-testvector.h
+++ /dev/null
@@ -1,447 +0,0 @@
-/* soc/samsung/exynos-hdcp/exynos-hdcp2-testvector.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __EXYNOS_HDCP2_TEST_VECTOR_H__
-#define __EXYNOS_HDCP2_TEST_VECTOR_H__
-
-#include "exynos-hdcp2-config.h"
-#include "exynos-hdcp2-protocol-msg.h"
-
-#if defined(CONFIG_HDCP_EMULATION_MODE)
-unsigned char cert[522] = {
- 0x8b, 0xa4, 0x47, 0x42, 0xfb, 0xc9, 0x1b, 0x82,
- 0xe2, 0x76, 0x7f, 0x90, 0x4f, 0xe9, 0x12, 0x33,
- 0x7c, 0x21, 0x1f, 0x7b, 0x25, 0xda, 0x76, 0xde,
- 0xae, 0x59, 0x70, 0xf7, 0xc2, 0xe7, 0xe0, 0x4a,
- 0xcf, 0xbd, 0x5b, 0xba, 0x1c, 0x36, 0x4e, 0xe3,
- 0x78, 0x4c, 0x92, 0x6a, 0x3c, 0xd8, 0xc1, 0xe9,
- 0x51, 0xa9, 0x35, 0xeb, 0xd8, 0xe8, 0xd5, 0x3e,
- 0x3b, 0x1d, 0x00, 0xc1, 0x16, 0x16, 0xd0, 0x58,
- 0xeb, 0x2a, 0x4b, 0xa0, 0x76, 0x9c, 0xd0, 0xe4,
- 0xb2, 0x23, 0xdc, 0xaa, 0x37, 0x07, 0xe5, 0x85,
- 0x1a, 0xaa, 0x13, 0x55, 0x01, 0x4e, 0xed, 0x88,
- 0xca, 0x3f, 0xfb, 0xc5, 0x58, 0x46, 0x91, 0xec,
- 0x35, 0x99, 0x08, 0x1c, 0xa1, 0x22, 0x64, 0xe8,
- 0x3c, 0x2e, 0x70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xe3, 0x05, 0x89, 0x8d, 0x8a, 0x50, 0x87, 0x47,
- 0xbe, 0x29, 0x18, 0x01, 0xb7, 0xc3, 0xdd, 0x43,
- 0x23, 0x7a, 0xcd, 0x85, 0x1d, 0x4e, 0xa9, 0xc0,
- 0x1a, 0xa4, 0x77, 0xab, 0xe7, 0x31, 0x9a, 0x33,
- 0x1b, 0x7a, 0x86, 0xe1, 0xe5, 0xca, 0x0c, 0x43,
- 0x1a, 0xfa, 0xec, 0x4c, 0x05, 0xc6, 0xd1, 0x43,
- 0x12, 0xf9, 0x4d, 0x3e, 0xf7, 0xd6, 0x05, 0x9c,
- 0x1c, 0xdd, /* end of cert_rx */
- };
-
-#define REPEATER 1
-#define NO_REPEATER 0
-
-/* Message Vector */
-/* Transmitter */
-uint8_t msg_rx_send_cert[524] = {
- AKE_SEND_CERT,
- NO_REPEATER,
- /* Receiver Publickey Certificate */
- 0x8b, 0xa4, 0x47, 0x42, 0xfb, 0xc9, 0x1b, 0x82,
- 0xe2, 0x76, 0x7f, 0x90, 0x4f, 0xe9, 0x12, 0x33,
- 0x7c, 0x21, 0x1f, 0x7b, 0x25, 0xda, 0x76, 0xde,
- 0xae, 0x59, 0x70, 0xf7, 0xc2, 0xe7, 0xe0, 0x4a,
- 0xcf, 0xbd, 0x5b, 0xba, 0x1c, 0x36, 0x4e, 0xe3,
- 0x78, 0x4c, 0x92, 0x6a, 0x3c, 0xd8, 0xc1, 0xe9,
- 0x51, 0xa9, 0x35, 0xeb, 0xd8, 0xe8, 0xd5, 0x3e,
- 0x3b, 0x1d, 0x00, 0xc1, 0x16, 0x16, 0xd0, 0x58,
- 0xeb, 0x2a, 0x4b, 0xa0, 0x76, 0x9c, 0xd0, 0xe4,
- 0xb2, 0x23, 0xdc, 0xaa, 0x37, 0x07, 0xe5, 0x85,
- 0x1a, 0xaa, 0x13, 0x55, 0x01, 0x4e, 0xed, 0x88,
- 0xca, 0x3f, 0xfb, 0xc5, 0x58, 0x46, 0x91, 0xec,
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82,
- 0x1d, 0x61, 0x54, 0xa2, 0xd3, 0x16, 0x3e, 0xf7,
- 0xe3, 0x05, 0x89, 0x8d, 0x8a, 0x50, 0x87, 0x47,
- 0xbe, 0x29, 0x18, 0x01, 0xb7, 0xc3, 0xdd, 0x43,
- 0x23, 0x7a, 0xcd, 0x85, 0x1d, 0x4e, 0xa9, 0xc0,
- 0x1a, 0xa4, 0x77, 0xab, 0xe7, 0x31, 0x9a, 0x33,
- 0x1b, 0x7a, 0x86, 0xe1, 0xe5, 0xca, 0x0c, 0x43,
- 0x1a, 0xfa, 0xec, 0x4c, 0x05, 0xc6, 0xd1, 0x43,
- 0x12, 0xf9, 0x4d, 0x3e, 0xf7, 0xd6, 0x05, 0x9c,
- 0x1c, 0xdd, /* end of cert_rx */
-
- 0xe1, 0x7a, 0xb0, 0xfd, 0x0f, 0x54, 0x40, 0x52, /* rrx */
- 0x02, 0x00, 0x02 /* RxCaps */
-};
-
-uint8_t msg_rx_receiver_info[6] = {
- AKE_RECEIVER_INFO,
- 0x00, 0x06,
- 0x01,
- 0x00,
- LC_PRECOMPUTE_SUPPORT
- /* LC_PRECOMPUTE_NOT_SUPPORT */
-};
-
-uint8_t msg_rx_send_rrx[9] = {
- AKE_SEND_RRX,
- 0xe1, 0x7a, 0xb0, 0xfd, 0x0f, 0x54, 0x40, 0x52};
-
-uint8_t msg_rx_send_h_prime[33] = {
- AKE_SEND_H_PRIME,
- 0xee, 0x6f, 0x40, 0x74, 0xeb, 0x1b, 0xd0, 0x7b,
- 0x35, 0x15, 0xb0, 0xf8, 0x28, 0x6a, 0xb5, 0x66,
- 0x96, 0xe9, 0x39, 0x2b, 0xd7, 0x62, 0xbe, 0xd4,
- 0x6a, 0x92, 0xd8, 0xd0, 0xa4, 0x18, 0x4d, 0x42};
-
-uint8_t msg_rx_send_h_prime_v22[32] = {
- 0x82, 0xb8, 0x1a, 0xca, 0xed, 0xfc, 0x87, 0x72,
- 0x7d, 0x17, 0x23, 0x53, 0xcb, 0x81, 0x83, 0xbf,
- 0xdb, 0xba, 0xfb, 0x90, 0xb2, 0x4e, 0x96, 0xfe,
- 0xba, 0x6d, 0xad, 0x67, 0xaa, 0x2b, 0x2a, 0x56};
-
-uint8_t msg_rx_send_pairing_info[17] = {
- AKE_SEND_PAIRING_INFO,
- 0x2e, 0xec, 0xe5, 0x58, 0xe7, 0x8f, 0x1a, 0x96,
- 0xd3, 0xbd, 0x40, 0x14, 0xa6, 0x7e, 0x29, 0x3a};
-
-uint8_t msg_rx_send_pairing_info_v22[16] = {
- 0xe6, 0x57, 0x8e, 0xbc, 0xc7, 0x68, 0x44, 0x87,
- 0x88, 0x8a, 0x9b, 0xd7, 0xd6, 0xae, 0x38, 0xbe};
-
-uint8_t msg_rx_lc_send_l_prime[33] = {
- LC_SEND_L_PRIME,
- 0x19, 0x16, 0xb1, 0x59, 0x73, 0xbe, 0xe3, 0x67,
- 0xf0, 0x56, 0x50, 0x51, 0x44, 0x0f, 0x53, 0xa2,
- 0xdf, 0x53, 0x8d, 0xce, 0xe2, 0x58, 0x1f, 0x65,
- 0xf3, 0xbf, 0x03, 0x0e, 0x68, 0x14, 0xe0, 0xe4};
-
-uint8_t msg_rx_lc_send_l_prime_v22[32] = {
- 0xf2, 0x0f, 0x13, 0x6e, 0x85, 0x53, 0xc1, 0x0c,
- 0xd3, 0xdd, 0xb2, 0xf9, 0x6d, 0x33, 0x31, 0xf9,
- 0xcb, 0x6e, 0x97, 0x8c, 0xcd, 0x5e, 0xda, 0x13,
- 0xdd, 0xea, 0x41, 0x44, 0x10, 0x9b, 0x51, 0xb0};
-
-uint8_t msg_rx_rtt_ready[1] = {RTT_READY};
-
-uint8_t tv_emkey[128] = {
- 0x78, 0x73, 0x6b, 0x24, 0xd6, 0x26, 0xfd, 0x11,
- 0x36, 0xb5, 0x55, 0x5a, 0xa8, 0xbe, 0x46, 0x9e,
- 0x69, 0xa1, 0xef, 0x19, 0xde, 0xd2, 0x43, 0x33,
- 0x7b, 0xe7, 0xe8, 0x88, 0xe2, 0x8e, 0xd1, 0x6f,
- 0x95, 0xb3, 0x56, 0xb7, 0xa0, 0xac, 0x62, 0x26,
- 0x57, 0x03, 0x69, 0x03, 0xf9, 0x5c, 0x8b, 0x1d,
- 0x6a, 0xd5, 0xab, 0xf9, 0x8f, 0x7a, 0x71, 0x51,
- 0xd6, 0x73, 0x22, 0x9a, 0xcd, 0x51, 0x7a, 0x72,
- 0x29, 0x3f, 0xd3, 0xfe, 0xfb, 0xbf, 0xf0, 0x74,
- 0x89, 0x09, 0xcb, 0xc9, 0xcd, 0x57, 0xbb, 0x4a,
- 0x83, 0x94, 0x01, 0xf1, 0x9e, 0x1f, 0x97, 0xe1,
- 0x50, 0x84, 0x5c, 0xd8, 0xb5, 0xb0, 0xe1, 0xab,
- 0xf1, 0x15, 0x19, 0x63, 0x29, 0x4f, 0x37, 0x3b,
- 0xa1, 0xec, 0x14, 0x40, 0xbf, 0xdb, 0x33, 0xbb,
- 0x46, 0xda, 0xf8, 0x3c, 0xa4, 0x73, 0x7e, 0xba,
- 0x97, 0x2a, 0x18, 0x57, 0x6b, 0xd6, 0xf8, 0x58};
-
-uint8_t tv_rrx[8] = {
- 0xe1, 0x7a, 0xb0, 0xfd, 0x0f, 0x54, 0x40, 0x52};
-
-uint8_t tv_hmac_rrx[32] = {
- 0xee, 0x6f, 0x40, 0x74, 0xeb, 0x1b, 0xd0, 0x7b,
- 0x35, 0x15, 0xb0, 0xf8, 0x28, 0x6a, 0xb5, 0x66,
- 0x96, 0xe9, 0x39, 0x2b, 0xd7, 0x62, 0xbe, 0xd4,
- 0x6a, 0x92, 0xd8, 0xd0, 0xa4, 0x18, 0x4d, 0x42};
-
-uint8_t tv_pairing_ekh[16] = {
- 0x2e, 0xec, 0xe5, 0x58, 0xe7, 0x8f, 0x1a, 0x96,
- 0xd3, 0xbd, 0x40, 0x14, 0xa6, 0x7e, 0x29, 0x3a};
-
-uint8_t tv_pairing_m[16] = {
- 0xf9, 0xf1, 0x30, 0xa8, 0x2d, 0x5b, 0xe5, 0xc3,
- 0xe1, 0x7a, 0xb0, 0xfd, 0x0f, 0x54, 0x40, 0x52};
-
-uint8_t tv_lc_hmac[32] = {
- 0x19, 0x16, 0xb1, 0x59, 0x73, 0xbe, 0xe3, 0x67,
- 0xf0, 0x56, 0x50, 0x51, 0x44, 0x0f, 0x53, 0xa2,
- 0xdf, 0x53, 0x8d, 0xce, 0xe2, 0x58, 0x1f, 0x65,
- 0xf3, 0xbf, 0x03, 0x0e, 0x68, 0x14, 0xe0, 0xe4};
-
-uint8_t tv_lc_lsb16_hmac[32] = {
- 0xdf, 0x53, 0x8d, 0xce, 0xe2, 0x58, 0x1f, 0x65,
- 0xf3, 0xbf, 0x03, 0x0e, 0x68, 0x14, 0xe0, 0xe4};
-
-uint8_t tv_eskey[16] = {
- 0xa5, 0xdb, 0xc5, 0x98, 0x50, 0xb1, 0xe4, 0x62,
- 0x09, 0x7d, 0x14, 0x49, 0xcb, 0x01, 0x44, 0x24};
-
-uint8_t tv_plain[32] = {
- 0x00, 0x00, 0x01, 0x00, 0x01, 0x1b, 0x3c, 0x5b,
- 0xb8, 0x00, 0x00, 0x00, 0x01, 0xb5, 0x85, 0x44,
- 0x3b, 0x98, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb2,
- 0x44, 0x54, 0x47, 0x31, 0x41, 0xfe, 0x00, 0x00};
-
-uint8_t tv_cipher[32] = {
- 0x21, 0x8b, 0x92, 0xa3, 0x28, 0xc9, 0x84, 0x36,
- 0x17, 0x46, 0x4e, 0xd8, 0x68, 0x7a, 0x67, 0xb0,
- 0xeb, 0x66, 0x72, 0x30, 0x24, 0x5b, 0x70, 0x2a,
- 0x25, 0x86, 0xab, 0x4a, 0x7a, 0x9a, 0x3a, 0x4f};
-
-uint8_t tv_emkey_v22[128] = {
- 0xa8, 0x55, 0xc2, 0xc4, 0xc6, 0xbe, 0xef, 0xcd,
- 0xcb, 0x9f, 0xe3, 0x9f, 0x2a, 0xb7, 0x29, 0x76,
- 0xfe, 0xd8, 0xda, 0xc9, 0x38, 0xfa, 0x39, 0xf0,
- 0xab, 0xca, 0x8a, 0xed, 0x95, 0x7b, 0x93, 0xb2,
- 0xdf, 0xd0, 0x7d, 0x09, 0x9d, 0x05, 0x96, 0x66,
- 0x03, 0x6e, 0xba, 0xe0, 0x63, 0x0f, 0x30, 0x77,
- 0xc2, 0xbb, 0xe2, 0x11, 0x39, 0xe5, 0x27, 0x78,
- 0xee, 0x64, 0xf2, 0x85, 0x36, 0x57, 0xc3, 0x39,
- 0xd2, 0x7b, 0x79, 0x03, 0xb7, 0xcc, 0x82, 0xcb,
- 0xf0, 0x62, 0x82, 0x43, 0x38, 0x09, 0x9b, 0x71,
- 0xaa, 0x38, 0xa6, 0x3f, 0x48, 0x12, 0x6d, 0x8c,
- 0x5e, 0x07, 0x90, 0x76, 0xac, 0x90, 0x99, 0x51,
- 0x5b, 0x06, 0xa5, 0xfa, 0x50, 0xe4, 0xf9, 0x25,
- 0xc3, 0x07, 0x12, 0x37, 0x64, 0x92, 0xd7, 0xdb,
- 0xd3, 0x34, 0x1c, 0xe4, 0xfa, 0xdd, 0x09, 0xe6,
- 0x28, 0x3d, 0x0c, 0xad, 0xa9, 0xd8, 0xe1, 0xb5};
-
-uint8_t tv_pairing_ekh_v22[16] = {
- 0xe6, 0x57, 0x8e, 0xbc, 0xc7, 0x68, 0x44, 0x87,
- 0x88, 0x8a, 0x9b, 0xd7, 0xd6, 0xae, 0x38, 0xbe};
-
-uint8_t tv_pairing_m_v22[16] = {
- 0xf9, 0xf1, 0x30, 0xa8, 0x2d, 0x5b, 0xe5, 0xc3,
- 0xe1, 0x7a, 0xb0, 0xfd, 0x0f, 0x54, 0x40, 0x52};
-
-uint8_t tv_ske_eskey_v22[16] = {
- 0xb6, 0x8b, 0x8a, 0xa4, 0xd2, 0xcb, 0xba, 0xff,
- 0x53, 0x33, 0xc1, 0xd9, 0xbb, 0xb7, 0x10, 0xa9};
-
-#endif
-#endif
-
diff --git a/hdcp2_if.h b/hdcp2_if.h
deleted file mode 100644
index 049cf4a..0000000
--- a/hdcp2_if.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* todo: include/soc/samsung/hdcp2-if.h
- *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-#ifndef __HDCP2_IF_H__
-#define __HDCP2_IF_H__
-
-int exynos_hdcp2_authenticate(uint32_t *lk_id);
-int exynos_hdcp2_encrypt(uint32_t link_id);
-
-#endif
-