Skip to content

Commit e339a73

Browse files
Eric Biggerswens
authored andcommitted
drm/bridge: it6505: Use SHA-1 library instead of crypto_shash
Instead of using the "sha1" crypto_shash, simply call the sha1() library function. This is simpler and faster. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://patch.msgid.link/20250821175613.14717-1-ebiggers@kernel.org Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
1 parent a3ae338 commit e339a73

2 files changed

Lines changed: 3 additions & 33 deletions

File tree

drivers/gpu/drm/bridge/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ config DRM_ITE_IT6505
120120
select DRM_DISPLAY_DP_AUX_BUS
121121
select DRM_KMS_HELPER
122122
select EXTCON
123-
select CRYPTO
124-
select CRYPTO_HASH
123+
select CRYPTO_LIB_SHA1
125124
select REGMAP_I2C
126125
help
127126
ITE IT6505 DisplayPort bridge chip driver.

drivers/gpu/drm/bridge/ite-it6505.c

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <linux/wait.h>
2222
#include <linux/bitfield.h>
2323

24-
#include <crypto/hash.h>
24+
#include <crypto/sha1.h>
2525

2626
#include <drm/display/drm_dp_helper.h>
2727
#include <drm/display/drm_hdcp_helper.h>
@@ -2107,35 +2107,6 @@ static void it6505_hdcp_part1_auth(struct it6505 *it6505)
21072107
it6505->hdcp_status = HDCP_AUTH_GOING;
21082108
}
21092109

2110-
static int it6505_sha1_digest(struct it6505 *it6505, u8 *sha1_input,
2111-
unsigned int size, u8 *output_av)
2112-
{
2113-
struct shash_desc *desc;
2114-
struct crypto_shash *tfm;
2115-
int err;
2116-
struct device *dev = it6505->dev;
2117-
2118-
tfm = crypto_alloc_shash("sha1", 0, 0);
2119-
if (IS_ERR(tfm)) {
2120-
dev_err(dev, "crypto_alloc_shash sha1 failed");
2121-
return PTR_ERR(tfm);
2122-
}
2123-
desc = kzalloc(sizeof(*desc) + crypto_shash_descsize(tfm), GFP_KERNEL);
2124-
if (!desc) {
2125-
crypto_free_shash(tfm);
2126-
return -ENOMEM;
2127-
}
2128-
2129-
desc->tfm = tfm;
2130-
err = crypto_shash_digest(desc, sha1_input, size, output_av);
2131-
if (err)
2132-
dev_err(dev, "crypto_shash_digest sha1 failed");
2133-
2134-
crypto_free_shash(tfm);
2135-
kfree(desc);
2136-
return err;
2137-
}
2138-
21392110
static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
21402111
{
21412112
struct device *dev = it6505->dev;
@@ -2205,7 +2176,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
22052176
return false;
22062177
}
22072178

2208-
it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av);
2179+
sha1(it6505->sha1_input, i, (u8 *)av);
22092180
/*1B-05 V' must retry 3 times */
22102181
for (retry = 0; retry < 3; retry++) {
22112182
err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,

0 commit comments

Comments
 (0)