Skip to content

Commit c8cfe11

Browse files
tobluxgregkh
authored andcommitted
crypto: caam - use print_hex_dump_devel to guard key hex dumps again
commit 8005dc8 upstream. Use print_hex_dump_devel() for dumping sensitive key material in *_setkey() to avoid leaking secrets at runtime when CONFIG_DYNAMIC_DEBUG is enabled. Fixes: 8d818c1 ("crypto: caam/qi2 - add DPAA2-CAAM driver") Fixes: 226853a ("crypto: caam/qi2 - add skcipher algorithms") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ebd37ee commit c8cfe11

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/crypto/caam/caamalg_qi2.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ static int aead_setkey(struct crypto_aead *aead, const u8 *key,
299299
dev_dbg(dev, "keylen %d enckeylen %d authkeylen %d\n",
300300
keys.authkeylen + keys.enckeylen, keys.enckeylen,
301301
keys.authkeylen);
302-
print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
302+
print_hex_dump_devel("key in @" __stringify(__LINE__)": ",
303303
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
304304

305305
ctx->adata.keylen = keys.authkeylen;
@@ -313,7 +313,7 @@ static int aead_setkey(struct crypto_aead *aead, const u8 *key,
313313
memcpy(ctx->key + ctx->adata.keylen_pad, keys.enckey, keys.enckeylen);
314314
dma_sync_single_for_device(dev, ctx->key_dma, ctx->adata.keylen_pad +
315315
keys.enckeylen, ctx->dir);
316-
print_hex_dump_debug("ctx.key@" __stringify(__LINE__)": ",
316+
print_hex_dump_devel("ctx.key@" __stringify(__LINE__)": ",
317317
DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
318318
ctx->adata.keylen_pad + keys.enckeylen, 1);
319319

@@ -730,7 +730,7 @@ static int gcm_setkey(struct crypto_aead *aead,
730730
ret = aes_check_keylen(keylen);
731731
if (ret)
732732
return ret;
733-
print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
733+
print_hex_dump_devel("key in @" __stringify(__LINE__)": ",
734734
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
735735

736736
memcpy(ctx->key, key, keylen);
@@ -826,7 +826,7 @@ static int rfc4106_setkey(struct crypto_aead *aead,
826826
if (ret)
827827
return ret;
828828

829-
print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
829+
print_hex_dump_devel("key in @" __stringify(__LINE__)": ",
830830
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
831831

832832
memcpy(ctx->key, key, keylen);
@@ -925,7 +925,7 @@ static int rfc4543_setkey(struct crypto_aead *aead,
925925
if (ret)
926926
return ret;
927927

928-
print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
928+
print_hex_dump_devel("key in @" __stringify(__LINE__)": ",
929929
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
930930

931931
memcpy(ctx->key, key, keylen);
@@ -953,7 +953,7 @@ static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
953953
u32 *desc;
954954
const bool is_rfc3686 = alg->caam.rfc3686;
955955

956-
print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
956+
print_hex_dump_devel("key in @" __stringify(__LINE__)": ",
957957
DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
958958

959959
ctx->cdata.keylen = keylen;

0 commit comments

Comments
 (0)