msm: mdss: hdcp2p2: check for valid keys before authentication

HDCP authentication requires valid keys on the source device.
If keys are not present, authentication can never be successful.
Check if the device is provisioned with hdcp keys, if so, proceed
with the hdcp authentication on HDMI/DisplayPort cable connection
otherwise avoid authentication as it may result in unnecessary
re-authentication loop.

Change-Id: I391ee35fa20cfade89773ecb565b220cc6249b8d
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
This commit is contained in:
Ajay Singh Parmar 2016-11-04 19:22:39 -07:00
parent c707334396
commit 25aad74929
2 changed files with 63 additions and 5 deletions

View file

@ -255,6 +255,15 @@ struct __attribute__ ((__packed__)) hdcp_version_rsp {
uint32_t appversion;
};
struct __attribute__ ((__packed__)) hdcp_verify_key_req {
uint32_t commandid;
};
struct __attribute__ ((__packed__)) hdcp_verify_key_rsp {
uint32_t status;
uint32_t commandId;
};
struct __attribute__ ((__packed__)) hdcp_lib_init_req_v1 {
uint32_t commandid;
};
@ -794,6 +803,48 @@ exit:
return rc;
}
static int hdcp_lib_verify_keys(struct hdcp_lib_handle *handle)
{
int rc = -EINVAL;
struct hdcp_verify_key_req *req_buf;
struct hdcp_verify_key_rsp *rsp_buf;
if (!handle) {
pr_err("invalid input\n");
goto exit;
}
if (!(handle->hdcp_state & HDCP_STATE_APP_LOADED)) {
pr_err("app not loaded\n");
goto exit;
}
req_buf = (struct hdcp_verify_key_req *)handle->qseecom_handle->sbuf;
req_buf->commandid = HDCP_TXMTR_VERIFY_KEY;
rsp_buf = (struct hdcp_verify_key_rsp *)
(handle->qseecom_handle->sbuf +
QSEECOM_ALIGN(sizeof(struct hdcp_verify_key_req)));
rc = qseecom_send_command(handle->qseecom_handle,
req_buf,
QSEECOM_ALIGN(sizeof
(struct hdcp_verify_key_req)),
rsp_buf,
QSEECOM_ALIGN(sizeof
(struct hdcp_verify_key_rsp)));
if (rc < 0) {
pr_err("qseecom cmd failed err = %d\n", rc);
goto exit;
}
return rsp_buf->status;
exit:
return rc;
}
static int hdcp_app_init_legacy(struct hdcp_lib_handle *handle)
{
int rc = 0;
@ -1456,10 +1507,12 @@ static bool hdcp_lib_client_feature_supported(void *phdcpcontext)
rc = hdcp_lib_library_load(handle);
if (!rc) {
pr_debug("HDCP2p2 supported\n");
handle->feature_supported = true;
if (!hdcp_lib_verify_keys(handle)) {
pr_debug("HDCP2p2 supported\n");
handle->feature_supported = true;
supported = true;
}
hdcp_lib_library_unload(handle);
supported = true;
}
exit:
return supported;

View file

@ -1883,8 +1883,13 @@ static void mdss_dp_update_hdcp_info(struct mdss_dp_drv_pdata *dp)
}
/* update internal data about hdcp */
dp->hdcp.data = fd;
dp->hdcp.ops = ops;
if (dp->hdcp.hdcp2_present || dp->hdcp.hdcp1_present) {
dp->hdcp.data = fd;
dp->hdcp.ops = ops;
} else {
dp->hdcp.data = NULL;
dp->hdcp.ops = NULL;
}
}
static inline bool dp_is_hdcp_enabled(struct mdss_dp_drv_pdata *dp_drv)