Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25aad749 authored by Ajay Singh Parmar's avatar Ajay Singh Parmar
Browse files

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: default avatarAjay Singh Parmar <aparmar@codeaurora.org>
parent c7073343
Loading
Loading
Loading
Loading
+56 −3
Original line number Diff line number Diff line
@@ -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,11 +1507,13 @@ static bool hdcp_lib_client_feature_supported(void *phdcpcontext)

	rc = hdcp_lib_library_load(handle);
	if (!rc) {
		if (!hdcp_lib_verify_keys(handle)) {
			pr_debug("HDCP2p2 supported\n");
			handle->feature_supported = true;
		hdcp_lib_library_unload(handle);
			supported = true;
		}
		hdcp_lib_library_unload(handle);
	}
exit:
	return supported;
}
+7 −2
Original line number Diff line number Diff line
@@ -1883,8 +1883,13 @@ static void mdss_dp_update_hdcp_info(struct mdss_dp_drv_pdata *dp)
	}

	/* update internal data about hdcp */
	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)