CHROMIUM: drm/rockchip: Enforce cdn_dp_hdcp_key_1x size assumption

struct cdn_dp_hdcp_key_1x is assumed to be evenly divisible by 6, given
its usage and reserved member. Unfortunately, this is neither
documented, nor enforced anywhere. This patch fixes that.

BUG=b:63816472
TEST=Builds

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/657576
Commit-Ready: Sean Paul <seanpaul@google.com>
Tested-by: Sean Paul <seanpaul@google.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Change-Id: I3f683cb9dd48d6e6d104d2e9a1a94c03e34d25dd
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
Sean Paul
2017-09-07 14:49:03 -04:00
committed by Tao Huang
parent 5d712529cc
commit effb787b85
2 changed files with 6 additions and 3 deletions

View File

@@ -215,9 +215,9 @@ static int cdn_dp_start_hdcp1x_auth(struct cdn_dp_device *dp)
arm_smccc_smc(RK_SIP_HDCP_CONTROL, HDCP_KEY_DATA_START_TRANSFER,
0, 0, 0, 0, 0, 0, &res);
buf = (uint64_t *)&dp->key;
for (; !res.a0 && (u8 *)buf - (u8 *)&dp->key < sizeof(dp->key);
BUILD_BUG_ON(sizeof(dp->key) % 6);
for (buf = (uint64_t *)&dp->key;
!res.a0 && (u8 *)buf - (u8 *)&dp->key < sizeof(dp->key);
buf += 6)
arm_smccc_smc(RK_SIP_HDCP_KEY_DATA64, buf[0], buf[1],
buf[2], buf[3], buf[4], buf[5], 0, &res);

View File

@@ -80,6 +80,9 @@ enum {
CDN_DP_HDCP_KEY_LEN = 308,
};
/*
* Size must be divisible by 6
*/
struct cdn_dp_hdcp_key_1x {
u8 ksv[CDN_DP_HDCP_KSV_LEN];
u8 device_key[CDN_DP_HDCP_DPK_LEN];