diff mbox

[RFC,v1,15/20] drm/hdcp2.2: Display driver service functions

Message ID 1499848144-8456-16-git-send-email-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ramalingam C July 12, 2017, 8:28 a.m. UTC
DRM HDCP2.2 service function interface is defiend.
This will be initialized from display driver.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 include/drm/drm_hdcp.h | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 207 insertions(+)
diff mbox

Patch

diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h
index 1f9a04d..94acd8d 100644
--- a/include/drm/drm_hdcp.h
+++ b/include/drm/drm_hdcp.h
@@ -30,6 +30,18 @@ 
 struct drm_connector;
 struct drm_hdcp;
 
+struct wired_ake_init;
+struct wired_ake_send_cert;
+struct wired_ake_no_stored_km;
+struct wired_ake_send_hprime;
+struct wired_ake_send_pairing_info;
+struct wired_lc_init;
+struct wired_lc_send_lprime;
+struct wired_ske_send_eks;
+struct wired_rep_send_receiverid_list;
+struct wired_rep_send_ack;
+struct wired_rep_stream_ready;
+
 /**
  * HDCP Software stack specific
  */
@@ -71,6 +83,200 @@  enum wired_protocol {
 	WIRED_PROTOCOL_DP
 };
 
+struct drm_hdcp2_funcs {
+
+	/* Authencation and Key Exchange related */
+	/**
+	 * @prepare_ake_init:
+	 *
+	 * Function to prepare the complete ake_init message and
+	 * pass it onto DRM.
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*prepare_ake_init)(struct drm_hdcp *hdcp,
+			struct wired_ake_init *ake_data, size_t buf_sz,
+			size_t *msg_sz);
+
+	/**
+	 * @verify_rx_cert:
+	 *
+	 * Service Function for verifying the DCP signature of rx
+	 * certificate received from HDCP sink and prepare the msg with km as
+	 * AKE_No_Stored_km or AKE_Stored_km.
+	 *
+	 *	Involves:
+	 *	  DCP signature verification.
+	 *	  Receiver ID check against the SRM table's revocation list.
+	 *	  For Non-Paired receiver
+	 *	    Generate a pseudo-random 128-bit Master Key Km
+	 *	    Encrypt km with kpub_rx
+	 *	    Form AKE_No_Stored_km msg
+	 *	  For Paired Device
+	 *	    Forms AKE_Stored_km with stored Ekh(km) and m
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*verify_rx_cert_prepare_km)(struct drm_hdcp *hdcp,
+			struct wired_ake_send_cert *rx_cert,
+			size_t rx_cert_sz, bool *paired,
+			struct wired_ake_no_stored_km *ek_pub_km,
+			size_t buf_sz, size_t *msg_sz);
+
+	/**
+	 * @verify_hprime:
+	 *
+	 * Service Function for verifying the hprime received from receiver.
+	 *	Involves:
+	 *	  Prepare hprime and compare with received hprime
+	 *		hprime = HMAC_SHA256(r_tx || RxCaps || TxCaps, kd)
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*verify_hprime)(struct drm_hdcp *hdcp,
+			struct wired_ake_send_hprime *rx_hprime,
+			size_t hprime_sz);
+
+	/**
+	 * @store_paring_info:
+	 *
+	 * Service Function to store the Ekh(km) along with m in
+	 * non-volatile memory. This is just to fast track the authentication
+	 * of same receiver from next time onwards.
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*store_paring_info)(struct drm_hdcp *hdcp,
+			struct wired_ake_send_pairing_info *pairing_info,
+			size_t pairing_info_sz);
+
+	/* Locality check related services */
+	/**
+	 * @prepare_lc_init:
+	 *
+	 * Service Function to prepare LC_INIT
+	 *	Involves:
+	 *	  Generation of 64bit pseudo aandom nonce rn
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*prepare_lc_init)(struct drm_hdcp *hdcp,
+			struct wired_lc_init *lc_init_data, size_t buf_sz,
+			size_t *msg_sz);
+
+	/**
+	 * @verify_lprime:
+	 *
+	 * Service Function to verify the lprime received from receiver
+	 *	Involves
+	 *	  Calculate L = HMAC-SHA256(rn, kd XOR rrx)
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*verify_lprime)(struct drm_hdcp *hdcp,
+			struct wired_lc_send_lprime *rx_lprime,
+			size_t lprime_sz);
+
+	/* SKE related services */
+	/**
+	 * @prepare_skey:
+	 *
+	 * Service Function to prepare SKE_Send_Eks msg
+	 *	Involves
+	 *	  Generation of Edkey(ks) and riv
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*prepare_skey)(struct drm_hdcp *hdcp,
+			struct wired_ske_send_eks *ske_data,
+			size_t buf_sz, size_t *msg_sz);
+
+	/* Repeater Support services */
+	/**
+	 * @verify_rep_topology:
+	 *
+	 * Service Function to validate the downstream topology and to prepare
+	 * repeater_auth_ack message.
+	 *	Involves
+	 *	  Validate the devcie count and Depth
+	 *	  Look out for HDCP1.x devices or HDCP2.0 devices
+	 *	  Check receiver ID list against revocation list
+	 *	  Check for roll over of seq_num_V
+	 *	  validate the vprime with Most Significant 128bits of V
+	 *	  V’ = HMAC-SHA256(ReceiverID list || RxInfo || seq_num_V, kd)
+	 *	  Least Significant 128bits of V is formed as ack msg.
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*verify_rep_topology_prepare_ack)(
+			struct drm_hdcp *hdcp,
+			struct wired_rep_send_receiverid_list *rep_topology,
+			size_t receiverid_list_sz,
+			struct wired_rep_send_ack *rep_send_ack, size_t buf_sz,
+			size_t *msg_sz);
+
+	/**
+	 * @verify_mprime:
+	 *
+	 * Service Function to verify the MPrime received
+	 *	M’(or M) = HMAC-SHA256(StreamID_Type || seq_num_M, SHA256(kd))
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*verify_mprime)(struct drm_hdcp *hdcp,
+			struct wired_rep_stream_ready *stream_ready,
+			size_t stream_ready_sz);
+
+	/**
+	 * @authenticate:
+	 *
+	 * Service Function to configure HW as Authenticated
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*authenticate)(struct drm_hdcp *hdcp);
+
+	/**
+	 * @deauthenticate:
+	 *
+	 * Service Function to configure HW as deauthenticated
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*deauthenticate)(struct drm_hdcp *hdcp);
+
+	/**
+	 * @enable_encryption:
+	 *
+	 * Service Function to enable encryption at platform level.
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*enable_encryption)(struct drm_hdcp *hdcp);
+
+	/**
+	 * @disable_encryption:
+	 *
+	 * Service function to disable encryption at platform level.
+	 *
+	 * returns HDCP_STATUS_SUCCESS on success
+	 *		else non-zero HDCP error states
+	 **/
+	enum hdcp_status (*disable_encryption)(struct drm_hdcp *hdcp);
+};
+
 struct drm_hdcp_funcs {
 
 	/**
@@ -125,6 +331,7 @@  struct drm_hdcp {
 	enum wired_protocol protocol;
 
 	const struct drm_hdcp_funcs *hdcp_funcs;
+	const struct drm_hdcp2_funcs *hdcp2_funcs;
 
 	struct mutex mutex;
 };