From patchwork Wed Jul 12 08:28:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 9836287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC10160393 for ; Wed, 12 Jul 2017 08:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE51A1FF2D for ; Wed, 12 Jul 2017 08:31:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2792284C7; Wed, 12 Jul 2017 08:31:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EF331FF2D for ; Wed, 12 Jul 2017 08:31:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5F226E3BE; Wed, 12 Jul 2017 08:29:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 609066E3B7; Wed, 12 Jul 2017 08:29:58 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2017 01:29:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,349,1496127600"; d="scan'208";a="126135111" Received: from mint-dev.iind.intel.com ([10.223.25.164]) by fmsmga006.fm.intel.com with ESMTP; 12 Jul 2017 01:29:55 -0700 From: Ramalingam C To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@intel.com Subject: [RFC v1 15/20] drm/hdcp2.2: Display driver service functions Date: Wed, 12 Jul 2017 13:58:59 +0530 Message-Id: <1499848144-8456-16-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499848144-8456-1-git-send-email-ramalingam.c@intel.com> References: <1499848144-8456-1-git-send-email-ramalingam.c@intel.com> MIME-Version: 1.0 Cc: Ramalingam C , uma.shankar@intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP DRM HDCP2.2 service function interface is defiend. This will be initialized from display driver. Signed-off-by: Ramalingam C --- include/drm/drm_hdcp.h | 207 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) 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; };