lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d3e7f6f-1980-4afb-9559-ad23d5779393@collabora.com>
Date: Thu, 26 Sep 2024 10:10:41 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Hermes Wu <Hermes.Wu@....com.tw>
Cc: Kenneth Hung <Kenneth.hung@....com.tw>,
 Andrzej Hajda <andrzej.hajda@...el.com>,
 Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>,
 Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
 Jonas Karlman <jonas@...boo.se>, Jernej Skrabec <jernej.skrabec@...il.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
 Allen Chen <allen.chen@....com.tw>,
 "open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 08/11] drm/bridge: it6505: fix HDCP KSV list did not
 read correctly.

Il 26/09/24 09:50, Hermes Wu ha scritto:
> From: Hermes Wu <Hermes.wu@....com.tw>
> 
> When running the HDCP CTS test on UNIGRAF DPR-100.
> KSV list must be read from DPCD with 5 byte boundary.
> 
> The original aux operation using AUX_NATIVE_READ can not read back the
> KSV list correctly.
> Change to CMD_AUX_GET_KSV_LIST operaction.
> 
> 
> Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
> Signed-off-by: Hermes Wu <Hermes.wu@....com.tw>
> ---
>   drivers/gpu/drm/bridge/ite-it6505.c | 46 +++++++++++++++++++++--------
>   1 file changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 82986f28f653..143d58ed1b0e 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -1188,6 +1188,35 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,
>   	return 0;
>   }
>   
> +static int it6505_get_ksvlist(struct it6505 *it6505, u8 *buf, size_t len)
> +{
> +	int i, request_size, ret;
> +	struct device *dev = it6505->dev;
> +	enum aux_cmd_reply reply;

struct device *dev = it6505->dev;
enum aux_cmd_reply reply;
int request_size, ret;
int i = 0;

> +
> +	for (i = 0; i < len; ) {

do {

> +		request_size = min_t(int, (int)len - i, 15);
> +
> +		ret = it6505_aux_do_transfer(it6505, CMD_AUX_GET_KSV_LIST,
> +					     DP_AUX_HDCP_KSV_FIFO,
> +					     buf + i, request_size, &reply);
> +
> +		DRM_DEV_DEBUG_DRIVER(dev, "request_size = %d, ret =%d", request_size, ret);
> +		if (ret < 0)
> +			return ret;
> +
> +		i += request_size;
> +	}

} while (i < len);

> +
> +	DRM_DEV_DEBUG_DRIVER(dev, "ksv read cnt = %d down_stream_cnt=%d ", i, i / 5);
> +
> +	for (i = 0 ; i < len; i += 5)

Add braces to this loop, otherwise if DRM_DEV_DEBUG_DRIVER() suddenly becomes
empty (because of some configuration option in the future, etc) you'll get build
breakages.

> +		DRM_DEV_DEBUG_DRIVER(dev, "ksv[%d] = %02X%02X%02X%02X%02X",
> +				     i / 5, buf[i], buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4]);
> +
> +	return len;
> +}
> +
>   static void it6505_variable_config(struct it6505 *it6505)
>   {
>   	it6505->link_rate_bw_code = HBR;
> @@ -1969,7 +1998,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
>   {
>   	struct device *dev = it6505->dev;
>   	u8 binfo[2];
> -	int down_stream_count, i, err, msg_count = 0;
> +	int down_stream_count, err, msg_count = 0;
>   
>   	err = it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo,
>   			      ARRAY_SIZE(binfo));
> @@ -1994,18 +2023,11 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
>   			down_stream_count);
>   		return 0;
>   	}
> +	err =  it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
> +	if (err < 0)
> +		return err;
>   
> -	for (i = 0; i < down_stream_count; i++) {
> -		err = it6505_get_dpcd(it6505, DP_AUX_HDCP_KSV_FIFO +
> -				      (i % 3) * DRM_HDCP_KSV_LEN,
> -				      sha1_input + msg_count,
> -				      DRM_HDCP_KSV_LEN);
> -
> -		if (err < 0)
> -			return err;
> -
> -		msg_count += 5;
> -	}
> +	msg_count += down_stream_count * 5;
>   
>   	it6505->hdcp_down_stream_count = down_stream_count;
>   	sha1_input[msg_count++] = binfo[0];



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ